Logon On As Different User In Linux In Same Terminal Window [Quick Tip]
By on April 3rd, 2008

I have been using Linux for quite some time and have been using flavors such as Red Hat, Fedora, Solaris and Ubuntu so thought it as a good option to give useful tips to my readers who are trying to learn Linux or have been using it for some time.

The first tip I wanted to talk was about quickly changing users on Linux without having to logout while you are using bash or any other command line interface.

Once you have logged into a terminal the owner of the terminal is the user you logged on with and if you wish to logon as another user there is no need to actually open another terminal window.

The su command

The su command allows users to directly login as root, but it can be used for other purposes too part of which we will talk in this post.

Changing users quickly in same terminal

Using the su command we can quickly change users in a bash terminal for that type the following command;

su – username

When you issue this command it says that change my user to the username I have provided, once you have issued this command you will be prompted for a password. The password you have to enter is not for the root user but for the username you have provided.

Once you are successfully authenticated your bash environment will change to the username you logged on with.

Want more such tips about topics I don’t cover, you can tip me about things you want me to write about.

Tags:
Author: Keith Dsouza Google Profile for Keith Dsouza
I am the editor-in-chief and owner of Techie Buzz. I love coding and have contributed to several open source projects in the past. You can know more about me and my projects by visiting my Personal Website. I am also a social networking enthusiast and can be found active on twitter, you can follow Keith on twitter @keithdsouza. You can click on my name to visit my Google+ profile.

Keith Dsouza has written and can be contacted at keith@techie-buzz.com.
  • http://mp3crown.com Magie

    Nice tips for a new learner like me…Thanks!

  • http://www.femaleshopper.co.uk Bargain Shopping

    Thanks for the tip, that’s something I didn’t know and have taken note of.

  • ZazA

    Thank you for your time. I would like to work with redhead and i don`t know nothing about linux.
    For my school exame i have to pass Suse linux v10.2.
    I would like to ask you if you got time to help me out.

    Greetings,

    ZazA

  • SeLinux

    thanks for this helpful tip! I’m new to Linux and spent quite time to find this answer on the web!

  • Nadir H

    Hi,
    We are using redhat and would like to suggest that instead of the above su -l username worked there. where l as in larry/

 
Copyright 2006-2012 Techie Buzz. All Rights Reserved. Our content may not be reproduced on other websites. Content Delivery by MaxCDN