useradd creates user but fails to make home directory
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
useradd creates user but fails to make home directory
Hi all,
when I try to add a user it fails to make the corresponding home directory. I can still su to the user, set the password, and everything else.
the output is as follows:
$ useradd username
useradd: cannot create home directory /home/username
I read that this could be a result of there not being enough space but if I do df -h, i see that only 88% of the memory is being used.
"useradd -m username" will create a home directory. By default, useradd alone will not. Add -k to add files from your skeleton directory. This is all in the man page.
Personally, learning to use useradd is a good thing because it helps you better learn how to add users to your system, but I tend to get lazy with certain things such as adding a user so I use adduser instead.
If you want to try adduser, either create a new user with a different name or first delete the original user you created with userdel. See the man pages for details.
hi do the following
#groupadd youruser
#useradd -g youruser -s /bin/bash -m -k /dev/null youruser
It will create a home directory, set the default shell to bash, point the skeleton to /dev/null, set userid and groupid to the same id.
I am running all the commands as root. My distro is centos 5.0
all of the below gave me the same error as before, "unable to create home directory /home/username"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.