Check Login History in Linux

How do you check the hostname or system name that you have logged into?

[rreddy@knoblab ~]$ hostname
knoblab.sys1

 

How can you check what user credentials that you have logged in?

We have many ways to figure out this,

[rreddy@knoblab ~]$ whoami
rreddy

 

We can also type “id” command on the terminal,

[rreddy@knoblab ~]$ id
uid=1000(rreddy) gid=1000(rreddy) groups=1000(rreddy)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

 

Apart from the above, we can also confirm from the terminal section,

[rreddy@knoblab ~]$

 

Highlighted in red color is the present user id that you have logged into, this will help as you might switch back and forth between different accounts.

 

Note: 

The above option might not be available in every shell.

 

How to confirm that you are a non-root user? Or root user?

[rreddy@knoblab ~]$

 

If that portion is “$” then it’s a non-root user account.

If that section is “#” symbol, then we can confirm that it’s a root user account.

 

Who is a root user in Linux/Unix systems?

The root user is an administration account and it will possess all access credentials on the server without any restrictions.

One can install, uninstall a software or modify it.

The root user can add a new user or modify account’s access levels or delete it etc.

 

Note: 

In organizations, when we are working as a team we generally denied from root permissions and alternative arrangements are made.

 

How to check which all other users have logged into system? And from which terminals?

[rreddy@knoblab ~]$ who
rreddy :0 2016-01-13 19:45 (:0)
rreddypts/1 2016-01-14 01:59 (:0)
rreddypts/2 2016-01-14 09:44 (192.168.0.101)

 

Here, I have logged in through virtual machine and first 2 rows represent that. The last row, represents the terminal connection from PUTTY. That’s why, we can see an IP address associated with it.

 

Topics Summary