idoneus Apprentice
Joined: 26 Mar 2003 Posts: 243 Location: Graz, Austria
|
Posted: Thu Apr 24, 2003 6:13 pm Post subject: SA3: Adding Users |
|
|
Navigation: [System administration] [Table of Contents]
Adding Users
The relevant commands for this faq are:
An alternative to the useradd command is superadduser. emerge superadduser will install it. This is an interactive command that prompts for needed information.
You can / should also compare
Code: | man 8 useradd
man 1 passwd |
To add a new user to your Gentoo system you would basically type:
Options to be used with useradd
- To create a home directory for the new user type:
(By default that will be the username attached to the standard home directory, which should be /home.)
Code: | useradd -m (username) |
To specify anouther home directory for your user and create it type:
Code: | useradd -d (directory name) -m (username) |
You should also specify the shell for the user to log in to. This can be done using:
Code: | useradd -s /bin/bash (username) |
You may also specify the primary group the user should belong to. I preferr to add each user to the group users some give each user their own group. Using this command you must make sure that the group exists before creating the user. (This should be the case with users)
Code: | useradd -g users (username) |
If you want to specify other groups your user should belong to, like wheel (compare this faq) type:
Code: | useradd -G wheel,othergroup1,othergroup2 (username) |
be carefull that each group is seperated only with a , and no extra space.
Finally you may also want to set an expiration date for the account.
Code: | useradd -e YYYY-MM-DD (username) |
There are quite some options left for useradd, to read more about them compare man 8 useradd.
So for a normal system you might want to type:
Code: | useradd -g users -G wheel -s /bin/bash -m (username) |
Following this it's time to set the password for the new user.
After this everything should be set and you can now login with your new user. Good Luck!
Sources: man 8 useradd and the Adding users thread.
EDIT:
Made minor formatting changes.
Added superadduser reference. -- pjp |
|