sudo

Zipping files through shell_exec in PHP: problem with paths.

I'm working on a web backup service part of which allows the user to download a zip file containing the files they have selected from a list of what they have backed up. The zipping process is done via a shell_exec command. For this to work I have given the apache user no-password sudo privileges to the zip command. My problem is, sin...

Admin privileges for script

Hello, how can i check admin-privileges for my script during running? ...

Why does running "apachectl -k start" not work, but "sudo apachectl -k start" does?

I'm working on my OS X with the default installation of Apache. For some reason, when I run the "apachectl" command without the "sudo" I get "no listening sockets available / unable to open logs." I'm guessing this is a permissioning thing, so can someone help me out? I'm using Apache 2.2. Also, side question, where the the Apache sc...

Run a Python project in Eclipse as root

Hi, I use Eclipse as my IDE, and when I run my application I wish the application itself to run as root. My program currently checks if it is root, and if not it restarts itself with gksudo. The output, however, isn't written to the console. I can't use sudo, since it doesn't give me a graphical prompt. (While my program is CLI, Eclipse...

sudo using PATH ahead of fully qualified executable

I ran into a problem that I've never seen before and can't exactly explain. I was helping someone run a perl based install on a RedHad 4.6 zLinux and running under sudo seemed to grab the system perl rather than the fully qualified perl executable. Example: /my/perl/bin> ./perl -v == 5.8.8 /my/perl/bin> /my/perl/bin/perl -v == 5.8.8 /...

Eclipse-CDT: How do I handle permission denied errors opening sockets?

My program opens a socket on port 80, but if I don't run it as root (with sudo) then it fails to open the socket with a permission error. This means my application doesn't work when I launch it in the debugger. So: Can I tell Eclipse-CDT somehow to launch the app using sudo? Or, can I somehow enable my program to have permission to o...

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

How to call Apple Authorization API from PyQt4

I am currently working on a PyQt4 app which requires administrator privileges to access some files. I would like it to follow Apple guidelines and open the Authenticate Dialog to prompt the user to input their password in order to perform administrator tasks. I have already looked into MacPython Authorization package, but it seems a bit...

How do I sudo environment?

I am using spamassassin in a php script, but when I train spamassassin as my user the php script's exec command to call spamassassin get the untrained version because of the user specific nature of sa-learn. So I need to sudo to my user in the exec command and get the environment of my user along with the premissions ...

To copy files each minute at /var/www without sudo

How can you copy a folder to /var/www without sudo? My folder codes has the following permissions at /var/www 4 drwxr-xr-x 8 root root 4096 2009-08-09 03:01 codes I can only sudo cp -r ~/Dropbox/codes/ /var/www to copy the files. I cannot copy them without sudo. ...

How do I run a command as a different user from a root cronjob?

I seem to be stuck between an NFS limitation and a Cron limitation. So I've got root cron (on RHEL5) running a shell script that, among other things, needs to rsync some files over an NFS mount. And the files on the NFS mount are owned by the apache user with mode 700, so only the apache user can run the rsync command -- running as root...

Vim: sudo errors in writing a selection

How can I circumvent the errors, such as E212 and E13, in the commands? :'a,'bw set_question_tags.php :'a,'bw >> set_question_tags.php In some cases, even with Pavel's command: "create_a_file_and_save.php" E212: Can't open file for writing ...

Running SH script with sudo for PHPdoc

How can you run the following script in generating docs by PHPdoc? #1 sudo -code sudo source makedoc.sh I get no command source #2 without sudo The problem is that sudo does not have the command source. I tried to fix the problem unsuccessfully by changing the persmissions of ~/phpdoc/phpdoc to 777 and then running source makedo...

Using Git without Sudo in many accounts

How can you use Git without Sudo in multiple accounts in one Ubuntu? My Ubuntu has many accounts. The creation of new accounts has made Git inaccessible by me without sudo. I changed the owner to be me, masi, and the group to be admin where the masi belongs to. I have the following permissions for Git 800 -rwxrwxrwx 1 masi admin 81374...

Opening/Writing files as administrator/root using C++ (UAC/gksudo/etc.)

The application I'm working on requires the ability to edit certain protected files across Linux, OSX, and Windows [Vista]. Generally, when an application needs to do something with elevated privileges, a password request dialog appears asking the user to verify they want to allow the application to perform those operations as an admini...

How to permanently change sudo's $PATH variable (Ubuntu 9.x)

I want add some directory to the $PATH when running sudo, this is a (semi) permanent requirement, not something that needs to be added to the scripts themselves. I notice that Django has managed to do it, (my $PATH when running sudo is "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/django/django-trunk/djang...

Capistrano :shell example

Hello experts. I'm currently using Capistrano to deploy my web application which works like a charm. In my new project I must execute a command from sudo /bin/bash shell. Is it possible for Capistrano to login to the machine as user X, run sudo /bin/bash, enter the password and then execute a command in the sudo shell? If yes, could yo...

Getting $USER inside shell script when running with sudo ?

Hi, 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 inelegant method would be to extract the name from the home path, but I wonder if there ...

How to execute os.* methods as root?

Is it possible to ask for a root pw without storing in in my script memory and to run some of os.* commands as root? My script scans some folders and files to check if it can do the job makes some changes in /etc/... creates a folder and files that should be owned by the user who ran the script (1) can be done as a normal user. I ca...

How to sudo on a computer using ssh inside a bash script

I'm trying to run a bash script that has: ssh -l <username> <compname> 'sudo yum -y install expect' I get the error: sudo: sorry, you must have a tty to run sudo on some computers but on others the process runs smooth. How can I prevent this? ...