Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Frequently Asked Questions
  • Search

SA3: Adding Users

Some of the most commonly heard questions in the Gentoo Community, along with answers.
Post Reply
Advanced search
1 post • Page 1 of 1
Author
Message
idoneus
Apprentice
Apprentice
User avatar
Posts: 243
Joined: Wed Mar 26, 2003 8:07 am
Location: Graz, Austria
Contact:
Contact idoneus
Website

SA3: Adding Users

  • Quote

Post by idoneus » Thu Apr 24, 2003 6:13 pm

Navigation: [System administration] [Table of Contents]

Adding Users

The relevant commands for this faq are:
  • useradd
  • passwd
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 
To add a new user to your Gentoo system you would basically type:

Code: Select all

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.)

    Code: Select all

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

    Code: Select all

    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:

    Code: Select all

    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)

    Code: Select all

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

    Code: Select all

     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.

    Code: Select all

    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: Select all

useradd -g users -G wheel -s /bin/bash -m (username)
Following this it's time to set the password for the new user.

Code: Select all

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.

EDIT:
Made minor formatting changes.
Added superadduser reference. -- pjp
Top
Post Reply
1 post • Page 1 of 1

Return to “Frequently Asked Questions”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic