Tech Notes

Linux Users and Permissions

To check which users are logged in, we can use “w” command:

anojkumar@n36-186-058:~$ w
 12:04:33 up 2 days, 19:58,  1 user,  load average: 0.00, 0.05, 0.07
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
manojkum pts/0    10.200.84.155    12:04    1.00s  0.01s  0.00s w

To check users history who logged in:

manojkumar@n36-186-058:~$ last
manojkum pts/0        10.200.84.155    Thu Apr  4 12:04   still logged in
manojkum pts/0        10.200.84.155    Thu Apr  4 12:03 - 12:04  (00:00)
manojkum pts/0        10.200.84.155    Thu Apr  4 11:22 - 11:34  (00:12)
manojkum pts/0        10.200.84.155    Thu Apr  4 11:04 - 11:18  (00:13)
manojkum pts/0        10.200.84.155    Thu Apr  4 10:47 - 10:52  (00:05)
manojkum pts/0        10.200.84.155    Thu Apr  4 10:42 - 10:47  (00:05)
manojkum pts/0        10.200.84.155    Thu Apr  4 10:41 - 10:41  (00:00)
manojkum pts/0        10.200.84.155    Thu Apr  4 10:12 - 10:26  (00:14)
manojkum pts/0        10.200.84.155    Thu Apr  4 09:54 - 10:08  (00:13)
manojkum pts/0        10.200.84.155    Thu Apr  4 09:49 - 09:54  (00:05)
manojkum pts/0        10.200.84.155    Thu Apr  4 09:28 - 09:28  (00:00)
manojkum pts/0        10.200.84.155    Thu Apr  4 09:24 - 09:26  (00:01)
manojkum pts/0        10.200.84.155    Thu Apr  4 09:13 - 09:19  (00:06)
manojkum pts/0        10.200.84.155    Thu Apr  4 09:00 - 09:05  (00:05)
reboot   system boot  5.4.56.bsk.10-am Mon Apr  1 16:06   still running
root     ttyS0                         Thu Jan 20 08:54 - crash (802+07:11)
reboot   system boot  5.4.56.bsk.10-am Thu Jan 20 08:53   still running
reboot   system boot  5.4.56.bsk.10-am Thu Jan 20 06:53   still running
reboot   system boot  5.4.56.bsk.10-am Tue Jan 18 14:03 - 14:04  (00:01)
reboot   system boot  5.4.56.bsk.10-am Tue Jan 18 13:59 - 14:03  (00:04)
reboot   system boot  5.4.56.bsk.10-am Tue Jan 18 13:57 - 13:58  (00:01)
reboot   system boot  5.4.56.bsk.10-am Tue Jan 18 13:47 - 13:48  (00:01)
reboot   system boot  5.4.56.bsk.10-am Tue Jan 18 13:27 - 13:47  (00:19)
reboot   system boot  4.19.0-18-amd64  Tue Jan 18 13:25 - 13:27  (00:02)
reboot   system boot  4.19.0-18-amd64  Mon Jan 10 15:23 - 15:24  (00:00)
reboot   system boot  4.19.0-18-amd64  Mon Jan 10 15:22 - 15:22  (00:00)

wtmp begins Mon Jan 10 15:22:28 2022

List all users:

manojkumar@n36-186-058:~$ cat /etc/passwd | grep manoj
manojkumar:x:1001:1001::/home/manojkumar:/bin/bash

Create and delete users:

useradd
userdel

user passwords are stored in /etc/shadow

Posted

in

by

Tags: