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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.