sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

1
vote
1answer
270 views

Exiting a Bash script when a sudo child quits

I'm trying to launch a couple of sub-programs from a bash script and then wait on either of them to quit before quitting the other and exiting the script. CMD1PID= CMD2PID= exit_trap () { ...
0
votes
1answer
401 views

Launch application as root user in GNOME

I've got CentOS 6 installed on my server. A few users want to have access to it via VNC, so I installed GNOME separately. Everything works okay, but I want to have possibility to run applications as ...
0
votes
1answer
155 views

sudo mount from webserver (Apache) by mod_php, result not visible by root

Intial question: http://stackoverflow.com/questions/19598201/umounting-through-exec-with-sudo-the-user-is-a-sudoer-with-nopasswd Basically, I have a PHP script, that: exec('sudo mount ...
1
vote
1answer
542 views

ssh with sudo doesn't start services

I want to run command with sudo through ssh without disabling "requiretty" sudo option. According to /etc/sudoers: # # Disable "ssh hostname sudo <cmd>", because it will show the password in ...
1
vote
1answer
75 views

Why doesn't sudo -S work for 'mysql' command?

I generally run sudo mysql database < database.dump and type the password on prompt. In order to automate this, I tried to execute echo 'password' | sudo -S mysql database < database.dump but ...
1
vote
0answers
68 views

can't access account with empty password

I used the passwd command to remove the password for my account. Now, when I try to use su to log in to my account, it won't let me enter an empty password. So now, I can't access my account. Any ...
2
votes
1answer
48 views

Allow a specific user to sudo to users that are part of group X

I have several users, which are all part of group X. And I want to be able to give user Y to sudo to members of group X. Obviously I don't want to edit sudoers everytime I add a user to group X, is ...
1
vote
1answer
286 views

Can't sudo after lock password, can I recover from that?

After setup ubuntu with default settings, It allows user to login with password, so I use passwd -l [username] to forbid password login both in ssh and console. But when I use sudo to execute ...
6
votes
5answers
378 views

Set sudo password differently from login one

As a privileged user I am trying to set the sudo password to another then the one used at login. I have done some research but have not found an answer. Does sudo support that kind of configuration? ...
3
votes
2answers
572 views

difference between windows local admin and unix root

I am trying to understand what is a conceptual difference between unix root account and windows local admin. I am a developer and despite IT department efforts were always given local admin rights so ...
2
votes
2answers
2k views

Unable to run 'sudo chmod +w /etc/hosts'

I am logged into my remote VM (running out of ESXi) as user xyz. I wanted to change my /etc/hosts to add some network names that were not visible by default. I first tried to run sudo vi /etc/hosts ...
1
vote
3answers
1k views

Error : /etc/sudoers not working - Ownership wrong

I have Ubuntu 12.10 on my client system. I have an error /etc/sudoers is owned by uid 1000 should be 0. I tried booting from an Ubuntu live CD and tried: sudo chown root:root /etc/sudoers sudo ...
3
votes
2answers
592 views

Who is file owner if the file is created using sudo command?

I logged in using my username ravbholua: ravbholua@ravbholua-Aspire-5315:~$ echo $LOGNAME ravbholua I create file named a1: ravbholua@ravbholua-Aspire-5315:~$ echo>a1 ...
2
votes
1answer
237 views

Broken sudo on amazon web services ec2 linux centOS

So I had no idea of the dangers of messing with the /etc/sudoers file, and was just trying to make a simple change in there. However, I seem to have put something with incorrect syntax in there, ...
4
votes
1answer
147 views

Keeping sudo authentication with gnome-terminal (zsh)

Can sudo sessions be shared across tabs of gnome-terminal, so that once I use sudo in one tab, I won't have to re-enter my password every time I open another tab and use sudo?
2
votes
3answers
2k views

How can I keep *all* environment vars for a specific command in sudo?

I have a script that sets several environment variables and then finally calls another script using sudo. The script run with sudo must be able to pick up those variables, and I'm not always going to ...
1
vote
3answers
291 views

sudo as another user

I want to run a command on a shell on behalf of another user. The command is as follows: sudo -u USER cd /home/USER I get sudo: cd: command not found What is the correct syntax for the command ...
12
votes
1answer
614 views

How to tell sudo to repeat lecture once?

I'm letting one of my coding buddies have root access to my Raspberry Pi, and as I was getting everything set up, I tested sudo as him. It gave me "the speech": We trust you have received the ...
0
votes
3answers
261 views

How to stop regular users from Switching Users

I want to stop the normal users from using following commands /bin/bash /usr/bin/sudo /bin/su I added them in sudoers file but normal user can still use the following command This is how i add the ...
1
vote
1answer
240 views

How to make sudo accept password automatically without prompting for it? [duplicate]

I created a user named shut so that whenever one logs in using that username the machine would shut down. For that I placed the below command in the end of the .profile. exec sudo shutdown -h now ...
7
votes
3answers
2k views

which shell will sudo use to execute a shell script without the shebang line

My environment is Ubuntu 12.04 LTS, and the sudo version is 1.8.3p1. First I login as a normal user: $ whoami fin $ cat /etc/passwd | grep -i "root\|fin" root:x:0:0:root:/root:/bin/bash ...
2
votes
3answers
714 views

Restrict standard users to run a command with a specific argument

I know how to restrict standard users to run a command by removing execute permissions for that command. But it's possible restrict standard users to run a command with a specific option/argument? ...
9
votes
2answers
166 views

How to automatically enter sudo's grace period upon CLI login?

What I would like to do is be able to login and sudo commands immediately without entering a password again. It is very redundant to type my password twice in a row when I need to login and run a ...
0
votes
2answers
335 views

Pass flags to xargs

I want to kill a bunch of processes using this command: sudo ps ax | grep node | awk '{print $1}' | xargs kill But it gives me operation not permitted even with sudo. Then I tried with kill -9 ...
4
votes
3answers
903 views

Why is PATH reset in a sudo command?

After much frustrating head-brick-wall contact, I've discovered this: $ echo $PATH /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/steve/bin $ sudo bash # echo $PATH ...
1
vote
1answer
162 views

How to pipe to bash as a different user

I am running an experiment as a way to solve a bigger problem. For the experiment, I need to install rvm as a user who does not have a shell. To install rvm, you use the following command \curl -L ...
2
votes
3answers
2k views

Allow a user to view the home directory of other users via sudo

I am new to system administration. We have a lab set up where we have a server and client machines. The client machines have LDAP users which has the work area for all the users in the centralized ...
6
votes
5answers
2k views

How is sudo set to not change $HOME in Ubuntu and how to disable this behavior?

On Ubuntu 12.04, when I sudo -s the $HOME variable is not changed, so if my regular user is regularuser, the situation goes like this: $ cd $ pwd /home/regularuser $ sudo -s # cd # pwd ...
1
vote
2answers
219 views

Can't run su after changing permissions to su file

I am running Linux Slackware 14.0. I wanted to allow to do su only to the members of wheel group, so I modified the permissions of /bin/su and /usr/bin/sudo files to this: bash-4.2# ls -la /bin/su ...
3
votes
1answer
932 views

sudo askpass: ask from other tty

Context I want to setup rsync backups of my server, so I run the following command rsync -r -e ssh --rsync-path="sudo rsync" rsyncuser@example.com:/ /backup/ Ideally, that command would ask my ...
5
votes
2answers
758 views

“nohup sudo …” does not prompt for passwd and does nothing

When I run nohup sudo myscript.sh & I only get something like [1] 1220 in return and do not get prompted for a password. The process does not start either. I want to run this script in the ...
12
votes
4answers
1k views

Can you give a user account multiple passwords?

I want to assign 2 passwords to a single account. What I want to know is 1) is this possible, and 2) what are the security implications of this? The reason I want to do this is because I'm currently ...
5
votes
1answer
206 views

sudo: don't ask password when logged in with ssh key

I'd like to setup sudo in such a way that it doesn't prompt me for a password when I authenticate to sshd with a key; but do otherwise. I don't want an answer of "it doesn't work like that" because ...
6
votes
2answers
508 views

If I type “sudo” at the beginning of a one liner, does it apply to the rest of the commands?

If I type sudo at the beginning of a one liner in bash, does it apply to the rest of the commands? In other words, is this: sudo foo | foo2 | foo3 equivalent to this: sudo foo | sudo foo2 | ...
0
votes
2answers
6k views

How to kill a process that says “Operation not permitted” when attempted?

I have a process I would like to kill: computer@ubuntu:~$ ps aux | grep socat root 2092 0.0 0.0 5564 1528 pts/1 T 14:37 0:00 sudo socat TCP:xxx.17.29.152:54321 ...
0
votes
1answer
826 views

Allow www-data to perform specific commands

I need a PHP script to perform git pull however I am not naive enough to give it permissions on git. I've wrapped git pull in a script which www-data has permissions for, but I'm not sure how to give ...
2
votes
2answers
139 views

Securely allowing users to create accounts

1) I'm struggling to find a secure way to allow new users to create accounts without granting them admin rights to do so. If you already have an account on my system and can work UNIX command line, ...
3
votes
2answers
2k views

Difference between root account and administrative account

If a user with administrative privilege can have all the powers of root using sudo , then what is the advantage of having root account?
2
votes
3answers
191 views

sudo command after long sleep call without re-prompting sudo password

I'm trying to write a simple bash function that sleeps X-number of mins and then runs a system sleep command (for me it's sudo pm-suspend since I'm on Ubuntu) right now the function looks like this: ...
1
vote
3answers
203 views

Installation script needs to be run as a certain (regular) user but needs to create a system directory

I'm new to Linux, let me explain the issue. I'm trying to install comsol with some sort of network license. If I use sudo ./setup the server directory does not recognize the username "root". The ...
3
votes
1answer
1k views

Can edit file as root, but not using sudo

I just faced a really strange situation. I was trying to edit file /usr/lib/thunderbird/thunderbird.sh, which has the following permissions: $ ll /usr/lib/thunderbird/thunderbird.sh -rwxr-xr-x 1 ...
6
votes
4answers
2k views

Why can't we execute a list of commands as different user without sudo?

This question has been asked in a different way in other forums. But there has not been a decent explanation why you can't do the below in bash. #!/bin/bash command1 SWITCH_USER_TO rag command2 ...
1
vote
2answers
17k views

How to properly configure sudoers file, on debian wheezy?

I have seen many blog posts that say, it is enough to do aptitude install sudo su root adduser USERNAME sudo But that only protects aptitude, in other words: aptitude install sendmail will ask ...
2
votes
2answers
57 views

What alternative backends does sudo support and how is it configured?

When preparing for the Red Hat Certified Engineer certification examination, I came across this quote in my study notes about the sudo command. By default, the policy is maintained as a flat text ...
1
vote
3answers
104 views

Is there any way to disable shutdowning remote machine?

I sometimes mistakenly shutdown the remote machine by using sudo init 0, so I wrote something like in one of my rc files: alias sudo='sudo ' if [ $SSH_CLIENT ]; then alias init 'echo Never use init ...
2
votes
1answer
969 views

Why does this Bash NRPE plugin not return a variable to Nagios?

This is a very specific question I have here, maybe one has a simple answer for it. This script I have here works locally just fine: #! /bin/bash volts=`sudo vcgencmd measure_volts core|sed ...
1
vote
1answer
78 views

HGRCPATH kept in /etc/sudoers, yet ignored by hg?

I'm trying to follow the directions here under "sudo and multiple users". I believe I managed to modify /etc/sudoers correctly enough (by adding Defaults :me env_keep += "HGRCPATH" at the beginning ...
1
vote
1answer
97 views

Losing (realtime) permission when sudoing from root to myself

After an upgrade to debian wheezy (I did not upgrade the kernel - it is still 3.8.2) I can no longer start jackd in the way I used to do it. I get you are not allowed to use realtime scheduling. My ...
0
votes
1answer
430 views

Webmin administrative panel options are missing

When I log into Webmin, with the Ubuntu administrative user frank, I cannot see most of the administrative options: frank is shown as the Administration username in Webmin. I accidentally ...
1
vote
3answers
99 views

Confused on user and su in linux

How could I run a script as a specific user (non-root)? As this? sudo su - john /usr/share/script.pl for user john?