sudo is probably one of the most used Linux commands.

It allows you to gain administrative or elevated privileges on a Linux machine.

But did you know there are alternatives to the sudo command on Linux?

a man with two monitors in front of him

Why Execute Linux Commands as Another User?

sudo is a very important command because it allows you to execute commands with superuser privileges.

By default, non-root users normally have limited access to resources and files on Linux.

doas command config on linux systems

Unfortunately, this makes it very bloated.

The pkexec tool is already installed on Ubuntu and other major Linux distros.

In the case that its not installed, heres how to install it.

If you do not have the necessary permissions you’ll receive an error.

2. doas

The doas command has its origins in the OpenBSD operating system.

It allows you to execute a command with the privileges of a specified user or role.

If it’s not,heres how you’ve got the option to install doas on Linux.

The configuration file is located at/etc/doas.conf.

It’s similar to the–userflag used with the pkexec command.

It allows you to execute commands as users other than the currently logged-in user.

To switch back to the original user, simply run theexitcommand.

It is similar to the sudo command, which is commonly used for the same purpose.

The dzdo command is mostly available on Oracle Linux.

it’s possible for you to use the-uflag to specify the user whose privileges you want to use.

Depending on your needs, you might use any sudo alternatives in your workflow.