bash-tutorial/tutorial/add_user.org

54 lines
1.2 KiB
Org Mode
Raw Normal View History

2022-07-18 14:23:28 +02:00
#+options: toc:nil num:nil author:nil
2022-07-03 21:06:29 +02:00
* Adding a new user
Check users that are logged
#+begin_src bash
users
#+end_src
#+RESULTS:
: myuser
2022-07-18 14:23:28 +02:00
Creating a new user called "test"
2022-07-03 21:06:29 +02:00
#+begin_example bash
sudo useradd -p -m test
#+end_example
The configuration file "useradd" sets options for this command:
#+begin_src bash
sudo less /etc/default/useradd
#+end_src
#+RESULTS:
| # 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:
#+begin_src bash
head -4 /etc/passwd
#+end_src
#+RESULTS:
| root:x:0:0::/root:/bin/bash |
| bin:x:1:1::/:/sbin/nologin |
| daemon:x:2:2::/:/sbin/nologin |
| mail:x:8:12::/var/spool/mail:/sbin/nologin |
PS: ~head()~ is used to show only the first four lines.