CentOS Linux Server Guide

CentOS Login, Logout and Shutdown

Login and Logout via Terminal User Interface Mode (TUI)

 

LOGIN

Just imagine that TUI mode is the DOS mode you use to login to Linux server. The benefit of using TUI was discuss earlier in last module.

 

In the following example, we login using user Jane account. The window session we are working on is call shell. If the system can successfully verify the login id and password, the login is permitted.

 

login as: jane
jane@192.168.1.8's password:
Last login: Sat Nov 28 05:32:44 2009 from 192.168.1.3
[jane@srv1 ~]$ pwd
/home/jane
[jane@srv1 ~]$ whoami
jane
[jane@srv1 ~]$ id -un
jane
 

 

The above screen capture : Last login: Sat Nov 28 05:32:44 2009 from 192.168.1.3 means I was login previously from ip 192.168.1.3.

 

what is [jane@srv1 ~]$ means?

 
jane the user name/ user id you login to Linux server
srv1 this is the Linux server name (hostname)
~ this is user's home directory (like MS Windows 7, C:\Users\Jane)
$ this $ symbol tells you are in normal user mode

 

 

You will notice that I issue 3 Linux command here
pwd this command tell us in which directory we are current in. In above example, we know that /home/jane means, we are in jane's directory which is the subfolder of /home directory.
whoami this command tell you user id that you login in.
id -un same as whoami command, also tell you your username/userid

 

So, if I need to work under root privilege, should I logout user account jane and login as root? the answer is NO. you can issue the following command.

 
[jane@srv1 ~]$ su - root
Password:
[root@srv1 ~]# pwd
/root
[root@srv1 ~]# whoami
root

 

 

You might interested to see also the differences with su and su - command.

 

 

LOGOUT

There are two commands to logout from the Linux system.

 
[root@srv1 ~]# logout

[root@srv1 ~]#exit
 

 

However, there are some differences, as for beginners we just consider both command are the same as this moment.
logout This will logout the user from the login shell.
exit This command is to end a shell session

 

 

Back to CentOS Login, Logout and Shutdown



Copyright 2011 http://www.1a-centosserver.com All Rights Reserved

All trademarks are the property of their respective owners.

Contact Us | Terms of Use | Privacy Policy