Questions tagged [sudo]

sudo is a tool which allows users to run commands as another user (usually the root user)

sudo allows users to run commands as another user. It is typically used to allow trusted users to run commands as root, without giving them root access, or to allow a user to run commands as another user. Both of these uses must be allowed by the root user.

899 questions
80
votes
2 answers

sudoers: how to disable requiretty per user

I don't want to comment out the line in /etc/sudoers: Defaults requiretty Instead, I only want a certain user not to require a tty. How can this be done?
user27451
  • 1,171
  • 2
  • 11
  • 14
10
votes
2 answers

Is it possible to use sudo with !requiretty for a specific command

I am trying to allow a specific command to be run under sudo without a tty. I found that I can disable requiretty for a group : Defaults:%support !requiretty But I dont know how to do it for a single command. Is it possible at all ?
Guillaume
  • 1,063
8
votes
5 answers

Update multiple sudoers file

We have multiple Linux servers that authenticate to an Active Directory Domain. For a group in AD, I want to add a list of commands that are allowed to run as root using sudo. I can obviously ssh-in to each computer and update sudoers file -but that…
rchhe
  • 676
6
votes
2 answers

Using sudo inside a script

Is it considered good or bad practice to use the sudo command inside a shell script? One advantage is that if the user runs the script as non-root, she or he will be asked for password on demand rather than the script failing. On the other hand, if…
5
votes
2 answers

Is there a way to allow command in sudo based on the current working directory?

I want sudo to allow me to run a command when my current working directory is, for example, /tmp. Example usage is removing files from /tmp directory, so I am in /tmp ($PWD of shell == /tmp), then I can run, rm -v someuseless.bin (someuseless.bin of…
user141301
5
votes
5 answers

HOW TO: disable sudoer from editing /etc/sudoers file?

How can I prevent a sudoer from editing the /etc/sudoer file?
5
votes
2 answers

In Ubuntu can root overwrite any file?

I am on Ubuntu 10.04.02. I thought that when using sudo that would execute commands as root. But here as root I cannot write to my own file. Is this correct? david@ubuntu:/var/www/system/paydaydebt/log$ ls -l total 16 -rw-r--r-- 1 root root 32…
davidjhp
  • 700
4
votes
2 answers

How to change back /etc/sudoers file right to 0440?

I changed /etc/sudoers file rights to 0740, because I wanted to edit it as root. I could edit it. What is happening now is that I can't change it back to 0440. I can't sudo anymore. I always get this error message : sudo: /etc/sudoers is mode 0740,…
Spredzy
  • 963
4
votes
0 answers

what is the risk of allowing the sudo option closefrom_override?

I have an awk script that uses stdout to write to a file and /dev/fd/3 to write a status message about what happened during the run. When I invoke awk with sudo, it fails because sudo closes all the file descriptors above 2. I know that I can…
bobjunga
  • 141
3
votes
3 answers

How to sudo as another user, without specifying the username

So I'm currently trying to create a sudoers file, but I ran into something I can't figure out. The end result I'm looking for is that I want users to be able to do something like: sudo /usr/sbin/script.pl But, instead of running as root, I'd like…
Pedro
  • 31
3
votes
2 answers

sudoers cmnd_alias to view log files

I have this line in my /etc/sudoers file: Cmnd_Alias MSGES = /usr/bin/tail -* /var/log/*, /bin/more * /var/log/*, /bin/cat * /var/log/*, /bin/grep * /var/log/* And I have this: level2 ALL = NOPASSWD: MSGES The object is to allow the level2 user…
Ed Manet
  • 532
3
votes
1 answer

what is sudo command used for

Can anybody explain or point the use of sudo command, perhaps the os give su command. Does it not solve the problem of login as superuser. Let me rephrase it 1) what is the advantages of sudo over su ? 2) what are notable features of sudo ?
indianwebdevil
  • 220
  • 1
  • 6
2
votes
1 answer

Does 'sudo' extend its timeout every time you use it?

If I use sudo, and type my password in, I can continue to use sudo without my password for 15 minutes. I know (per man sudoers) that I can edit the timeout by setting the timestamp_timeout value in /etc/sudoers. That's not my question. My question…
2
votes
2 answers

Can sudo affect the entire server or just the users account?

I recently spent quite a lot on a vps for my business and have begun setting up ssh and a cpanel account for each of my sites. I started to install composer on an account but need root privileges. My question is if you are using sudo as a privileged…
JPB
  • 145
2
votes
1 answer

Sudo inside for loop?

In a standard bash shell, I was trying to cat a file from several users' home directories which are on a root-squashed NFS mount so I couldn't just read them as root : sudo -u userA cat ~userA/blah .. works fine. However trying this in a loop…
Gaspode
  • 85
1
2 3 4