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

learn more… | top users | synonyms

23
votes
3answers
51k views

How can I allow one user to su to another without allowing root access?

I'd like to allow certain users to su to another user account without having to know that account's password, but not allow access to any other user account (i.e. root). For instance, I'd like to ...
3
votes
1answer
32 views

SE Linux - can't change SELinux booleans with sudo

I think this is the correct place to put this, rather than in StackOverflow Either way, we have a CentOS 6.6 server. SElinux isn't allowing us to enable httpd_can_sendmail I've tried this.... sudo ...
1
vote
3answers
545 views

sudo sourcing user's .bashrc without impacting /root/.bashrc or /etc/bashrc

Is there any way to make sudo use the user's .bashrc file instead of the root one? I would like to use my own .bashrc while using sudo instead of the one of root or /etc/bashrc (I would have to force ...
0
votes
1answer
29 views

Sudo-io log output shows garbled text

We have set up in our servers sudoers config the following configuration in order to log the console output for auditoring purposes Defaults:%administrators log_output Defaults logfile=/var/log/sudo ...
0
votes
1answer
119 views

Cant remove linux ln hard links

I am using CentOS 6.3 and am logged in a root. When I create a hard link by doing this: ln /root.hdd /somedir/root.hdd That works fine, the inode shows the same between the two files and ...
0
votes
0answers
24 views

shared object file open error with “sudo command” but NOT with “sudo bash” then same command? [migrated]

I'm having a hard time getting my brain wrapped around how LD_LIBRARY_PATH is handled differently for the following three cases: run as a regular user run via "sudo command" run via "sudo bash" ...
18
votes
14answers
22k views

Why does sudo command take long to execute?

I've been picking up Linux (Fedora 10, then 11) over the past few months (and enjoying it immensely-- it's like discovering computers all over again, so many things to learn). I've added my user to ...
2
votes
3answers
5k views

nagios nrpe unable to read output

I'm trying to use check_nrpe to check on a remote server, but it's not working and I can't figure out what am I missing... # /usr/lib/nagios/plugins/check_nrpe -H XXX -c check_load -a 6,5,4 8,7,6 ...
0
votes
1answer
39 views

Monitor root commands issued by users

I tried to log the commands issued by the system administrators in our organization and its output using sudo plus the log_output directive as follows on the visudo file Defaults env_reset ...
43
votes
8answers
4k views

Is it OK to set up passwordless `sudo` on a cloud server?

Sorry if the question is vague but I don't know a better way to ask and I didn't see the caveats/tradeoffs of the approach discussed here. I love the idea of accessing servers via keys, so that I ...
0
votes
3answers
61 views

How to grant user modify only specific protected file by sudo

I need to grant user modify some files by sudo that have only read-only access. For example, I want to grant user 'hosteditor' modify '/etc/hosts' file. I added to sudoers follow line: hosteditor ...
2
votes
5answers
10k views

ssh to multiple hosts and sudo multiple commands

I need to loop through and ssh to multiple hosts and run a series of commands on each. something like: for i in $(jot -w '%02.0f' 14 1) >do ssh user@host$i sudo -i "command1; command2; command3" ...
17
votes
6answers
8k views

Log all commands run by admins on production servers

It is company policy for admins to login to the servers via a personal username, and then run sudo -i to become root. Upon running sudo -i, sudo will create an environmental variable called ...
23
votes
5answers
1k views

What are the actual benefits of assigning sudo privileges to a user instead of using root?

I am fairly new to server administration, and I have seen a lot of sites recommending to assign sudo privileges to a user created by the root user and giving the root user an insanely long password ...
2
votes
1answer
33 views

Regular and repetitive sudo alerts from several Linux hosts

I've got several hosts running CentOS 5.11 on the LAN. Lately we've been getting fairly regular sudo alerts (via email) from attempted sudo commands by non-authorized users. Been Googling in case the ...
3
votes
2answers
1k views

Why doesn't sudo know where psql is?

The problem The CKAN installation documentation shows you how to list the installed PostgreSQL databases. The command looks like this: sudo -u postgres psql -l When I try that in my shell, I get ...
0
votes
2answers
283 views

Capistrano 2 update_code task not using sudo

I'm using Capistrano 2(.15.4) to deploy rails applications (i know, trying to get to 3 but not quite there yet). We have a new server environment being set up, with IT preferring access through our ...
0
votes
2answers
77 views

Allow sudo user to install packages from CentOS GUI

I've installed GUI on CentOS 6.5 with yum groupinstall basic-desktop desktop-platform x11 fonts but now when I attempt to use GUI Package Manager (Add/Remove software) to install packages, it asks ...
-1
votes
1answer
73 views

How to pass the SSH_AUTH_SOCK through sudo (Permission denied (publickey).) [duplicate]

I have a Ubuntu server with the users: ubuntu and user I connect to each of the users using ssh -A (to pass my local machine keys to SSH). From any of the users I can connect to the SSH server of ...
-1
votes
1answer
154 views

How to make sudo -u not require password [closed]

I'm using ansible with vagrant and ansible is trying to sudo as postgres user to run some postgres commands. Ansible running as vagrant user seems to run something like sudo -u postgres psql This ...
2
votes
2answers
441 views

Has the use of sudo changed in Debian 7?

I will try to explain my situation first. I am currently running 6 virtualized Debian servers on a ESXi host machine. The virtual servers where installed with a Debian Linux 6 (Lenny). Recently I ...
2
votes
0answers
42 views

Slow authentication on Fedora VM due to /var/run/dbus/system_bus_socket connect timeout

I have this Fedora VM that for some reason after a while always starts having very slow "sudo" authentication (or an authentication in general, like GUI apps asking for credentials). It's will work ...
4
votes
6answers
454 views

Prevent sudo, apt-get, etc. from swallowing pasted input to STDIN?

I often write up wiki instructions to install various server packages on Ubuntu (11.10 Oneiric at the moment). They always involve things like: sudo apt-get install -y postfix sudo cp ...
1
vote
1answer
46 views

Why does printf work differently with sudo?

I have a simple script to convert a text file with colour escape sequences to the actual characters. It works if I run it directly, but not with sudo. To set up the scripts: test.txt ...
0
votes
1answer
247 views

Setting up Sudo in CentOS-7

In CentOS 6.5, i would do the following to setup sudo for users - useradd -G wheel -c "John Smith" jsmith visudo uncomment this line - %wheel ALL=(ALL) ALL usermod -G wheel -a jsmith restart ...
0
votes
0answers
67 views

sudo and ulimit - behaviour change?

I've noticed a behaviour change between sudo in Ubuntu Saucy 13.10, which has sudo 1.8.6p3, and Ubuntu Trusty 14.04.1 LTS, which has sudo 1.8.9p5, but I don't understand precisely what it is, or what ...
5
votes
1answer
485 views

Lost passwordless sudo and no root access

I have a running AWS vm. The only access I have is using the ssh key (.pem file) to log in as ec2-user which is an unprivileged user. From there, I could user the sudo command without a password. ...
1
vote
2answers
74 views

Recover sudo password of server over ssh

I am working on an ubuntu 12.04 server and i was not provided a sudo password. Now i need to recover it. I found out that we need to reboot into recovery mode to do so but we don't know how to get ...
0
votes
1answer
210 views

Centos : su: incorrect password after bash update

A few days ago I've updated the bash to patch it agains Shellshock and since then I cannot su - root from my regular 'wheelgroupuser' account on Centos 6.5 with WHM. I'm constantly getting su: ...
19
votes
4answers
5k views

How do I sudo over sshfs?

On my local host alpha I have a directory foo that is mapped via sshfs to host bravo as follows: $ sshfs charlie@bravo:/home/charlie ~/foo However, on host bravo there is another user, delta, that ...
0
votes
1answer
76 views

Visudo Gives no Error but asks “What Now?”

I'm trying to add a new sudoers file using sudo visudo -f /etc/sudoers.d/abe . I added the contents: # Allow automatic update of abe matt ALL=(root) NOPASSWD: python /home/matt/token-abe/setup.py ...
0
votes
2answers
189 views

Sudo without password issue

Having a problem with sudo. As the user forge I want to be able to run sudo service php5-fpm reload without having to type a password. I've tried all of the variants below. forge ALL=NOPASSWD: ...
33
votes
8answers
5k views

How can I run arbitrarily complex command using sudo over ssh?

I have a system that I can only log in to under my username (myuser), but I need to run commands as other user (scriptuser). So far, I have come up with the following to run the commands I need: ssh ...
0
votes
1answer
183 views

sudo -u fails with env: -u: No such file or directory

On Ubuntu 12.04, when I do sudo -u <user> ls I get env: -u: No such file or directory This happens for any command and any user for <user>, including myself and root. Any ideas how ...
6
votes
3answers
2k views

Test whether a user has sudo privileges without requiring user input

I have a local shell script that performs a number of tests on a remote host, before delivering the payload; one of these tests being whether the user has sudo privileges, checked simply with sudo -v ...
-2
votes
1answer
67 views

create file with sudo but have ownership as current user [closed]

I am on centos 6.5. I have a limited user. I gave the user some specific rights via sudoers. Lets say its user1. I want user1 to create a file in a directory where he has ownership. Therefore I run ...
0
votes
3answers
122 views

Securely executing system commands as sudo from PHP

Is it possible? I have written a command line tool in PHP for creating new environments for our company. It creates system users, directories, databases, VHosts and restarts apache, amongst other ...
0
votes
1answer
87 views

Sudo keeps asking for password on / mounted over NFS

I have a diskless server booting Ubuntu 14.04 with / taken from NFS. I use nfs-kernel-server. I have some strange behaviour of sudo and locate. sudo keeps asking for passwords despite the Defaults ...
43
votes
6answers
19k views

Sudo as different user and running screen

Found out today that running screen as a different user that I sudo into won't work! i.e. ssh bob@server # ssh into server as bob sudo su "monitor" - screen (fails) I have a script that ...
4
votes
2answers
319 views

Is “sudo su -” considered a bad practice?

Background I know the difference between su -, sudo su -, and sudo <command>: su - - switches user to root, requires the root password sudo su - - switches user to root, requires only the ...
2
votes
2answers
444 views

How to bypass sudo

I am trying to script a non-interactive install of Meteor (JS Framework) and part of the script prompts for sudo . I cant seem to get past it w/ my scripting skills. The install is : curl ...
-2
votes
3answers
132 views

Enable Passwordless Sudo with Arguments

I am trying to enable passwordless sudo for updating yum on a RHEL box. I have the following line in sudo visudo. myuser ALL=(ALL) NOPASSWD: /usr/bin/yum update After doing this under myuser I am ...
-2
votes
1answer
489 views

sudo yum install httpd is throwing errors

Hello this is the command im typing and its returning the error you see, any suggestions please [ec2-user@ip-172-31-41-46 ~]$ sudo yum install httpd Loaded plugins: priorities, update-motd, ...
0
votes
1answer
404 views

SELinux blocking sudo from zabbix_agentd

I have a custom user parameter for Zabbix that calls a hardware RAID CLI tool (arcconf / megacli) and checks if any arrays are degraded. Since these tools are root-only, I have configured sudoers to ...
6
votes
3answers
1k views

User name before sudo

I got a script requiring sudo, but the script must set parameters according to the original user, such as: chown "${USER}:${USER}" dir If I set it under sudo, I just end up with chmod root:root, ...
1
vote
0answers
87 views

RHEL Equivalent of AIX's chuser login=false rlogin=false

On AIX, I can disable login/remote login by setting the attributes listed to false, but I will still be able to su from other users, and sudo as the user. Is there an equivilant in RHEL to the ...
0
votes
2answers
87 views

Disable NOPASSWD sudo access for ubuntu user on an EC2 instance

How can I disable the passwordless sudo access for the default ubuntu user on an EC2 instance? Is it safe to do it?
60
votes
8answers
24k views

ssh-agent forwarding and sudo to another user

If I have a server A into which I can login with my ssh key and I have the ability to "sudo su - otheruser", I lose key forwarding, because the env variables are removed and the socket is only ...
3
votes
1answer
402 views

sudo still ask for password when NOPASSWD is used

I read all sudo posts on serverfault, but I still cannot figure out what I'm doing wrong. Normally I finally find the solution but not this time : I want apache user to be able to execute this ...
2
votes
1answer
2k views

Ansible ssh as user and execute has root (expect like)

I have to administer an important number of hosts where there is only one user able to access from SSH (let's call him foo) and then have to login as root to execute privilegied commands. Foo user ...