bash-tutorial/tutorial/add_user.org

1.2 KiB

Adding a new user

Check users that are logged

users
myuser

Creating a new user called "test"

sudo useradd -p -m test

The configuration file "useradd" sets options for this command:

sudo less /etc/default/useradd
# useradd defaults file for ArchLinux
# original changes by TomK
GROUP=users
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
(END)

PS: should use "sudo" to see the file. And less() or more() will show the file

The following file contains a list of fields about each user:

 head -4 /etc/passwd
root0:0::/root:/bin/bash
bin1:1::/:/sbin/nologin
daemon2:2::/:/sbin/nologin
mail8:12::/var/spool/mail:/sbin/nologin

PS: head() is used to show only the first four lines.