Difference between revisions of "Redhat: Create user command line"
(→Passwd) |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 42: | Line 42: | ||
== Groupadd == | == Groupadd == | ||
| + | |||
| + | The groupadd command creates a group with the name given. The g flag can be used to set the GID, otherwise it will take the next available GID. | ||
| + | |||
| + | |||
| + | <syntaxhighlight> | ||
| + | groupadd -g 60001 project # create a group called project with GID 60001 | ||
| + | </syntaxhighlight> | ||
== Passwd == | == Passwd == | ||
| Line 54: | Line 61: | ||
== Userdel == | == Userdel == | ||
| + | |||
| + | To delete a user is simple: | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | userdel <username> | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | But this will not delete the home_directory or the files in it. To do that add the -r flag. | ||
== Groupdel == | == Groupdel == | ||
| + | |||
| + | It simple.... | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | groupdel <group name> | ||
| + | </syntaxhighlight> | ||
Latest revision as of 14:37, 30 August 2013
Command Line User and Group Creation
There are a number of commands that can automate the process of creating a User and / or Group. This will complete all of the needed steps for you.
Useradd
The Useradd command creates a user accoding the the options and values given to it. The modt basic usage create a user with the next available UID and an equivalent private group.
Useradd <username>| -u <UID> | overrides the default UID |
| -g <GID> | Overrides the Default GID |
| -c info | Comments on the user |
| -d <home _dir> | Overrides teh default Home directory |
| -e <date> | expriation date for the account |
| -f <num> | number of days after password expiration when account is disabled |
| -G <group> | groups the user is a member of |
| -s <shell> | Overrides the default shell |
Groupadd
The groupadd command creates a group with the name given. The g flag can be used to set the GID, otherwise it will take the next available GID.
groupadd -g 60001 project # create a group called project with GID 60001Passwd
The passwd is used to set a new password. If a username is not provided it sets the password for the user who ran the command.
Redhat will discourage the use of simplistic, dictionary and short passwords - BUT it will not prevent them.
passwd <username>Userdel
To delete a user is simple:
userdel <username>But this will not delete the home_directory or the files in it. To do that add the -r flag.
Groupdel
It simple....
groupdel <group name>