Create user accounts:
By default when creating users in Red Hat a group with the username will also be created and this will be the main group for the user, with a group id higher than 500. To create a user in this way, and also accepting all other defaults (create user directory, bash as the user shell, etc) simply do:
useradd usernameYou can check that a new group has also been created:
getent group | grep usernameAlternatively, you can assign the user to an already existing group:
useradd -g groupname usernameThere are quite a number of options when creating users, so have a look at them.
Delete user accounts:
This one is fairly simple:
userdel -r usernameNote that this will remove the home directory and mail spool for the user, if you want the directory and mail spool to remain, just user:
userdel usernameModify user accounts:
The command used to modify accounts, usermod, is very similar to the one used to add them. Say you want to change the user's shell:
usermod -s /bin/sh usernameor make the user member of a couple of extra secondary groups:
usermod -aG groupname1,groupname2 usernameor change the username:
usermod -l newusername oldusername
No comments:
Post a Comment