Questions tagged [sudo]

2

votes
1

answer
25

Views

Python Fabric Sudo su - user

I currently do the following With putty, I ssh [email protected]_server with a password Then I switch to dev_user by doing sudo su - dev_user without password I don't have the password to dev_user, but the system is setup so that I can sudo to it without password. Then I carry on my tasks as dev_user. Wou...
jibhas
1

votes
1

answer
3.1k

Views

Executing a shell script that requires sudo from a web app

Given that the web application doesn't have su privileges, I'd like to execute a shell script that requires sudo. I'd also like to avoid having the user input the password. What are my options? This is basically what I'm trying to do. Wicket Application (Form for changing the IP) @Override protected...
Kevin D.
1

votes
2

answer
195

Views

sudo ignores SIGTERM sent from same script

I'm trying to figure out why this doesn't work: #!/bin/bash sudo sleep 60 & sudo_pid=$! sudo kill $sudo_pid I'd expect that after the kill, the sudo command and its child sleep process would be terminated, but they aren't, as shown by this script: #!/bin/bash sudo sleep 60 & sudo_pid=$! sudo kill $s...
Jon
1

votes
2

answer
857

Views

Different environment when running sudo as root?

I'm trying to install the Xeon Phi coprocessor. The specific behavior is probably related to the tools involved - my question is of a more general nature. When I execute a command as root, I get a segmentation fault. When I execute it as root but (in my opinion unnecessarily) use sudo, it works: i72...
mrks
1

votes
1

answer
95

Views

Who I was before I sudo to root [closed]

I'm working in a script, the script runs as root. But I need to log who I was before I sudo to root. Is there any way? Thanks
radicaled
1

votes
4

answer
1.3k

Views

Running sudo command via CGI (Python)

I am writing a test suite for a web application using Selenium. In the course of which I need to test behaviour of the app in case a certain service is running or not. I wanted to create a cgi call to a Python script turning that service on and off. I know that the cgi call is in the context of the...
Juergen Riemer
1

votes
2

answer
526

Views

Ubuntu on AWS, su(switch user) command not works

I made a little mistake this morning. I wanted to change the owner of the wordpress website directory, and I commanded as below. sudo chown -vR :theuser / var/wwwwordpress/ But this command was wrong. This command changed all files of my system. ('/ var/' should be '/var/') I was so confused, then s...
Eddy
1

votes
3

answer
2.6k

Views

Remove sudo permissions for one command

this is probably a really simple question. I apologize if it is a duplicate. I want to know how to remove sudo permissions for one particular command. I've created a script that installs a bunch of .deb packages and it needs sudo to do that, but one command in it needs to run without sudo permission...
user244985
1

votes
2

answer
216

Views

Default user for files and directories created in bash under sudo

I'm writing a bash script that creates directories and copy files under Mac OSX. Some of these directories and files need to be placed in folders owned by the system such as /Library/Audio/Plug-Ins, and so I run the script under sudo. Such script might look like: copy-plugins.sh: #!/usr/bin/env bash...
1

votes
1

answer
530

Views

Risky Using Forever + Sudo to keep node app running?

Is it risky to keep a node.js application running as sudo using forever.js? What potential problems are there? If this is ill-advised what is a better alternative?
1

votes
2

answer
593

Views

prevent sudo command when executing a bash script

I am aware that I can prevent sudo command while I execute script; Suppose I have one test bash script and I don’t want that someone executes this script by issuing the following command: username:~#sudo ./test I implement one of following methods to prevent the above execution, I also implement o...
Pradeep Gupta
1

votes
2

answer
280

Views

Are there downsides to installing node.js with root privileges?

I'm using the following code to install node: cd /usr/local/src/ wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz tar -xvf node-v0.10.25.tar.gz cd node-v0.10.25 ./configure make make install # node.js links to make sudo work right ln -s /usr/local/bin/node /usr/bin/node ln -s /usr/local/lib...
B T
1

votes
1

answer
527

Views

How to build files as root in sublime on mac?

Today after I updated OS X to 10.9.5 and Xcode on Mac, I encounter a problem with Sublime Text 2 that when I write a Hello World program in C++, and run build, it says Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
thuzhf
1

votes
2

answer
53

Views

How to immediately forget last sudo usage

I am trying, in C++, to write a program that will request sudo privilege if it does not have it. I have accomplished that through execl("/usr/bin/sudo", "sudo", argv[0]); but my biggest problem is occurring in trying to test it. Is there a way to make the system forget that I have recently used su...
Oantby
1

votes
2

answer
7.5k

Views

Python ImportError: no module named os

Trying to upgrade matplotlib as in this post, I ran export PYTHONHOME=/usr/lib/python2.7/ sudo easy_install -U distribute sudo pip install --upgrade matplotlib Now whenever I try to run python I get ImportError: no module named os. What happened? Please help me. I'm on OS X 10.9.5.
BoltzmannBrain
1

votes
3

answer
1.8k

Views

how to do multiple search in installed RPM packages?

how to do multiple search in installed RPM packages? $ rpm -qa | grep 'mysql' 'jdk' 'jre' or $ rpm -qa | grep mysql && rpm -qa | grep jdk && rpm -qa | grep jre
user139856
1

votes
1

answer
428

Views

why does this tar command fail when passed as string in ssh call?

ssh [email protected] "sudo tar -czf - -C /path/To/Directory *.properties" | tar xzf - It fails with following error - tar: *.properties: Cannot stat: No such file or directory tar: Exiting with failure status due to previous errors If I ssh to server and then on server, instead of tar -czf - use tar -cz...
Ani
1

votes
1

answer
116

Views

Running sudo inside script sets uid to current user instead of root uid

I have a script that creates a filesystem archive. For this I need superuser privileges, but I do not wish to run the whole script with sudo, just the specific line that creates the archive. The problem is, when I prefix the archiving command with 'sudo', the files which are created inside the archi...
Nikita Kiryanov
1

votes
1

answer
1.9k

Views

SFTP Super User with Transmit or Cyberduck

i have an ubuntu aws ec2. I can transfert file with os X terminal using sudo scp -i /my-key.pem /path/to/local/file [email protected]:/path/to/remote/file but i would like to use Transmit or Cyberduck to do this. I can connect to my ubuntu server, i can read file but i can't write files it says per...
pldlt
1

votes
1

answer
430

Views

Fork with user privileges/rights

Is it possible to fork a process and to run a program as normal user, e.g. with sudo rights? Or, if with sudo, with normal rights?
Earlybite
3

votes
3

answer
229

Views

How to discover linux username with administrator privileges in Java

I created a program which needs administrator privileges to be executed (in this program I am using a port which is
stamina
11

votes
4

answer
8.4k

Views

Storing sudo password as variable in script - is it safe?

Is storing my password this way safe? echo 'Write sudo password (will not be displayed) and hit enter' read -s password I need it to make commands like this: echo $password | sudo -S apt-get install -y foo bar
Sławosz
1

votes
3

answer
1.5k

Views

impossible to use npm as sudo with nvm

I have install node/npm using the nvm documentation. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash I then install it: nvm install stable and then I have to do: nvm use node npm is working but if I want to install a package globally it doesn't work. sudo npm inst...
BoumTAC
1

votes
1

answer
3.8k

Views

Regex in Sudoers File? [closed]

I've a regex and want to use it in a sudoers file. But I couldn't get it work. \/test\/([0-9a-zA-Z\/]+\.[0-9a-zA-Z]+)+ I found that it must be \\/test\\/([0-9a-zA-Z\/]+\.[0-9a-zA-Z]+)+ But I didn't know how to use the regex after /([... Can I use the plus for 1 to n? What must I escape? And how?
baeckerman83
3

votes
2

answer
6.2k

Views

make git clone with sudo

when I make git clone with ssh from a user prompt it works properly. git clone ssh://URL.com/soft.git soft_git the ssh key id_rsa and id_rsa.pub are under /home/user/.ssh my purpose is the execute git with sudo but I got the following error Cloning into '/home/user/git/soft'... Permission denied (p...
Anis_Stack
3

votes
1

answer
81

Views

sudo renice in python

Generically, this is a well answered question. Linux doesn't allow non-privileged users to lower a PID's niceness, and running things as root is its own can of worms. That said, here are my specifics: I've got a user account that manages a few processes which has passwordless sudo privileges for ren...
musasabi
16

votes
6

answer
13.8k

Views

Connect to mysql server without sudo

The command: mysql -u root -p gives the error: ERROR 1698 (28000): Access denied for user 'root'@'localhost' But running sudo privileges, works: sudo mysql -u root -p Is it possible to get rid of the sudo requirement because it prevents me from opening the database in intellij? I tried the followin...
2

votes
0

answer
364

Views

how to update node on AWS for sudo

I recently upgraded my node using nvm to the latest version 9.4.0. I was getting all sorts of errors when running using sudo. I realized the problem was the sudo was using a different version of node. node -v v9.4.0 sudo node -v v0.10.48 I am using AWS-EC2 for my backend. How can I update the sudo...
alionthego
17

votes
6

answer
9.3k

Views

X11: run a gnome app as another user

I have ubuntu + x11 + gnome. I want to run a graphical application as another user. However, when I start it from the command line using sudo -u otheruser app I get the error "No protocol specified". How can I work arround this?
flybywire
17

votes
3

answer
41.5k

Views

How to run SUDO command in WinSCP to transfer files from Windows to linux

I am trying to use WinSCP to transfer files over to a Linux Instance from Windows. Im using private key for my instance to login to Amazon instance using ec2-user. However ec2-user does not have access to write to the Linux instance How do i sudo su - to access the root directory and write to the...
PC2015
1

votes
1

answer
9.3k

Views

Run sudo command with password

sudo command can be used in the following way sudo -u But I want to know how to include password as I want to avoid the user interactivity. Also, as an Admin, I don't want to disable password prompt for sudo commands. How can I achieve this. I tried man sudo, but not of much help.
AlwaysALearner
1

votes
2

answer
1.6k

Views

Sudo not prompting for password Mac bash script

I am trying to write a script that appends a line to the /etc/hosts, which means I need sudoer privileges. However, if I run the script from the desktop it does not prompt for a password. I simply get permission denied. Example script: #!/bin/bash sudo echo '131.253.13.32 www.google.com' >>...
spassen
17

votes
1

answer
10.2k

Views

Fabric - sudo -u

I'm using fabric to launch a command on a remote server. I'd like to launch this command as a different user (neither the one connected nor root). def colstat(): run('python manage.py collectstatic --noinput') Trying def colstat(): sudo('-u www-data python manage.py collectstatic --noinput') Oviou...
Pierre de LESPINAY
4

votes
1

answer
5.1k

Views

How to setup a SUDO_ASKPASS environment variable?

What does setting up a SUDO_ASKPASS environment variable mean? How do you do it? Where do I declare it? I am trying to use a shell script to shutoff my computer after a couple of minutes and initiate this script with java.
user1700434
18

votes
2

answer
18.1k

Views

Setting up process.env variables using EXPORT while running node with sudo

I'm using node.js on EC2 I type EXPORT PORT=80 in terminal, and i see that it correctly saves it when i type EXPORT But when I run my node.js app with the following: ... console.log(process.env); ... PORT is not listed in the object when I'm running it with sudo: sudo node app.js How do I set PORT...
gotta have my pops
18

votes
1

answer
26.6k

Views

sudo mkdir in /usr/, Operation not permitted. El Capitan

Attempting to install PHP, which requires the creation of an extensions directory within /usr/lib/php/extensions. The installation returned an error "Operation not permitted". I have since found out, sudo is not able to create any directories under /usr/. Anyone else experienced this?
THEK
6

votes
4

answer
2.5k

Views

In Linux how to add a build step in Qt Creator that uses su privileges without getting the wrong password attempts on builds?

My goal is to successfully link a folder to /opt/ directory- which needs to be run with sudo. I have tried this: system(sudo ln -s $$OUT_PWD/xampp /opt/lampp):message("You should manually link LAMPP") But building from qt-creator it does not prompt for sudo password, therefore I couldn't get it to l...
Logan
1

votes
1

answer
1.7k

Views

Git Permission Denied

So I seem to have been a bit carless with sudo when trying to setup my git account was following a tutorial and this is what I entered 458 git credential-osxkeychain 459 curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain 460 git credential-osxkeychain 461 wh...
sonobenissimo
18

votes
3

answer
13.7k

Views

Capistrano is hanging when prompting for SUDO password to an Ubuntu box

I have a capistrano deployment recipe I've been using for some time to deploy my web app and then restart apache/nginx using the sudo command. Recently cap deploy is hanging when I try to execute these sudo commands. I see the output: "[sudo] password for " With my server name and the remote logi...
MikeN
18

votes
6

answer
15k

Views

sudo nohup nice <— in what order?

So I have a script that I want to run as root, without hangup and nicely. What order should I put the commands in? sudo nohup nice foo.bash & or nohup nice sudo foo.bash & etc. I suspect it doesn't matter but would like some insight from those who really know.
Jonah Braun

View additional questions