Shortcut to root command line access while logged in as un-privileged user

Let’s say you’re logged into your Ubuntu machine as an unprivileged user, meaning that you don’t have permission to use the sudo command on the command line. As such, you cannot update the system, install a program, or perform other tasks in the terminal that require the sudo command without logging out and then back in as the administrative user, or using the User Switcher. This annoys me. So, how do I execute commands in the terminal that require the sudo command while still logged in as the unprivileged user??

First off, you’ll need ssh. To make sure you have this installed, login to your administrative account (a step that will soon become unnecessary), open a terminal, and enter…

sudo apt-get install openssh-server openssh-client

After this install is finished you can logout, and back in as the unprivileged user.Now you can open a terminal and enter…

ssh [administrative username]@127.0.0.1

You’ll be asked for your password, this is the administrative account’s password, enter it and press enter. Now, you’ll have a command line prompt for the administrative user, as if you had logged in as that user and opened a terminal. You can now update the system, or make whatever change you need to make that requires you to enter your sudo password.

A nice time saving trick.

  • Share/Bookmark

3 comments to Shortcut to root command line access while logged in as un-privileged user

  • for whatever reason it didn’t work for me. this is what I see ssh: could not resolve hostname administrative: Name or service not known.

    here’s the command I use ssh [administratove mcpl]@127.0.0.1

  • Eli

    Hi Felix, if your username is mcpl, then the command should look like this…

    ssh mcpl@127.0.0.1

    Please note that you can replace 127.0.0.1 with your computer’s name.

  • felix

    cool, i just confuse with administrative in-front of it.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>