Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SA3: Adding Users
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Frequently Asked Questions
View previous topic :: View next topic  
Author Message

Joined: 26 Mar 2003
Posts: 243
Location: Graz, Austria

PostPosted: Thu Apr 24, 2003 6:13 pm    Post subject: SA3: Adding Users Reply with quote

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
man 8 useradd
man 1 passwd

To add a new user to your Gentoo system you would basically type:
useradd (username)

Options to be used with useradd

  1. 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.)
     useradd -m (username)

  2. To specify anouther home directory for your user and create it type:
    useradd -d (directory name) -m (username)

  3. You should also specify the shell for the user to log in to. This can be done using:
    useradd -s /bin/bash (username)

  4. 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)
    useradd -g users (username)

  5. If you want to specify other groups your user should belong to, like wheel (compare this faq) type:
     useradd -G wheel,othergroup1,othergroup2 (username)

    be carefull that each group is seperated only with a , and no extra space.

  6. Finally you may also want to set an expiration date for the account.
    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:
useradd -g users -G wheel -s /bin/bash -m (username)

Following this it's time to set the password for the new user.
passwd (username)

After this everything should be set and you can now login with your new user. Good Luck! :P

Sources: man 8 useradd and the Adding users thread.

Made minor formatting changes.
Added superadduser reference. -- pjp
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Frequently Asked Questions All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum