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: Select all
man 8 useradd
man 1 passwd Code: Select all
useradd (username)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: Select all
useradd -m (username) - To specify anouther home directory for your user and create it type:
Code: Select all
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: Select all
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: Select all
useradd -g users (username) - If you want to specify other groups your user should belong to, like wheel (compare this faq) type:
be carefull that each group is seperated only with a , and no extra space.
Code: Select all
useradd -G wheel,othergroup1,othergroup2 (username) - Finally you may also want to set an expiration date for the account.
Code: Select all
useradd -e YYYY-MM-DD (username)
So for a normal system you might want to type:
Code: Select all
useradd -g users -G wheel -s /bin/bash -m (username)Code: Select all
passwd (username)Sources: man 8 useradd and the Adding users thread.
EDIT:
Made minor formatting changes.
Added superadduser reference. -- pjp
