Visit Jeremy's Blog.
Go Back > Blogs > Just a few notes...
User Name


This blog is just my notes from my experience with Linux and especially Slackware.

There is no garantee that it will work with your system.

They are published just in case they could help someone (and help me not to forget how I did some tricks) ;-)
Rate this Entry

How to add a user

Posted 10-18-2010 at 09:14 AM by T0sh1r0
Updated 10-18-2010 at 09:39 AM by T0sh1r0

There are 2 ways to add a user via the command line:
1. useradd - the pure command line way!
Let's add myself on the system:
useradd -m -G users,wheel,audio -s /bin/bash T0hs1r0
-m creates the home directory
-G adds my user to a list of groups
-s provides the default shell for my user
To set the password for the user:
passwd T0sh1r0
useradd -D
will display the current default values and
useradd -D [options]
will update the default values.

2. adduser - it's more interactive.
Just type
and the tool will ask you a series of questions about the user to create.
No need to remember tricky -o ptions.

Of course for more details, man useradd and man adduser ;-)
Views 15612 Comments 4
« Prev     Main     Next »
Total Comments 4


  1. Old Comment
    An additional tip would be to create a group just for the user before running any of the commands. As well as picking a good uid and gid that are the same for simplicity.

    However, Slackware doesn't really make any recommendations for this. I learned the habit from starting out with another distro and doesn't really add anything in the way of security for the user because they still have to have the sense to chown their home directory without read access for 'others'
    Posted 10-20-2010 at 01:24 AM by lumak lumak is offline
    Updated 10-20-2010 at 01:29 AM by lumak
  2. Old Comment
    What are the advantages to create a group per user?

    If some users need to have access to the same resource, is it not better to create a new group and add them in this group?

    Anyway, thanks for your input ;-)
    Posted 10-21-2010 at 11:37 AM by T0sh1r0 T0sh1r0 is offline
  3. Old Comment
    It's more of the idea that the user completely owns their home directory.

    It's the difference between
    chown name:name /home/name
    chmod 750 /home/name

    chown name:users /home/name
    chmod 700 /home/name

    that is assuming you don't want anybody but the user that owns a home directory to be able to read the files in that user's home.

    751 and 711 may also be used... but the difference is between opening it and seeing nothing vs. not being able to open it at all.
    Posted 10-21-2010 at 06:15 PM by lumak lumak is offline
  4. Old Comment
    OK. I see what you mean.
    Thanks for the explanation. It's always nice to learn something.
    Posted 10-22-2010 at 01:50 AM by T0sh1r0 T0sh1r0 is offline


All times are GMT -5. The time now is 07:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration