Wednesday 27 May 2009

Linux user account setup (basic)

Passwords
To change a password for another user:
# passwd [username]
To lock an account and unlock an account:
# passwd -l [username]
# passwd -u [username]
WARNING: If Locking the root account ensure that you have allowed and tested access with sudo first!
Users and Groups Creation and DeletionTo list the groups a user is a member of:
# groups [username]
Groups:
# groupadd [groupname]
To create a user and set primary group:
# useradd -g [groupname] [username]
To create a user and set secondary group:
# useradd -G [groupname] [username]
To add group to existing users secondary groups:
# usermod -a -G [groupname] [username]
To delete a user:
#userdel -r [username]
-r deletes the users home directory as well as account

Misc
To see a summary of logins to date (leave username blank to see all logins):
# last [username]

No comments:

Post a Comment