Find the answer to your Linux question:
Results 1 to 3 of 3
This kind of annoys me. When I'm working on my machine and I need to switch to the root user for a while, I type su and then enter the ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    1

    Unhappy su creates multiple processes of su and bash

    This kind of annoys me.
    When I'm working on my machine and I need to switch to the root user for a while, I type su and then enter the password.
    When I want to get back to my normal user, I type su simon and I'm back again.
    What annoys me is that I don't get logged out from the previous user, but when I su back to root I'm in another instance of bash!
    Eventually, my process list looks like this:

    debian:~# ps
    PID TTY TIME CMD
    2900 pts/0 00:00:00 su
    2901 pts/0 00:00:00 bash
    2931 pts/0 00:00:00 su
    2932 pts/0 00:00:00 bash
    2948 pts/0 00:00:00 su
    2950 pts/0 00:00:00 bash
    2948 pts/0 00:00:00 su
    2950 pts/0 00:00:00 bash
    2948 pts/0 00:00:00 su
    2950 pts/0 00:00:00 bash
    2951 pts/0 00:00:00 ps
    When I type exit, I step through every single one of those active bashes before I'm completely logged out of the system.
    This seem like a horrible waste of resources. How do I switch user and close the previous user at the same time without the computer dropping my SSH connection because I logged out?
    I've tried su -l with no avail.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    When I'm working on my machine and I need to switch to the root user for a while, I type su and then enter the password.
    When I want to get back to my normal user, I type su simon and I'm back again.


    You went Simon > root > Simon. Each su invokes a new session. It's the same as being in a web browser. You can go to Google > Yahoo > Google. OR you can go to Google > Yahoo > (BACK BUTTON) Google.

    If you want Simon > root > (EXIT ROOT) > Simon then use exit to close root's session.

    > su root (now root)
    > exit (now simon)

  3. #3
    Linux Newbie lugoteehalt's Avatar
    Join Date
    Jan 2004
    Posts
    231
    When you want to stop being root hitting ctrl+d, end of file, is easier than typing exit.
    All power is violence; all power is evil.
    Money As Debt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •