How Do I Use Sudo in Linux?

How Do I Use Sudo in Linux?
Contents

How do I Sudo in Linux?

Debian and Ubuntu

  1. Use the visudo command to edit the configuration file: sudo visudo.
  2. This will open /etc/sudoers for editing. To add a user and grant full sudo privileges, add the following line: [username] ALL=(ALL:ALL) ALL.
  3. Save and exit the file.

18 авг. 2020 г.

How do I run a command as Sudo?

To use sudo to run a command as another user, we need to use the -u (user) option. Here, we’re going run the whoami command as the user mary . If you use the sudo command without the -u option, you’ll run the command as root . And of course, because you’re using sudo you’ll be prompted for your password.

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.