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

sudo in php exec()

I don't know what the deal is here… So I want to run an applescript: sudo osascript myscript.scpt This works fine in the terminal, but not when I execute it via PHP's exec(); nothing happens. The console says no tty present and no askpass program…
pop850
  • 3,157
  • 3
  • 29
  • 34
45
votes
4 answers

Getting $USER inside shell script when running with sudo?

How do I get the correct $USER if I run a shell script with sudo ? I run them as postinstall scripts in a Mac install package, where they are being sudo-ed automatically, but I need to do stuff with the username. $HOME is correct, though. The…
Jörg Haubrichs
  • 2,215
  • 3
  • 24
  • 26
41
votes
3 answers

Running as a host user within a Docker container

In my team we use Docker containers to locally run our website applications while we do development on them. Assuming I'm working on a Flask app at app.py with dependencies in requirements.txt, a working flow would look roughly like this: # I am…
Robin Winslow
  • 10,908
  • 8
  • 62
  • 91
39
votes
3 answers

Why does pip3 want to create a kdewallet after installing/updating packages on Ubuntu 20.04?

I recently updated my system from Ubuntu 18.04 to 20.04. Afterwards I tried to update all of my pip3 packages using the shell command mentioned here (I changed "pip" to "pip3"). After it updated a couple of packages, this prompt came up: KDE Wallet…
Gesuchter
  • 541
  • 5
  • 13
36
votes
1 answer

Getting Haskell's hsenv to work on Ubuntu 13

I'm trying to get GHC working on Ubuntu. Did the following: sudo apt-get install ghc sudo apt-get install cabal-install cabal update cabal install hsenv Then I tried to create a hsenv environment and got the following: xx@xx-VirtualBox:~/scm/t1$…
me2
  • 3,933
  • 4
  • 17
  • 16
34
votes
4 answers

Generate script in bash and save it to location requiring sudo

In bash I can create a script with a here-doc like so as per this site: http://tldp.org/LDP/abs/html/abs-guide.html#GENERATESCRIPT ( cat <<'EOF' #!/bin/bash #? [ ] / \ = + < > : ; " , * | #/ ? < > \ : * | ” #Filename="z:"${$winFn//\//\\} echo…
D W
  • 2,979
  • 4
  • 34
  • 45
34
votes
4 answers

On OS X El Capitan I can not upgrade a python package dependent on the six compatibility utilities NOR can I remove six

I am trying to use scrape, but I have a problem. from six.moves import xmlrpc_client as xmlrpclib ImportError: cannot import name xmlrpc_client Then, I tried pip install --upgrade six scrape, but: Found existing installation: six 1.4.1 …
R.hui
  • 523
  • 1
  • 4
  • 8
33
votes
2 answers

sudo pip install VS pip install --user

Can't remember where I read this, but either somewhere on here or in the comments of a tutorial I was following, a person said: Never ever use sudo pip install; you could overwrite important stuff without knowing it. Use pip install --user…
Chockomonkey
  • 3,895
  • 7
  • 38
  • 55
31
votes
10 answers

Adding users to sudoers through shell script

Is it possible to add users to the sudoers file through a shell script? I've been looking around, still can't find anything.
nickw444
  • 948
  • 2
  • 9
  • 18
31
votes
3 answers

Ansible non-root sudo user and "become" privilege escalation

I've set up a box with a user david who has sudo privileges. I can ssh into the box and perform sudo operations like apt-get install. When I try to do the same thing using Ansible's "become privilege escalation", I get a permission denied error. So…
DavB
  • 1,676
  • 2
  • 14
  • 16
30
votes
2 answers

Ansible 2.1.0 using become/become_user fails to set permissions on temp file

I have an ansible 2.1.0 on my server, where I do deployment via vagrant and on PC too. The role "deploy" have : - name: upload code become: true become_user: www-data git: repo=git@bitbucket.org:****.git dest=/var/www/main …
DeamonMV
  • 722
  • 1
  • 10
  • 19
30
votes
7 answers

sudo command not found on Cygwin

I am currently trying to install and update a few packages on a Windows OS. The only matter is that I am using Cygwin in order to type the commands through a terminal (as I'm aware, I can type in Linux type commands such as cd, ls etc. on Cygwin - I…
Adam
  • 862
  • 2
  • 8
  • 12
29
votes
1 answer

rvmsudo vs sudo?

I just moved to RVM. sudo bundle install gives me and error:- sudo bundle install /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError) from…
Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
29
votes
9 answers

Change to sudo user within a python script

I have a problem. I am writing a piece of software, which is required to perform an operation which requires the user to be in sudo mode. running 'sudo python filename.py' isn't an option, which leads me to my question. Is there a way of changing to…
Kraken18
  • 663
  • 2
  • 11
  • 25
29
votes
2 answers

Can I control a user systemd using 'systemctl --user' after sudo su - myuser?

I have a service that I want to start with system startup. I have built a ap@.service definition for it as a template, because there could be many instances. Defined in the root systemd, this works well, and starts and stops the service with the…
NeilCasey
  • 621
  • 6
  • 8