March 8, 2009
How to: Configure users on CentOS 5
To add user1
# useradd user1
This command will do the following:
- Create a home directory,/home/user1, for user1
- Add the configuration files from /etc/skel to the user home directory
- Assign the /bin/bash shell
To list the hidden files
# ls -a /home/user1
To assign a password to user1
# passwd user1
To delete user1 and the user1's home directory
# userdel -r user1
To assign user1 to the admin group
# usermod -G admin user1
To allow user1 full administrative
- Add user1 to the wheel group with this command
# usermod -G wheel user1
# vi /etc/sudoers
- Add the following line:
user1 ALL=(ALL) ALL
To add user2, user3 and user4 to the training group, and to allow them to share the /home/training directory:
# mkdir /home/training
-
# useradd user2; passwd user2 # useradd user3; passwd user3 # useradd user4; passwd user4
# vi /etc/group
- Add the training group, give it a unique group id, and add user2, user3, and user4 to the group as follows:
training,x,9999,user2,user3,user4
# chmod 2770 /home/training


