Thursday 21 June 2012

command for adding and removing linux users

This command removes the user and their home directory too
sudo /usr/sbin/userdel -r theuser.name

Use useradd for adding users
sudo /usr/sbin/useradd theuser.name

Add the user to the wheel group
sudo /usr/sbin/usermod -G10 theuser.name

To set a users password
sudo passwd theuser.name

Expire the password so they need to change it at next logon (need to su to root)
chage -d 0 theuser.name

No comments:

Post a Comment