Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
From the GUI or the command line? On the command line, logout, exit, or CTRL+D will work. In the GUI, logout is an option under a menu somewhere, generally. After you have logged out, the login prompt will return and you can login as another user Note: root can open sessions for any other user without specifying a password. In a terminal, as root, type su <user>, and you will become that user. This is handy if you're working as root (which you shouldn't be doing too much) and you need to quickly become another user. Normal users can do this trick, too, but they have to know the password of the user they're su'ing to.
The command "su" means switch user. The normal user will
have a $ prompt, while root will have a # prompt. If you
only have 2 users and are logged in as a normal user, when
you issue "su" you'll simply be asked for the other user (root)
password like this
Code:
mingdao@james:~$ su
Password:
root@james:/home/mingdao# exit
exit
mingdao@james:~$ su
Originally posted by xtremcoder I'm doing this remotely through SSH, so if I type exit it will close my client.
I tried logout but it said I had to use exit, and that closes my client.
My example below might be confusing, but look. That comp has 2 normal users (mingdao and james)
and of course root.
If you issue these three commands on your system ->
man ssh
man exit
(terminate the current process)
man su
(su is used to become another user during a login session. Invoked without a username, su defaults to becoming the super user.)
they may clarify what I might have confused for you.
Code:
mingdao@james:~$ ssh 192.168.1.11
mingdao@192.168.1.11's password: <- mingdao logged in
Last login: Tue Oct 5 11:41:14 2004 from 192.168.1.31
Linux 2.4.26.
mingdao@paul:~$ su <- su is switch user
Password: <- I entered the password for root, so it su'ed to root
root@paul:/home/mingdao# exit
exit <- it exited to the user who logged in, mingdao
mingdao@paul:~$ su james <- switched users to james
Password:
james@paul:/home/mingdao$ exit
exit <- exited james to mingdao, who started the ssh session
mingdao@paul:~$ su root
Password: <- su (switch user) to root
root@paul:/home/mingdao# exit
exit <- exit from root to mingdao
mingdao@paul:~$ su root
Password:
root@paul:/home/mingdao# su james <- switched users to james
james@paul:/home/mingdao$ su mingdao
Password: <- switched users to mingdao by entering his password
mingdao@paul:~$ exit
exit <- exited james (where root su'ed to) to mingdao
james@paul:/home/mingdao$ exit
exit <- exited mingdao to root, who logged in last
root@paul:/home/mingdao# exit
exit <- exited root to mingdao, who originally started the ssh session
mingdao@paul:~$ exit <- exited the ssh session, because mingdao started it
logout
Connection to 192.168.1.11 closed.
mingdao@james:~$
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.