Add New User Snafu in Ubuntu with UserAdd?

Mindwatering Incorporated

Author: Tripp W Black

Created: 06/15/2009 at 03:01 AM

 

Category:
Ubuntu
Configuration Files

If you add a user by:
# useradd testuser

Then you will create a user w/o a home folder, no personal group, and w/o a password to login. You now get to either delete the user or create the home folder manually.

__________

What you should have done to add a new user in the beginning is:
(This creates the new user, the private user group, and the starting home folder, and adds the "skel" (skeleton) profile/bash files for login for the new user.

# sudo useradd -d /home/testuser -m testuser
# sudo passwd testuser

__________

However, if it's been a while and you don't want to change a UID screw up because their ID is already in use in samba or postfix, then we can create the missing stuff...

To create the home folder:
# mkdir /home/testuser


To get the 3 hidden files added:
# cp /etc/skel/.profile /home/testuser
# cp /etc/skel/.bashrc /home/testuser
# cp /etc/skel/.bash_logout /home/testuser


To set the permissions of testuser's home:
# chown -R testuser /home/testuser

We don't use the personal groups for anything, so for us their loss was no loss.
If you want to add a user to a "secondary" (not their personal group) you do:
# usermod -a -G grpnm testuser


previous page

×