Find the answer to your Linux question:
Results 1 to 4 of 4
Like Tree3Likes
  • 1 Post By jayd512
  • 2 Post By atreyu
hey folks, i would like to know how to switch between users when on the terminal. for example i can switch to root using "su" then type "password". but here ...
  1. #1
    Just Joined! jonniemuk's Avatar
    Join Date
    Jul 2009
    Location
    kampala uganda
    Posts
    30

    Cool switching users in the terminal

    hey folks,
    i would like to know how to switch between users when on the terminal. for example i can switch to root using "su" then type "password". but here i want to switch to other accounts not root and switching from root without using exit.

  2. #2
    Trusted Penguin jayd512's Avatar
    Join Date
    Feb 2008
    Location
    Kentucky
    Posts
    4,071
    Let's assume that there are two users on the computer... Jack and Jill.
    User Jack wants to su to Jill:
    Code:
    su Jill
    *enter Jills password

    Done.

    Provided you have the user password, you can do this for any user.

    Code:
    su <username>
    jonniemuk likes this.
    Jay

    New users, read this first.
    New Member FAQ
    Registered Linux User #463940
    I do not respond to Private Messages asking for Linux help. Please, keep it on the public boards.

  3. #3
    Linux Guru
    Join Date
    May 2011
    Posts
    1,838
    To add, if you use a '-' (or '-l', or '--login') when you su, you will make it a login shell, e.g.:

    Code:
    su -  joeblow
    Most obviously, this will cd you into the $HOME directory of the new user. In the case of suing to root, it has the important distinction of changing to root's PATH, which includes /sbin, /usr/sbin, and the like.

    I use 'su -' so much that I literally can't type "su <USERNAME>" without automatically putting that dash there in between. I have to backspace it outa there...old habits die hard.
    Last edited by atreyu; 11-29-2011 at 04:51 AM. Reason: friggin typo
    jonniemuk and jonniemuk like this.

  4. #4
    Just Joined! jonniemuk's Avatar
    Join Date
    Jul 2009
    Location
    kampala uganda
    Posts
    30
    Thanks *,
    staff worked.

Posting Permissions

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