Questions tagged [sudo]

The sudo command is a program for Unix and Unix-like computer operating systems that allows a user to run programs with the security privileges of another user (normally the superuser, or root). The name is an abbreviation for "substitute user do" (as in, do a command as if started by another user).

The sudo command is a program for Unix and Unix-like computer operating systems that allows a user to run programs with the security privileges of another user (normally the superuser, or root). The name is an abbreviation for "substitute user do" (as in, do a command as if started by another user).

Unlike the su command, users typically supply their own password to sudo rather than the root password. After authentication, and if the /etc/sudoers configuration file permits the user access, then the system will invoke the requested command.

2818 questions
14
votes
3 answers

How to give sudo access to a bash script?

I have a bash script(chbr.sh) to change my display brightness from terminal as my brightness keys doesn't work. `sudo setpci -s 00:02.0 F4.B=30` Now, every time I run that script it asks for password which I don't like. So, I googled a little and…
ronnie
  • 1,799
  • 3
  • 17
  • 22
13
votes
2 answers

How do I determine if a shell script is running with root permissions?

I've got a script I want to require be run with su privileges, but the interesting scripted command that will fail comes very late in the script, so I'd like a clean test up front to determine if the scrip will fail without SU capabilities. What is…
F. Randall Farmer
  • 627
  • 1
  • 6
  • 13
13
votes
2 answers

Setting Linux environment variable for another user (sudo)

How can we set environment variables for another user on a machine? I want to run some script with sudo -u xyz but I need to set some environment variables before running the script for xyz user which is different from my login.
TopCoder
  • 4,206
  • 19
  • 52
  • 64
13
votes
3 answers

Killing sudo-started subprocess in python

I am running with a user that can make root-level calls without having to supply a password. My user currently does something like this pr = subprocess.Popen("sudo sleep 100".split()) sleep(5) pr.kill() but that leads to this error because the user…
John Allard
  • 3,564
  • 5
  • 23
  • 42
13
votes
1 answer

How can I run as root on Heroku?

I tried using sudo to run a command on Heroku. Then I get a message that I cannot use the sudo command on Heroku. My real question is: How can I run a command with root privilege on Heroku, because it is required for some of the commands I'm trying…
13
votes
3 answers

ansible sudo: sorry, you must have a tty to run sudo

I need to run playbooks on Vagrant boxes and on aws when I setup environment with cloud formation. In Vagrant file I use ansible-local and everything works fine name: Setup Unified Catalog Webserver hosts: 127.0.0.1 connection: local …
Kate
  • 294
  • 1
  • 5
  • 14
13
votes
6 answers

failed in "sudo pip"

Please help me. server : aws ec2 os : amazon linux python version : 2.7.10 $ pip --version pip 7.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7) It's OK. But... $ sudo pip --version Traceback (most recent call last): File…
J. Kang
  • 139
  • 1
  • 1
  • 3
13
votes
2 answers

why wildcard doesn't work in `sudo rm` statement?

I was trying to delete all files in log directory and using default bash shell on CentOS 6.5 [lei@ids7gueywjZ /]$ sudo ls -al /var/log/jenkins/ total 1541512 drwxr-x--- 2 jenkins jenkins 4096 Jul 22 09:52 . drwxr-xr-x. 10 root root …
LeoShi
  • 1,637
  • 2
  • 14
  • 24
13
votes
1 answer

Anaconda python not available from sudo

I installed Anaconda in a Google Cloud Compute environment and can use it successfully from the shell as a normal user: curt@lamp-v5mi:~$ python Python 2.7.9 |Anaconda 2.2.0 (64-bit)| (default, Mar 9 2015, 16:20:48) [GCC 4.4.7 20120313 (Red Hat…
Curt F.
  • 4,690
  • 2
  • 22
  • 39
13
votes
2 answers

Qt Session management error with matplotlib.pyplot.plot

All of a sudden, whenever I call matplotlib.pyplot.plot (within a unix OS), the following error is printed to the screen: Qt: Session management error: Authentication Rejected, reason : None of the authentication protocols specified are supported…
abcd
  • 10,215
  • 15
  • 51
  • 85
13
votes
3 answers

How to find the user that executed a program as root using Golang?

I'm creating a small program that requires privileged access to a network port below 1024, so it runs with sudo. If part of what the utility will need to do requires knowing who the user is that invoked the application, I would need a way to query…
Bart Silverstrim
  • 3,445
  • 6
  • 34
  • 44
13
votes
2 answers

Why are modules in PYTHONPATH not found when the containing directory is part of PYTHONPATH and file exists?

I have the following situation (verfication through commands below): existing python script file in directory x existing python cat __init__.py file in x x added to PYTHONPATH variable availble for both logged in user and sudo and I want to invoke…
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
13
votes
13 answers

Text editor that can edit using sudo over ssh?

I'm trying to edit files on a remote Amazon EC2 Linux instance. I'm currently just sshing in and using nano, but would really like a graphical text editor. I have two problems: I have to use sudo to edit these server files when I ssh in. I can only…
db-user
  • 223
  • 1
  • 2
  • 11
13
votes
2 answers

Authentication error in jenkins on using sudo

I have sh script in jenkins which has sudo ssh command and I am getting this error Warning: Identity file key.pem not accessible: Permission denied. Host key verification failed. sudo: no tty present and no askpass program specified I have found…
Uday Reddy
  • 1,337
  • 3
  • 16
  • 38
13
votes
2 answers

Execute single command in shell script without sudo

I have a simple shell script that is run with sudo as most of the script requires it, yet one of the commands in the script is a Homebrew install, which cannot be executed with sudo.. So, my question is when executing a shell script with sudo how do…
RayViljoen
  • 1,311
  • 1
  • 11
  • 15