Bisakah kita mengetahui siapa saja yang login ke dalam server Linux dengan menggunakan command line? Jawabanya ya, sangat mungkin untuk mengetahuinya menggunakan command line. Kali ini kami akan membahas mengenai cara untuk mengetahui user names siapa saja yang login ke server Linux.
Ada 3 Command Yang Bisa Digunakan Untuk Melihat Siapa Saja Yang Login Ke Server Linux
W Command
W command dapat digunakan untuk menulis informasi yang berguna mengenai berapa banyak user yang login ke dalam server Linux, dan mengetahui proses apa saja yang mereka jalankan. Sebagai contohnya:
[[email protected]:~]w 21:36:01 up 274 days, 17:33, 1 user, load average: 0.19, 0.24, 0.29 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT ultrauser pts/0 111.111.111.111 20:46 0.00s 0.02s 0.00s sshd: ultrauser [priv] [[email protected]:~]
Untuk melihat informasi yang lebih banyak mengenai user tertentu, kamu bisa menjalankan command ini:
w user
Dimana user kamu ganti dengan nama user yang ingin kamu lihat. Contohnya:
[webtech@localhost ~]$ w webtech 23:39:16 up 54 min, 1 user, load average: 0,48, 0,48, 0,41 USER TTY LOGIN@ IDLE JCPU PCPU WHAT webtech tty2 22:45 54:28 14:38 2.52s /opt/google/chrome/chrome --type=renderer --enable-features=*AutofillCreditCardSigninPromo<AutofillCr [webtech@localhost ~]$
Who Command
Who command merupakan command berikutnya yang dapat digunakan untuk melihat siapa saja yang login kedalam server Linux.
Sebagai contoh:
[[email protected]:~]who ultrauser pts/0 2017-01-29 20:46 (111.111.111.111) [[email protected]:~]
Kamu juga bisa menggunakan -a untuk mem-print out semua informasinya, dengan output seperti berikut:
[[email protected]:~]who -a system boot 2016-04-30 05:03 run-level 3 2016-04-30 05:03 LOGIN tty1 2016-04-30 05:03 7200 id=1 LOGIN tty2 2016-04-30 05:03 7202 id=2 LOGIN tty3 2016-04-30 05:03 7204 id=3 LOGIN tty4 2016-04-30 05:03 7206 id=4 LOGIN tty5 2016-04-30 05:03 7208 id=5 LOGIN tty6 2016-04-30 05:03 7210 id=6 ultrauser + pts/0 2017-01-29 20:46 . 13648 (111.111.111.111) pts/1 2017-01-27 08:45 24158 id=ts/1 term=0 exit=0 pts/2 2016-09-16 15:08 32364 id=ts/2 term=0 exit=0 pts/3 2017-01-04 17:09 15024 id=ts/3 term=0 exit=0 pts/2 2016-07-22 08:45 22855 id=/2 term=0 exit=0 pts/1 2016-10-03 16:41 25856 id=/1 term=0 exit=0 pts/4 2017-01-03 16:52 25470 id=ts/4 term=0 exit=0 pts/5 2017-01-03 13:31 26228 id=ts/5 term=0 exit=0 [[email protected]:~]
Ada banyak pilihan untuk menambahkan who command:
-a, --all same as -b -d --login -p -r -t -T -u -b, --boot time of last system boot -d, --dead print dead processes -H, --heading print line of column headings -l, --login print system login processes --lookup attempt to canonicalize hostnames via DNS -m only hostname and user associated with stdin -p, --process print active processes spawned by init -q, --count all login names and number of users logged on -r, --runlevel print current runlevel -s, --short print only name, line, and time (default) -t, --time print last system clock change -T, -w, --mesg add user's message status as +, - or ? -u, --users list users logged in --message same as -T --writable same as -T --help display this help and exit --version output version information and exit
Users Command
Users command dapat digunakan untuk mem-print out nama dari user yang ke dalam sistem. Command ini membaca informasi dari file utmp.
Contoh outputnya seperti:
[[email protected]:~]users ultrauser johndoe linuxuser2 alterego34
Untuk users command ini hanya memperlihatkan sedikit informasi.