FAQ Database Discussion Community


Anaconda python not available from sudo

python,linux,sudo,anaconda
I installed Anaconda in a Google Cloud Compute environment and can use it successfully from the shell as a normal user: [email protected]:~$ 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 4.4.7-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information....

Call 'sudo make install' from gvim

vim,makefile,install,sudo
I am developing a program which has a fairly standard looking Makefile like the one below. .PHONY=default install hello: hello.o install: hello cp hello /usr/local/bin This example Makefile builds a program called hello from a file called hello.c and has an installation rule to install it to a directory which...

How do I run only some makefile commands as root?

c,makefile,make,install,sudo
I have an install target in my Makefile and wish to run some commands that install shared libraries(requires root permissions) and some that install config files into $HOME/.config Usually I'd just tell the user to run sudo make install, however that results in the config file being installed to /root/.config...

getenv(“HOME”) returns “/root” with “sudo”

c++,raspberry-pi,root,sudo,getenv
I'm writing a program on my Raspberry Pi that requires the function "getenv("HOME")" to locate "/home/pi". However, since I'm using the "wiringPi" library that requires "sudo" to run, "getenv("HOME")" now returns "/root" as the HOME directory instead of "/home/pi". Is there a way to locate "/home/pi" with "getenv("HOME")" while using...

Run a command with sudo in bash shell

shell,cron,sudo
How can i run a command in shell script with sudo? This script will be run by a cron job, so there should be no human intervention to enter a password manually.

sh error trying to mount: command not found [duplicate]

bash,raspberry-pi,sudo,mount
This question already has an answer here: mkdir command not found in bash script 2 answers I'm trying to make a script to mount a disk when runned. The script is #!/bin/bash PATH=$(python /home/pi/prova.py 2>1&) sudo mount $PATH /media/Drive1 where path in our case is /dev/sda1 (checked using echo)....

Run command sudo bash with WinSCP .NET assembly

.net,ssh,sudo,winscp,winscp-net
I am trying to run command sudo bash using VB.NET and WinSCP. I am using this code: Try Dim mySessionOptions As New SessionOptions With mySessionOptions .Protocol = Protocol.Sftp .HostName = "10.5...." .UserName = "hereGoesUsername" .Password = "hereGoesPassword" .SshHostKeyFingerprint = "ssh-rsa 2048 ......" End With mySession.Open(mySessionOptions) Try mySession.ExecuteCommand("sudo bash").Check() Last line...

How Do I Execute a sudo command in a Shell Script?

bash,shell,passwords,sudo
I am using the LaunchD Task Scheduler app to schedule jobs on my Mac Mini. I would like to execute the purge command every two hours so I won't have to remember to do this in the terminal. I have to run this using the sudo command. I want to...

Adding “sudo” before a command makes the command unknown

python,linux,root,redhat,sudo
This is a linux problem that's been stumping me for a while. On my work linux box (running RedHat) I was trying to install some Python packages. However, some funny business is occurring, see below: This is my objective and first command pip install scrapylib This creates a 'Permission Denied'...

Vim opens some files in readonly mode by default even when use sudo

vim,sudo
I have weird issue with vim - for some files it doesn't color the syntax and opens it readonly mode by default, even if I use sudo. chmod for this file are 664, I am also owner of this file, so normally i shouldn't. I have no set ro in...

Why can user vagrant do “sudo su -” without entering password?

vagrant,sudo
I am a new student about vagrant. I just found that I can change to root by "sudo su -" without entering a password when inside the box supervised by Vagrant. Curiously I checked the "/etc/sudoers" and found nothing about user vagrant. Can anyone kindly explain this?

Difference between `sudo su` and `sudo fish`

shell,ubuntu,root,sudo,fish
I am running fish (Friendly Interactive Shell) as my standard terminal in Ubuntu 14.04, rather than bash. I noticed the following behaviour and don't know, if any of these are the preferred one to gain root access. I can type the command sudo su or sudo fish and it will...

Is there a way to 'store' Sudo temporarily

linux,terminal,passwords,redhat,sudo
I'm quite new to Linux. I remember using a tutorial were you were able to declare your sudo (+password) at the start and then use terminal without having to do sudo or import your password again. I.e. Sudo yum-get update -> yum-get update. Sorry if this is a very obvious...

How to get XDG variables with sudo?

linux,sudo
I need to retrieve $XDG_CONFIG_HOME, $XDG_RUNTIME_DIR and $XDG_DATA_HOME of all users. I try with: sudo -Eiu user printenv | grep XDG_CONFIG_HOME But I get nothing. If I log on with the user account, the simple command: printenv | grep XDG_CONFIG_HOME Works fine. How do I?...

Is there an App store entitlement for NSAppleScript(source: “do shell script \”sudo" commands?

swift,sudo,mac-app-store,appstore-sandbox,nsapplescript
For example, my app uses the following command with the OS handling a pop up alert to request the admin password to authenticate as root. Is there an entitlement that will allow me run this from within the sandbox ? @IBAction func clearFonts(sender: NSButton) { NSAppleScript(source: "do shell script \"sudo...

Bash dropping out of sudo in a script

bash,sudo
I need to execute an install script using sudo, but towards the end of the script, the script needs to drop out of sudo and continue as the regular user. Example: sudo ./install.sh script runs and does what it needs to as root su myscriptuser service myscript start Basically, the...

how to do multiple serch in installed RPM packages?

linux,bash,package,redhat,sudo
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 ...

Shell script getting superuser privilege without being run as sudo

linux,bash,shell,permissions,sudo
Here is my script: script.sh: sudo cat /etc/passwd- If I am in a sudo session (eg I ran an other command with sudo a few minutes ago), and now run script.sh The script will get sudo access. However if I run cat /etc/passwd-/, I will get a permission denied error....

SSSD and sudo: mismatch between sudoHost and server hostname

linux,ldap,sudo,centos6
I'm running SSSD/LDAP on CentOS6 to authenticate users and I've configured it also to get SUDO information from the LDAP server. If I run hostname on my server I get: [[email protected] ~]# hostname myserver I configured sssd.conf with a search base, for example: ldap_sudo_search_base = OU=Staff,OU=SUDOers,ou=company,dc=my,dc=com Users who have SUDO...

Postgres database setup on Cloud9 asks for sudo password

postgresql,sudo,psql,cloud9-ide
So I'm using the Cloud9 ide to collaborate on a Node.js project. We are using Postgresql for the database, and the documentation for Postgres seems to make it quite simple. I can sudo service postgresql start without a problem but I can't sudo -u postgres psql without it asking for...

How to install a gem globally without sudo using rbenv?

ruby,gem,sudo,rbenv
I am using rbenv and I am trying to install sass without success. So, I installed rbenv via Homebrew, then Ruby 2.2 (rbenv install 2.2) and finally gem install sass, but I was unable to make sass available on my $PATH. Short on time, I sudo gem install sass using...

Fabric sudo() not respecting env.password

python,sudo,fabric
I'm trying to prefill env.password using --initial-password-prompt, but remote is throwing back some strangeness. Let's say that I'm trying to cat a root-owned file as testuser, with 600 permissions on the file. I'm calling sudo('cat /home/testuser/test.txt'), and getting this back: [[email protected]] sudo: cat /home/testuser/test.txt [[email protected]] out: cat: /home/testuser/test.txt: Permission denied...

Unable to run any command on mac terminal

osx,unix,sudo
I have changed by mistake the mode of /usr to 644 on my mac from terminal so now non of my process is accessible. I can't use sudo and I am unable to find any way to login as root user so I will be able to change /usr's mode...

Check if Qt c++ application is running as sudo [duplicate]

c++,linux,qt,raspberry-pi,sudo
This question already has an answer here: How can my C/C++ application determine if the root user is executing the command? 4 answers I have a Qt GUI application that must be ran as sudo. Right now, I have a script that they are supposed to execute to start...

Qt Session management error with matplotlib.pyplot.plot

qt,unix,matplotlib,permissions,sudo
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 and host-based authentication failed This error does not interrupt the function; the plot is...

Macports' dropping of privileges causing Xcode licence problems

xcode,licensing,sudo,macports,privileges
I am trying to install some ports using Macports on OS X but as soon as the installation tries to invoke the C compiler I get: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. Context: I have run sudo xcodebuild -license and successfully agreed...

Python ImportError: no module named os

python,pip,sudo,importerror,easy-install
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....

Bash: sourcing file as user from script

linux,bash,user,source,sudo
I am creating a script meant to be run as superuser that reads a file and runs a number of scripts on behalf of all users. The important bit is this: sudo -u $user -H source /home/$user/list_of_commands However, whether I encose the command with quotesor not, this fails with: sudo:...