Sudo: Difference between revisions

From DWIKI
Tony (talk | contribs)
Tony (talk | contribs)
Tag: wikieditor
 
(5 intermediate revisions by the same user not shown)
Line 3: Line 3:
*https://stackoverflow.com/questions/14277116/suppress-log-entry-for-single-sudo-commands
*https://stackoverflow.com/questions/14277116/suppress-log-entry-for-single-sudo-commands
*[https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file How to edit the sudoers file]
*[https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file How to edit the sudoers file]
=HOWTO=
==Edit files owned by root==
sudo -e /etc/hosts
==Run command as other user==
sudo -u someuser some command
==Show sudo activity history==
journalctl _COMM=sudo


= FAQ =
= FAQ =
==NOPASSWD not working==
Maybe user is in a group that has no NOPASSWD


== sudo: sorry, you must have a tty to run sudo ==
== sudo: sorry, you must have a tty to run sudo ==
Line 23: Line 36:
== no password ==
== no password ==
  %sudo  ALL=(ALL) NOPASSWD: ALL
  %sudo  ALL=(ALL) NOPASSWD: ALL
== sudo: unable to resolve host ==
Fix /etc/hosts
==sudo: a terminal is required to read the password==
Double check your sudoers line

Latest revision as of 09:41, 8 May 2026

Links

HOWTO

Edit files owned by root

sudo -e /etc/hosts

Run command as other user

sudo -u someuser some command


Show sudo activity history

journalctl _COMM=sudo

FAQ

NOPASSWD not working

Maybe user is in a group that has no NOPASSWD

sudo: sorry, you must have a tty to run sudo

Defaults:zabbix !requiretty
      

sudo: foo : user NOT in sudoers

maybe you tried including a file like /etc/sudoers.d/foo.conf ?


enable file after adding to /etc/sudoers.d/

visudo -v /etc/sudoers.d/myfile

no password

%sudo  ALL=(ALL) NOPASSWD: ALL

sudo: unable to resolve host

Fix /etc/hosts


sudo: a terminal is required to read the password

Double check your sudoers line