Digital Communication


Digital Communication

Linux sudo: use another user’s functions


The Linux sudo command gives users temporary access rights to sensitive areas of the system. These access rights are protected using a password. Likewise, they only remain valid for a limited period.

Linux sudo command: what is it?

The Linux sudo command is one of the most relevant Linux commands to install a program or modify the configuration of your system. It is built into most Linux distributions, like Debian or Ubuntu, and should not be removed under any circumstances. The name of the sudo command is short for “superuser do” and allows authorized users toexecute commands on behalf of another user within a system. It can therefore be the root user, even if the sudo command does not allow the transfer of full rights.

How does the sudo command work?

The Linux sudo command is primarily used to protect the system preventing installation of rogue packages or other unwanted processes. To use it, just place it after another command. For example, you can use this command to modify the configuration of your system even if you do not have root access rights, or to call certain programs that require root access rights. A password is required to use this command; usually it does not match the root password. By default, it remains valid for 15 minutes. The file /etc/sudoers contains a list of users authorized to use the sudo command.

What does the sudo command syntax look like?

The Linux sudo command always comes after another command. The corresponding code may therefore look like the following:

The user can thus execute the command in question, even if he does not have root rights.

What are the sudo command options?

The Linux sudo command offers several options. The most important of them are presented below:

  • -h: it displays the syntax, as well as all the options available for the sudo command.
  • -k: it allows to revoke the privileges of the Linux sudo command in use.
  • -L : it opens a list of all your privileges.
  • -V: it displays the version of the sudo application in use.
  • -v: it restarts the authorization period for the sudo command. This period defaults to 15 minutes, after which the password must be entered again.

Linux sudo command: examples

Finally, let us show you some usage examples for this command, so you can better understand how it works:

$ sudo apt-get update


In this example, if you do not use the sudo command, your system may return an error message. You will then be prompted to enter your password. If your input is correct, the command will then be executed. Warning: this password must be entered “blindly”, which means that you will not be able to display your entry.

$ sudo -u [Autre_Nom d‘utilisateur] ls ./Exemple


This command references the directory /Example using another user’s name.

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact