sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

0
votes
1answer
13 views

dhcpd restart command asks for password from command line but not from a script?

I have a script that runs and will ssh into another server to restart its dhcpd. In the script, the command literally is: sudo ssh -n $SERVER /sbin/service dhcpd restart This works fine when the ...
4
votes
1answer
77 views

Is it safe for my ssh user to be given passwordless sudo for `apt-get update` and `apt-get upgrade`?

I have an SSH standard user account on my personal server, and it has sudo access (via its password). I ssh in using a public key, so I don't have to type in the account password to log in. Is it ...
0
votes
4answers
56 views

sudo for command with specific options

Is it possible to configure sudo to get root privilege to a user for running a program with some special switches? for example, how can I configure it for user admin to run netstat command as the root ...
1
vote
1answer
37 views

Why is sudo slow when I mistype my password? [duplicate]

If I'm asked for the sudo password, after typing it in correctly, the terminal moves on almost instantaneously. However, if I mistype my password, it takes a few seconds before working it out and ...
2
votes
1answer
49 views

Why sudo env is not showing all the environment variables?

I have a variable set in a script file in /etc/profile.d/somescript.sh I have modified the /etc/sudoers and added "ansible" user to the sudoers file like this: Defaults !env_reset ansible ...
6
votes
1answer
41 views

How can I make `sudo crontab -e` use my `sudoedit` environment?

I've started using sudoedit <file> instead of sudo vim <file>. One of the advantages is that it uses my local ~/.vimrc. However, when using sudo crontab -e, it uses /root/.vimrc instead. ...
1
vote
2answers
32 views

How to restore to permissions to sudoers file with no password?

The complete story: I launched an Amazon EC2 "Tier" (VPS) running RHEL 7.1 and created a key for ssh. EC2 automaticly crates a user called ec2-user for new Rhel VPSs, and it have the permissions (in ...
0
votes
1answer
38 views

PAM timestamp - how to inspecting the /var/run/sudo/<user> file?

The centos documentation stated that: ... In the PAM timestamp scheme, the graphical administrative application prompts the user for the root password when it is launched. When the user has ...
0
votes
0answers
37 views

How to manage any command access privileges on debian linux

I am using Debian 7, and my desktop is xfce. I want to achieve managing any command on Linux. For example, executing /usr/bin/xfce4-taskmanager command would not require sudo privileges so any user ...
1
vote
0answers
25 views

Allowing sudo kill for remote user for recovery purpose. Security implications?

I'm planning to create user allowed to SSH in and with right to sudo kill in case something disables local terminal/keyboard/display etc. Would probably add ps and/or htop to the list, as well. I ...
2
votes
2answers
60 views

how to pass environment variable to sudo su

I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesnt work. How can I pass the env variable $DUMMY to su? -p doesnt work with -l.
1
vote
3answers
56 views

Differences between sudo and su in inheriting environment

Why can the command run by sudo inherit the environment from the parent shell process, while the shell process after sudo su to the root user doesn't? t@ocean:/tmp$ export ME=tim t@ocean:/tmp$ sudo ...
2
votes
3answers
258 views

“ sudo: source: command not found”

$ source /etc/environment $ sudo source /etc/environment [sudo] password for t: sudo: source: command not found It seems that a different shell than bash is run to execute source ...
1
vote
1answer
58 views

how to enable sudo for one directory

I have Redhat 6.3 and I want to enable sudo command for chown,kill and chmod, so under root user I did the following: visudo #add the following line aabuhasna ALL=(ALL) NOPASSWD: /usr/bin/kill, ...
1
vote
1answer
88 views

What does “ALL ALL=(ALL) ALL” mean in sudoers?

If a server has the following in /etc/sudoers: Defaults targetpw ALL ALL=(ALL) ALL Then what does this mean? all the users can sudo to all the commands, only their password is needed?
0
votes
1answer
32 views

create a linux user with create files and write permissions without sudo access

I want to create a user in such a way that it can create a file and update the contents of the file. useradd username Now for sudo, we can create username and linking to sudo like below: useradd ...
0
votes
1answer
40 views

What are the differences between sudo and the use of groups?

I know these are tools used for improving security. But what I would like to know is what they are and how they work?
0
votes
2answers
174 views

apt-get update failed to fetch and /sources.list.d/ empty

Running the sudo apt-get update command, I got the following error: Fetched 988 kB in 16s (59,3 kB/s) W: Failed to fetch ...
6
votes
3answers
127 views

What bad things could happen if we don't use sudoedit?

We know it's safer* to use sudoedit, but what bad things can happen if we have the following in sudoers? Cmnd_Alias FOO = /bin/ed, /usr/bin/ed, /usr/bin/vi foouser LOCALHOST = NOPASSWD: NOEXEC: FOO ...
1
vote
1answer
48 views

Difference between adding sudo user with adduser or gpasswd

To add a new sudo user I believe I can call: # to create a new user sudo adduser newusername and to allow this user to use sudo I can do: sudo adduser newusername sudo or sudo gpasswd -a ...
0
votes
0answers
36 views

Applications not starting with sudo

I'm using Linux Mint 17 (Qiana) in my Oracle Virtual Box. Whenever I try to open an application with sudo, it is not working. For eg. if I try to open sublime text editor using the command sudo subl ...
2
votes
0answers
74 views

Security of sudo not asking for a password after the first time

After using sudo and entering a password to do so, sudo remembers that we have entered a password and we do not have to enter a password the next time we use it. I am concerned about the possibility ...
1
vote
3answers
67 views

Why is gksu asking me for root password and not my password?

On one of my systems, I'm running Gentoo Linux and I've installed x11-libs/gksu-2.0.2-r1. I've disabled the root account using sudo passwd -dl root and I want to be able to run GUI apps which need ...
1
vote
1answer
76 views

ssh with -Y results in “shell-init: error retrieving current directory: getcwd: cannot access parent directories…”

I ran an X app sudo'ed from my normal account, using: mylappy$ ssh -Y me@myhost.com me@myhost.com's password: [me@myhost ~]$ sudo su - [root@myhost ~]# su - me -c 'xauth list' |\ grep `echo ...
3
votes
1answer
151 views

How do I allow non-root users to control a systemd service with instances?

I need to allow users in the dba group to control the database@ services. The answer to this related question is to just list all systemctl "verbs" that I want to allow in the sudoers file, however, ...
2
votes
1answer
26 views

Run a command a as a certain user and multiple groups with sudo

I am trying to allow an normal user to run some applications under other UIDs for process separations. The applications should run with certain groups permissions (like audio or cdrom). In the ...
1
vote
1answer
23 views

Parallels on Mac - can no longer sudo within Ubuntu

I have been using Parallels on my Mac to run Ubuntu for a couple of weeks and it's been fine. Today I tried to install a package and received the following error: {user} is not in the sudoers ...
0
votes
2answers
68 views

executing command as su

I am executing this command as su. I have made the connection with SSH (using sshNet), and then when I try to set the command su -, I get no response. I have the password and the command I would like ...
5
votes
1answer
126 views

Edited sudoers file with text editor - now can't run sudo

I now know that I should never try to edit the etc/sudoers file with a regular text editor. However, minutes before I learned this, I saved a new user name in the file with Sublime Text. Now when I ...
1
vote
1answer
62 views

Running some parts of a script as an unprivileged user with shell environment

I am creating an instance configuration script that sets up a machine. I am running the script via sudo i.e. sudo run.sh. Most of the steps require root access but some of the script's steps do no ...
4
votes
1answer
270 views

Why isn't this directory being added to my PATH when I use sudo?

Ive just compiled and installed apache webserver from sources, and now I want to add the apachectl script to PATH I know I need to add the directory to the root user's PATH (as the script needs to be ...
0
votes
1answer
309 views

Some index files failed to download - Linux Mint 17.1 Cinnamon

Running sudo apt-get update i get the following error message: ... Ign http://packages.linuxmint.com rebecca/upstream Translation-en_US Ign http://packages.linuxmint.com rebecca/upstream ...
2
votes
1answer
33 views

NOEXEC and RESTRICT in sudoers

I understand the script below has a serious problem, and NOEXEC and RESTRICT are not enough as a solution to this. user ALL=(ALL) /usr/bin/vim /etc/httpd/confs/httpd.conf However, I still have some ...
0
votes
1answer
41 views

Prompting for a password on sudo?

I'm creating users using Puppet. Here's the gist of what I'm doing in Puppet: user { 'ntkay': name => 'ntkay', uid => 10000, home => '/home/ntkay', managehome => true, ...
2
votes
1answer
61 views

User without a password - how can one login into that account from a non-root account

I have just started to use Scientific Linux (7.0) (although I assume this question might be distribution neutral..). The kernel version is 3.10.0-123.20.1.el7.x86_64. Coming back to my question. I ...
2
votes
1answer
83 views

sudo -i returns an error [closed]

When I try to switch to root using sudo -i i get the error /var/tmp/sclDvf3Vx: line 8: -i: command not found... However, su - works which I will continue to use. I'm by no means a linux system ...
4
votes
2answers
191 views

How could we allow non-root users to control a system.d service?

With sysvinit, a sudoers entry like this would suffice: %webteam cms051=/sbin/service httpd * This would allow for commands such as: sudo service httpd status sudo service httpd restart Now, ...
1
vote
1answer
47 views

Can I restrict sudoer nopasswd to directory?

Maybe I should rephrase - what is the most secure way to accomplish my needs? Details I am using WinSCP to modify my Apache document_root. The directory /var/www/html has an owner and group of root. ...
0
votes
1answer
35 views

sudo chown -R www-data & userexample /home/example/uploads

when typing in PuTTY sudo chown -R www-data /home/example/uploads My website is displayed but I cannot access my FTP but when typing sudo chown -R example /home/example/uploads I can access my FTP but ...
-1
votes
1answer
41 views

Mutiple commands after sudo in one line

I want to execute multiple commands after a sudo command su - appuser -c "cd /apps/bundle/bundle-client/bin ; export BDL_WEB_USER=not_used ; export BDL_WEB_PASSWORD=not_used ; ./bundle -b ...
1
vote
2answers
45 views

Script using sudo works from a terminal but not from a desktop shortcut

I create small script to mount encfs filesystem. just like this: #!/bin/bash kdialog --password "Wprowadź hasło do SSH lub ENTER żeby rozłączyć:" > /home/maciek/Pobrane/pass-1 sudo encfs -S ...
2
votes
1answer
26 views

sudo with original profile

I need to launch an app with root privileges, but the app requires access to the original user's profile....so just using sudo to start the app results in the app starting incorrectly. How can I ...
0
votes
2answers
72 views

grep with variable

I am trying to create a script to monitor all logins using sudo, both success and failure. Right now, I have: set tdate = $(date "+%b %d") set attempted_su_log = /var/log/suattempts cat ...
2
votes
0answers
52 views

How to specify regular expression for command arguments in sudoers

sudoers(5) manpage says that shell-style wildcards (aka meta or glob characters) could be used in command line arguments in the sudoers file. They are *, ?, [...] and [!...]. My idea is to use some ...
4
votes
5answers
306 views

sudo in non-interactive script

I have a script that executes three functions: A && B && C. Function B needs to be run as a super-user, while A and C doesn't. I have several solutions but neither of these is ...
0
votes
2answers
50 views

Bash function for piping data into protected file [duplicate]

I wanted to create a .bashrc function that would simplify passing data to a write-protected file. function pipe { sudo bash -c "$1" } Unfortunately the command pipe echo something > ...
1
vote
1answer
49 views

SUDO_USER undefined in sudo manual - clarification would be lovely

The following statement appears early in the sudoers manual, it refers to the "SUDO_USER environment variable" but the manual does not define it: If sudo is run by root and the SUDO_USER ...
2
votes
1answer
51 views

Secure way to allow any user to run programs in specific network namespace

I have a cell modem connected to my server that I want to use as a means to get notification emails out when the landline dies. To nicely separate normal network access and this exceptional cell ...
3
votes
3answers
120 views

SUID accidently removed from /bin/su file

It is a production server - CENTOS 6.1 Some user having root access in the past had logged on to the server and removed the SUID bit from the /bin/su file and then exited root. Now we are not able to ...
1
vote
2answers
90 views

How do I use my own local text editor to modify system (requires root to save) files on a remote system?

I've recently fallen in love with github's Atom text editor, and I enjoy using it for all my local coding and configuration. I started to maintain a Nagios installation for several dozen servers and ...