sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

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 ...
2
votes
1answer
328 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
510 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
637 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
668 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
278 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
171 views

Keeping sudo authentication with gnome-terminal

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 ...
2
votes
3answers
1k 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
750 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
359 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
284 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
761 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
172 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
437 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
1k 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
190 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
3k 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 ...
7
votes
5answers
3k 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
261 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
1k 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
971 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
2k 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
239 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
623 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 | ...
2
votes
2answers
7k 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
965 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 ...
3
votes
2answers
146 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
211 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
240 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
22k 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
106 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
1k 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
82 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
106 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
520 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
101 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?
0
votes
1answer
126 views

rsnapshot LVM without root

I'd like to cron a local backup to a locally mounted USB drive. I'm using rsnapshot and want it to back up an LVM snapshot onto the USB drive. But, unless I run the cron as root it complains that I ...
2
votes
1answer
412 views

How do I grant someone else access to my linux server

If you administer a Linux server, what steps do you take to properly grant someone else access? Assuming they will log in over ssh, don't already have an account, and will need root access. ...
3
votes
2answers
479 views

insert text in a file using echo command [duplicate]

I am trying to insert some text in a file in the following way sudo echo "abc-abc/abc/abc" >> /etc/portage/make.conf but it give me the error Permission denied although I am using sudo ...
3
votes
1answer
1k views

Poweroff or Reboot as normal User

To run the command poweroff or reboot one needs to be super user. Is there anyway I can run this as a normal user? I just don't want to sudo and enter my password every time I reboot or power off.
4
votes
1answer
400 views

RPM fails to uninstall using sudo rpm -e

I have encountered a strange and annoying problem when trying to uninstall certain in-house generated rpm packages using sudo. When I do the following: sudo rpm -e mypackage rpm -qa | grep ...
18
votes
2answers
2k views

How can I `alias sudo !!`?

I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints sudo: !!: command not found If I use double quotes, it substitutes ...