I have a problem on my server, I have a folder I set up
/home/servers. but when I try to create a user in it with
/home/servers/USERNAME (creating the directory BEFORE I create the user) I then use
useradd -s /bin/false -d /home/servers/USERNAME -p ENCRYPTEDPASSWORD USERNAME, but this doesnt work and my even though in
/etc/passwd the home dir is listed correctly, but when logged in it responds that there is no HOME directory, default HOME=/.
useradd -s /bin/false -d /home/USERNAME -p ENCRYPTEDPASSWORD USERNAME, it all works correctly BUT www-data needs access to /home to be able to create directorys (the users are actually created through a PHP script, along with the directory. hence why www-data needs access to all of this)
How can I work around any of this, in the easiest and safest way possible?
I have a PHP page, when that PHP page is exectuted it creates the directory
/home/servers/USERNAME then executes the shell command
useradd -s /bin/false -d /home/servers/USERNAME -p ENCRYPTEDPASSWORD USERNAME (do not worry about the permissions of anything to do with the PHP, that all works fine and the problem persists even when entered directly into the terminal), hence the need for
www-data write permissions on
The only problem is, when attempting to log in as one of these users, it says the user has no home directory and it is defaulting
HOME=/, when I run the command as
useradd -s /bin/false -d /home/USERNAME -p ENCRYPTEDPASSWORD USERNAME everything works fine, but no matter what I do I cant give
www-data write permissions to
/home so that method cannot work for me either. I need a way of my PHP code (
www-data group) being able to create the directory AND the user actually have it work correctly for them.