sudo

How to use SSH and SUDO together with TRAMP in Emacs

I want to open a file using sudo (say, /etc/hosts) on a remote machine connected by ssh using TRAMP on Emacs. I tried couple of options, but none of them worked. Can anybody tell me how to go about it? Thank you ...

identify user in a bash script called by sudo

Hello, If I create the script /root/bin/whoami.sh conatining: #!/bin/bash whoami And this script is called by a user with a properly configured sudo, it will indicate root Is there a fast way to obtain the actual user in a script, or will I have to resort to parameters passing along this username? TIA, Bert ...

How to give permission using NSTask - objective-c

I need to basically do a "sudo" but, I need to give that kind of permission to my NSTask code. Is this possible? Thanks, Elijah ...

sh/expect/sudo/screen all needed together in one command.

What I need to have happen: PHP needs to launch an server app which has root permissions running in the background. All of this should be silent. -Sudo is needed to allow php to perform an op that requires root permissions. -Screen is required to allow the app to run outside the scope of the webpage which started the process. -Expect ...

unable to install gems using `sudo`

I have just setup a new Ubuntu 10.04 PC and am trying to install some gems. gerhard@superserver:~$ sudo gem install rake ERROR: http://gems.rubyforge.org/ does not appear to be a repository ERROR: could not find gem rake locally or in a repository gerhard@superserver:~$ I thought it was because my HTTP_PROXY was set incorrectly (I a...

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 ...

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 executes without prompting for a password. When I try to run the same command via Fabric's ...

when we need use sudo python xxx.py or just python xxx.py or xxx.py

I have write a website,what confused me is when i run the website,first i need start the the app, so there are 3 ways: sudo python xxx.py python xxx.py xxx.py I didn't clear with how to use each of them,the NO.3 method currently in my computer dosen't work well ...

Linux - killing some processes owned by apache safely

Hi all. I have a bunch of processes owned by apache that are running for days because they are stuck. apache 11173 0.1 0.0 228248 27744 ? Ss Sep27 3:58 php /var/www/html/myproj/symfony cron:aggregation --env=prod apache 12609 0.1 0.0 228244 27744 ? Ss Sep18 19:30 php /var/www/html/myproj/symfony cron:aggr...

Starting and Stopping Apache with sudo

I can run apachectl fine as a regular user, but when I sudo apachectl, I get sudo: apachectl: command not found. Any thoughts? I have the apache /bin directory in my path. ...

Can't execute ssh from php

Hi Everyone, I can't seem to execute the ssh command from any of the PHP functions like exec, system, passthru etc.. I've even tried /bin/ssh however no output is displayed Any ideas? I can confirm that by doing "su - www-data" and then trying ssh works, meaning that the apache user has access to ssh.. Thanks Update: Sorry everythin...

su and sudo in a shell script

There is a shell script (/bin/sh, not bash) that requires root permissions for execution. If it is ran by a normal user it should ask user a password to get root access and re-run itself. Now it uses the following code: if [ $(id -u) -ne 0 ]; then su root -- $0 $@ ; ... fi That works fine, but there are some OS like Ubuntu that has n...

Sudo - is there a command to check if I have sudo and/or how much time is left?

See title. I want a command that lets me query sudo. Ideally it would return success if I still have sudo and false if sudo has expired. Getting the time left might also be useful (although if I was concerned I could just do sudo -v to revalidate.) Oh and it shouldn't have to ask for a password. The closest thing I've found is "su...

How can I run a Perl script as root yet still affect user gconf settings

THE NEW QUERY: I am trying to make a unified script that initializes a new Ubuntu install to my liking, it must be run under sudo to install packages, but using gconftool-2 to affect gconf setting relies on the dbus session which is not handled properly by the method of simply changing UID in the script alone. Does someone know how to ma...

python fabric run command how to abort

run("if [ -d data.bak ];then mv data.bak data;fi;") sudo('....') sudo('') i use fabric deploy my project to web,and i want to find a way to didn't do the left command,if didn't find data.bak directory,so is there some way to achieve this on fabric ...

Bash scripts requiring sudo password

Hi, 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. Currently the user gets asked for the password whenever the first sudo command is ...

How to use NSTask as root?

In an application I'm making I need to run the following command as root (user will be prompted trice if they really want to, and they will be asked to unmount their drives) using NSTask: /bin/rm -rf / #Yes, really The problem is that simply using Substitute User Do (sudo) doesn't work as the user needs to enter the password to the no...