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
17
votes
6 answers

Why can't I use 'sudo su' within a shell script? How to make a shell script run with sudo automatically

I cannot figure out what's wrong with this. When I run it in terminal and enter password, nothing happens, but if I run every command separately in terminal, it works. Thank you! #!/bin/bash sudo su; mkdir /opt/D3GO/; cp `pwd`/D3GO…
Dusan Milosevic
  • 460
  • 2
  • 4
  • 18
17
votes
6 answers

Hadoop: require root's password after enter "start-all.sh"

I have installed Hadoop and SSH on my laptop. "ssh localhost" works fine. After formatting HDFS, I tried to start hadoop. munichong@GrindPad:~$ sudo /usr/sbin/start-all.sh starting namenode, logging to…
Munichong
  • 3,861
  • 14
  • 48
  • 69
16
votes
7 answers

Python import web not working

So I'm getting the following error when running a script that imports web. $ python bin/app.py Traceback (most recent call last): File "bin/app.py", line 1, in import web ImportError: No module named web I tried using easy_install web but…
ZCJ
  • 499
  • 2
  • 9
  • 17
16
votes
4 answers

Switch user without creating an intermediate process

I'm able to use sudo or su to execute a command as another user. By combining with exec, I'm able to replace the current process with sudo or su, and a child process running the command. But I want to replace the current process with the command…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
16
votes
8 answers

How do I run a sudo command in Emacs?

I'm trying to create shortcut keys for some commonly used sudo shell commands (for example, having C-c s run (shell-command "sudo /etc/init.d/apache2 restart")). I tried using a straight-up shell-command call as above, but it just outputs the…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
16
votes
5 answers

npm install vs sudo npm install -g

for some packages I have to run sudo npm install -g while for others npm install will suffice. Why and what's the difference? For example: npm install -g grunt-cli # doesn't work sudo npm install -g grunt-cli # works npm install websocket-stream #…
Connor Leech
  • 18,052
  • 30
  • 105
  • 150
15
votes
4 answers

How to get the pid of command running with sudo

I am trying to get the pid of this command. sudo -b tcpdump -i eth0 port 80 -w eth0.pcap
user87005
  • 964
  • 3
  • 10
  • 27
15
votes
2 answers

run specific command without sudo inside script running with sudo bash

I have a bash script which I'm running with sudo: sudo NewScript Inside the script, I have a git command which I don't want to run with sudo. Currently, since the entire script is run with sudo this command also runs with sudo and that's what I…
Idanis
  • 1,918
  • 6
  • 38
  • 69
15
votes
2 answers

Packer build fails due to tty needed for sudo

My packer build is failing with the following message: sudo: sorry, you must have a tty to run sudo. My host is Windows 8 with vagrant and virtualbox, my guest is centos7. On researching it is my understanding that not requiring tty for sudo is the…
Harris.Atlarge
  • 171
  • 1
  • 1
  • 5
15
votes
2 answers

Ansible 1.9.1 'become' and sudo issue

I am trying to run an extremely simple playbook to test a new Ansible setup. When using the 'new' Ansible Privilege Escalation config options in my ansible.cfg…
ilium007
  • 539
  • 3
  • 8
  • 17
15
votes
3 answers

How to get password for sudo

I'm trying to use the command sudo -i -u postgres for PostgreSQL, and the Google Compute Engine VM is asking me for my password for my account (not root). As I never issued a password, and I always login to my server via SSH key, I'm not sure what…
Allen
  • 3,601
  • 10
  • 40
  • 59
15
votes
4 answers

fastboot and adb not working with sudo

I have a very weird issue on my Ubuntu machine when trying to run the fastboot command. When I run: fastboot devices I get no permissions fastboot So I run the command with adminidtrator permissions: sudo fastboot devices And then I get the…
Guy Sopher
  • 4,402
  • 4
  • 22
  • 36
15
votes
3 answers

SSH to server, Sudo su - then run commands in bash

I have the following #!/bin/bash USER='scott' PASS='tiger' ssh -t $USER@server006.web.com "sudo su - http" This Works, but I was trying to get it to run a script afterwards, and if I do, using -c or < The script does a grep like this: grep -i…
Ben Coughlan
  • 555
  • 3
  • 12
  • 23
15
votes
6 answers

setting gsettings of other user with sudo

On Ubuntu 13.10, I have all of my gsettings in a file, mygset.sh. For example, mygset.sh contains many lines such as gsettings set com.canonical.Unity.Launcher favorites "['application://nautilus.desktop', 'application://firefox.desktop',…
Xu Wang
  • 10,199
  • 6
  • 44
  • 78
15
votes
2 answers

Ubuntu 12.04 LTS bash: sudo: command not found

I am new to Linux terminal, now I tried to use sudo, apt-get, whereis etc., commands in linux it returns an error bash: sudo: command not found my command $sudo apt-get install libc6-dev Error is bash: sudo: command not found. Please let me…
user1845827
  • 319
  • 2
  • 3
  • 8