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

learn more… | top users | synonyms

2
votes
2answers
337 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 ...
0
votes
2answers
478 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 ...
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
0answers
3 views

Why does “$ sudo echo 'yo' ” works? [migrated]

I understand that sudo cd /directory will return: sudo: cd: command not found because cd is a shell builtin and not a binary. But then, why does sudo echo 'this is a test' works fine? What ...
1
vote
0answers
18 views

OpenWrt: Cannot install package sudo [migrated]

I have installed the latest OpenWrt Chaos Calmer r42871 on my TP-LINK WR-842ND router. And everything's good except the problem: root@router:~# opkg install sudo Unknown package 'sudo'. ...
1
vote
0answers
8 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
438 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
34 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
0answers
23 views

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

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 ...
0
votes
1answer
51 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
22 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
465 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
61 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
73 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
4k 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
0answers
35 views

How can I sudo su and change directory just after? [migrated]

I would like to create an alias that does something like this: alias userYYY='sudo su userYYY; cd /a/path/that/only/userYYY/has/access' So then from my command line, I am logged in with a sudoer ...
0
votes
1answer
26 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
91 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: ...
0
votes
1answer
110 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 ...
33
votes
8answers
3k 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
161 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
42 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 ...
16
votes
13answers
21k 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 ...
0
votes
3answers
71 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 ...
23
votes
4answers
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 ...
0
votes
1answer
61 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 ...
41
votes
6answers
18k 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
173 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 ...
1
vote
2answers
353 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
97 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
381 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
201 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
58 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
59 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?
58
votes
8answers
22k 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 ...
2
votes
1answer
228 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
761 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 ...
0
votes
0answers
77 views

Edit a remote file in Vim with sudo when ssh root login is disabled

I am trying to determine a way to edit remote files in Vim that require sudo, but still use my local vim config and plugins. Currently I can open vim and :e scp://me@server//some/root/file and make ...
1
vote
3answers
2k views

Can't su to user other than root on CentOS

I'm able to SSH to my server (CentOS 5.9) using an admin account with sudo privileges: $ ssh admin@myserver Last login: Wed Feb 27 19:23:11 2013 from [IP ADDRESS] [admin@myserver ~]$ Then I can su ...
13
votes
3answers
499 views

Which method to use for granting sudo

What is the difference between adding a user to /etc/sudoers and usermod -a -G sudo? Which method should be used for granting sudo?
7
votes
1answer
232 views

Linux/Unix - /etc/sudoers - host definition

can anybody tell me in which case the sudo host definition is useful? I mean this part of a line in the sudoers file: bob host1 = NOPASSWD: reboot In which environment (except sudo via LDAP) do I ...
0
votes
0answers
58 views

Allow sudo without su [duplicate]

1) Yes, I know this is not air-tight security 2) I trust my admins, I'm just looking for a little more accountability on some key systems 3) Yes, I know they can bypass this if they try. That's ok. ...
0
votes
1answer
46 views

Management of system directory in linux using git

I'm using puppet to manage my linux systems. I have to use /etc/puppet directory to keep manifest files instead of user home directory, and I want to manage them by git. But because /etc/puppet's ...
3
votes
0answers
123 views

Kerberos, .k5login and sudo

Background: I am using a Debian 7 system which I have integrated with an LDAP+Kerberos system using libnss-ldap, libpam-krb5 and nscd. I have modified sudoers to permit an LDAP group the right to sudo ...
1
vote
1answer
61 views

mkdir is not working with sudo and shell option

One of the application trying to create directory failing with the below error on Linux machine: $ /usr/bin/sudo -su oracle /bin/sh -c '/bin/mkdir -p /u01/app/oracle/test12' /bin/mkdir: missing ...
2
votes
2answers
66 views

Configuring sudo to not prompt for password on non-allowed commands

There is plenty of information on how to make sudo not prompt for passwords (NOPASSWD). Let's say I have user alice, and this line in my sudoers: alice ALL=(root) NOPASSWD: /bin/myadmintool This ...
1
vote
3answers
84 views

What's the best way to mitigate NFS and sudo?

Quick background: We have 40 workstations running Linux. NFS is used extensively for bulk data storage and home directories. This allows users to roam freely will relatively transparent file ...
1
vote
4answers
408 views

Fedora, ssh and sudo

I have to run a script remotely on several Fedora machines through ssh. Since the script requires root priviliges, I do: $ ssh me@remost_host "sudo touch test_sudo" #just a simple example sudo: no ...