Questions tagged [sudoers]

163 questions
143
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,037
  • 5
  • 31
  • 28
82
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
  • 955
  • 1
  • 6
  • 8
41
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…
Andy Shinn
  • 533
  • 1
  • 4
  • 9
27
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…
21
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
  • 323
  • 1
  • 2
  • 6
19
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…
Sri Kadimisetty
  • 349
  • 1
  • 2
  • 9
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,041
  • 6
  • 30
  • 46
16
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,337
  • 5
  • 18
  • 29
13
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:…
AlwaysALearner
  • 393
  • 4
  • 6
  • 12
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…
Roy Truelove
  • 332
  • 1
  • 3
  • 8
10
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,405
  • 2
  • 26
  • 38
8
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
7
votes
2 answers

'user is not in the sudoers file' but actually is

I have already read a lot of posts about enabling sudo-access for a specific user but those couldn't help me so far. The situation is: I'm running Debian Testing. On the system there are only two accounts: 'root' and a user account 'benny'. The…
7
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
  • 247
  • 1
  • 3
  • 9
1
2 3
10 11