Home » Questions » Computers [ Ask a new question ]

Linux username@server disappears after login as root

Linux username@server disappears after login as root

On my linux server I signed in as the root user to access some files: su root... After checking the files I went to sign back in as my main user su username. In my terminal window it now says server ~: instead of username@server ~: to the left of the command line. Is there any way I can get this back to normal?

Asked by: Guest | Views: 213
Total answers/comments: 2
Guest [Entry]

"su switches users by spawning a new (sub)shell. So when you logged in, you started a shell. With the first su to root, you started a subshell as root. The next su to your user started yet another subshell -- note that at this moment you have three shells running. So instead of su-ing to your user from the rootshell, exit-ing back to your login shell will solve your problems.

If you have pstree installed, pstree -h will show you a graphical representation of what's going on."
Guest [Entry]

"su by itself does not create a new session of the shell. that's why it doesn't set up the shell as it normally does. however,

su -

will start a new login session"