Questions tagged [sudoers]

177 questions
151
votes
12 answers

How to check if I have sudo access?

I recently got into trouble because of this. $sudo vim /etc/motd [sudo] password for bruce: bruce is not in the sudoers file. This incident will be reported. Is there a way to check if I have sudo access or not?
Bruce
  • 3,237
96
votes
5 answers

Why does the system have /etc/sudoers.d? How should I edit it?

Last time, I asked about the risk of these (in /etc/sudoers): user_name ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd.conf %group_name ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd.conf While I was thinking about this problem, I found…
aob
  • 1,095
45
votes
2 answers

How to allow user to preserve environment with sudo?

I'm running into the following error trying to allow some environment variables to pass through to the new environment when running sudo: sudo: sorry, you are not allowed to preserve the environment Some information that may be helpful to…
30
votes
3 answers

sudo command trying to search for hostname

Recently, I have changed the sudoers file and the hostname through /etc/hostname. After changing this files, my sudo command is taking a lot of time. Also, it says sudo unable to resolve host kaagini(hostname of my machine). Why does sudo have to…
23
votes
4 answers

How can I properly set sudo/visudo's editor?

I am using Ubuntu 10.04 Server and trying to set up sudoers to respect a user's EDITOR choice (within limits) In my sudoers I have: Defaults editor=/usr/bin/nano:/usr/bin/vim Defaults env_reset And in the user .bashrc: export…
Mark C
  • 343
22
votes
1 answer

What do the "ALL"s in the line " %admin ALL=(ALL) ALL " in Ubuntu's /etc/sudoers file stand for?

What does each ALL mean? I understand that the whole line indicates that the admin group members get admininstartive privileges, but would like to know more info about the position of the ALLS and if they each refer to a different set of permissions…
19
votes
1 answer

What are the percentage signs for in the sudoers file?

In my sudoers file, there are lines that begin with #, lines that begin with % and lines that begin with neither. The # is definitely being used to comment out lines, but what does the % do? Is it a comment marker too?
Rich
  • 2,241
18
votes
1 answer

Why there is no sudoers file: "/etc/sudoers: No such file or directory"?

I am trying to add a new admin user, but: # adduser username admin adduser: The user `username' does not exist. # man sudoers No manual entry for sudoers # less /etc/sudoers /etc/sudoers: No such file or directory The system is Debian 7…
static
  • 1,427
  • 5
  • 20
  • 31
14
votes
2 answers

sorry, you must have a tty to run sudo

I had already asked this question in Stack Overflow, but I've been asked to post it here. So doing the same. I ran this command using my java program- sudo -u -S pwd I got this output- command=sudo -u -S pwd exitCode=1 sudo:…
11
votes
3 answers

localhost in sudoers

There is no chance of an internal attack, so I would like to give sudo privileges to users at the local computer using sudoers. I tried these lines separately: %admin localhost=(ALL) NOPASSWD: ALL %admin 127.0.0.1=(ALL) NOPASSWD: ALL But sudoers…
Zaz
  • 2,716
10
votes
8 answers

Add a sudoer non-interactively from command line

(On Centos through Docker) I know that I can add a sudoer using visudo. Is there a way to add a user to the sudoer list straight from the command line, so I don't have to do it interactively? I'm asking because I'm trying to provision my Docker…
9
votes
2 answers

Perrmission to run specific command by sudo as www-data users without password

I have a webserver that also plays internet radio. As www-data user I want to run some commands, for example I've made this in /etc/sudoers file: www-data ALL=(ALL) NOPASSWD: /usr/bin/amixer And form PHP I can manipulate volume without using…
Peter
8
votes
4 answers

Lost sudo/su on Amazon EC2 instance

I have an Amazon EC2 instance. I can login just fine, but neither "su" nor "sudo" work now (they worked fine previously): "su" requests a password, but I login using ssh keys, and I don't think the root user even has a password. "sudo…
user59328
8
votes
2 answers

Can someone explain what is ` ALL=(ALL) NOPASSWD:ALL` does in sudoers file?

I know that that line above allows to run sudo command without having to type in the password. But what does the syntax actually mean? If you can link to an article then that would be fine too. Thanks
8
votes
2 answers

Sudoers NOPASSWD for single executable but allowing others

Operating System: Arch Linux Linux version: 4.16.11 Sudo version: 1.8.23 What I need: be able to execute any executable with a sudo with a password prompt be able to execute one executable, /home/username/script.sh, without a password prompt. When…
Yaroslav Mytkalyk
  • 257
  • 1
  • 3
  • 9
1
2 3
11 12