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
58
votes
9 answers

running a command as a super user from a python script

So I'm trying to get a process to be run as a super user from within a python script using subprocess. In the ipython shell something like proc = subprocess.Popen('sudo apach2ctl restart', shell=True, stdin=subprocess.PIPE, …
Silfheed
  • 11,585
  • 11
  • 55
  • 67
58
votes
4 answers

How to write a shell script that runs some commands as superuser and some commands not as superuser, without having to babysit it?

I want to write a shell script to automate a series of commands. The problem is some commands MUST be run as superuser and some commands MUST NOT be run as superuser. What I have done so far is something like this: #!/bin/bash command1 sudo…
speedarius
  • 1,006
  • 1
  • 8
  • 15
55
votes
1 answer

Can't use yum inside Docker container running on CentOS

I am unable to run any yum commands inside my Docker container without getting the following error: ovl: Error while doing RPMdb copy-up: [Errno 13] Permission denied: '/var/lib/rpm/Group' You need to be root to perform this command. I'm confused…
NateW
  • 2,856
  • 5
  • 26
  • 46
55
votes
8 answers

Use sudo without password INSIDE a script

For some reason I need, as user, to run without sudo a script script.sh which needs root privileges to work. I saw as the only solution to put sudo INSIDE script.sh. Let's take an example : script.sh : #!/bin/sh sudo apt-get update Of course, if I…
Nilexys
  • 633
  • 1
  • 5
  • 10
53
votes
4 answers

Cannot use RVM-installed Ruby with sudo

I have succefully configured RVM to use Ruby 1.9.2 and everything is fine. However when I'm trying to run Ruby using sudo it says it cannot find RVM or Ruby: $ ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] $ sudo ruby -v [sudo]…
Alexey Zakharov
  • 24,694
  • 42
  • 126
  • 197
51
votes
9 answers

VSCode in WSL: how to sudo a root file so I can edit it

WSL v.1 -- VSCode v1.40.1 (using 'Remote - WSL' extension 40.3) How to open a root-owned file for edit using sudo and VSCode? (without running as root) If I open a root file without sudo, I can't edit it (expected): $ code…
51
votes
5 answers

"root" execution of the PostgreSQL server is not permitted

When I try to start postgresql I get an error: postgres postgres does not know where to find the server configuration file. You must specify the --config-file or -D invocation option or set the PGDATA environment variable. So then I try to…
chopper draw lion4
  • 12,401
  • 13
  • 53
  • 100
50
votes
7 answers

Can I prevent fabric from prompting me for a sudo password?

I am using Fabric to run commands on a remote server. The user with which I connect on that server has some sudo privileges, and does not require a password to use these privileges. When SSH'ing into the server, I can run sudo blah and the command…
mipadi
  • 398,885
  • 90
  • 523
  • 479
48
votes
7 answers

dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid

since an update to 10.8 I get the following error, when trying to do a sudo command, which is pretty annoying. dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid What does that have to mean?…
eneskaya
  • 918
  • 1
  • 10
  • 17
47
votes
4 answers

Unable to install Python without sudo access

I extracted, configured and used make for the installation package in my server. However, I could not use make install. I get the error [~/wepapps/python/Python-2.6.1]# make install /usr/bin/install -c python…
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
47
votes
6 answers

How to sudo on powershell on Windows

Whenever I need to run a powershell script it complains of security, if I add powershell.exe -nologo -executionpolicy bypass -File .\install.ps1 I still get permission denied unauthorizedAccessException. I just want to run this install script, what…
eri0o
  • 2,285
  • 4
  • 27
  • 43
46
votes
4 answers

Bash scripts requiring sudo password

I'm creating a Bash installer script which compiles and installs some libraries for both OSX and Linux. Because some commands in my script ("make install", "apt-get install", "port install", etc) require sudo, I need the user to supply the password.…
Thijs Koerselman
  • 21,680
  • 22
  • 74
  • 108
46
votes
4 answers

How to call shell script from php that requires SUDO?

I have a file that is a bash script that requires SUDO to work. I can run it from the command line using SUDO but I will be prompted to put in the SUDO password. I want to run this script from php via shell_exec but I if I call SUDO, its not like a…
JD Isaacks
  • 56,088
  • 93
  • 276
  • 422
46
votes
10 answers

Getting sudo and nohup to work together

Linux newbie here. I have a perl script which takes two command line inputs. I tried to run it in the background but this is what I got: [~user]$ nohup sudo ./ascii_loader_script.pl 20070502 ctm_20070502.csv & [2] 19603 [~user]$ nohup: appending…
Alex Chen
  • 535
  • 1
  • 5
  • 7
46
votes
6 answers

Permission denied when trying to append a file to a root owned file with sudo

This is the shell command that results in "Permission denied" when I'm trying to append the data in a file to another file with sudo: sudo cat add_file >> /etc/file The file at /etc/file is owned by root (i.e. me) and its permissions are rw-r--r--.…
Desmond Hume
  • 8,037
  • 14
  • 65
  • 112