Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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=/. Now if 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 /home/servers.

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.

share|improve this question
    
Long text but excuseme if I didn't understand. Do you mind telling us what exactly is what you wish to do? All the processes you did seems to be correct but somehow it seems also not to be satisfying what you wish to achieve, and you may get a better support if you tell us what exactly is what you expect from these configurations. Thank you very much. –  Geppettvs D'Constanzo Nov 23 '13 at 19:27
    
I added more information to the question, sorry for any confusion. –  James Trotter Nov 23 '13 at 19:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.