Opening programs with root privileges on Linux is sometimes required, due to the nature of security on the platform. The fact is, some operations aren’t possible with a regular user (things like managing files in the Root folder, formatting a hard drive or editing system files come to mind.)

There are several ways to open programs with Root access on Linux. In this guide, we’ll show you how. However, keep in mind: to start programs with the Root account, you’ll need to enable it first. If you’re using a Linux OS with a disabled root account, follow the instructions below to learn how to turn it on.

Enable the Root account

Launch a terminal window by pressing the Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, assuming your system has sudo privileges, use the sudo -s command to log into an elevated session.

sudo -s

Next, type passwd to force a reset of the Root account’s password on the system.

passwd

Set a new password on your Linux PC for the Root account. Keep in mind though, that it needs to be secure. Once the new password is set, the Root account can be accessed once again.

Open programs with Root – Terminal

The fastest and usually most reliable way to launch programs with Root privileges is to log into Root in the terminal, and then execute the name of the program as a command.

su -

Once you’ve gotten root access in the terminal session, you’ll be able to start up a program. So, for example, if you want to access the Gnome file manager with Root access, you’d run the nautilus command in the terminal.

nautilus

So, remember. Log in as Root then start up the app with:

program-name

Most programs can quickly start up with superuser privileges if you are Root. Though, please keep in mind, the terminal window method isn’t 100% reliable. Due to the nature of the command-line on Linux, some apps just flat out won’t run.

There isn’t a way to detect what programs work with this method and what don’t. The best way to determine is by trial and error. Though, if a program refuses to launch as Root in the terminal, it’ll say so in the command-line.

Open programs with Root – Pkexec

On most Linux operating systems, when a program needs to run as Root, a password prompt appears. This prompt instructs the user to enter their account password. Then, apps launch with elevated privileges. Launching programs on the desktop in this way is all made possible thanks to the Pkexec tool.

Launching programs this way isn’t wizardry. It’s quite easy to start just about any application installed on your Linux desktop with this tool.

To use pkexec, press Alt + F2 on the keyboard. This keyboard combo will start up a quick-launch window on your desktop environment.

Once the quick-launch window is open on the desktop, write out the pkexec command, followed by the name of the program you’d like to launch.

For example, to launch the Gparted partition manager as Root, you’d do:

pkexec gparted

Just follow the command-syntax like below, and nearly every program should launch as Root.

pkexec programname

Don’t want to use the quick-launch bar on the Linux desktop? It’s also possible to launch apps as Root through with the pkexec tool in the terminal. Just launch a terminal session by pressing Ctrl + Alt + T or Ctrl + Shift + T. Then, do:

pkexec programname

Open programs with Root – Gksu

Long before the Pkexec tool took its place, there was Gksu. It functions identically to the way Pkexec does, but Linux distribution maintainers decided to ditch it, as it doesn’t work as well. That said, if you don’t like using Pkexec and need a way to launch programs as Root, it still works.

Unfortunately, Gksu isn’t set up on a lot of modern Linux distribution’s software repositories, as it’s not used as much. As of now, Debian 7-9 supports it, OpenSUSE LEAP (42.3 and 15.0) and Tumbleweed support it. Ubuntu 16.04 LTS does as well.

To install it, open up a terminal and enter the commands that correspond with your operating system.

Ubuntu 16.04 LTS

sudo apt install gksu

Debian

sudo apt-get install gksu

OpenSUSE LEAP 15.0

sudo zypper addrepo http://widehat.opensuse.org/opensuse/repositories/GNOME:/Apps/openSUSE_Leap_15.0/ gnome-apps

sudo zypper install gksu

OpenSUSE LEAP 42.3

sudo zypper addrepo http://widehat.opensuse.org/opensuse/repositories/GNOME:/Apps/openSUSE_Leap_42.3/ gnome-apps
sudo zypper install gksu

OpenSUSE Tumbleweed

sudo zypper addrepo http://widehat.opensuse.org/opensuse/repositories/GNOME:/Apps/openSUSE_Factory/ gnome-apps

sudo zypper install gksu

When the Gksu application is set up on your Linux system, it should be ready to use. To start a program as Root, press Alt + F2 on the desktop. A launch bar will appear. In the bar, write gksu followed by the program you’d like to launch. For example, to start up the XFCE4 file manager, you’d do:

gksu thunar

To launch any application with Gksu, follow the command-line syntax below.

gksu programname

You can also launch an app right from the terminal as Root with the same syntax as well.

Read How to open programs with Root access on Linux by Derrik Diener on AddictiveTips - Tech tips to make you smarter



from AddictiveTips https://ift.tt/2NoO2OO
via IFTTT