sudo

Opening Explorer shell with admin priveleges on XP (with IE7 installed)

I used to demote my user account so that it had no admin priveleges and used a 'sudo-like' trick where you create a shortcut to IE6 and enabled the 'Run with different credentials' option to open a shell window as local admin so I could install, uninstall things etc. When I upgraded to IE7 this stopped working - IE7 launches Windows Exp...

How do I use sudo to redirect output to a location I don't have permission to write to?

I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to. The trouble is, this contrived example doesn't work: sudo ls -hal /root/ > /root/test.out I just receive the response: -bash: /root/test.out: ...

Open a file with su/sudo inside Emacs

Suppose I want to open a file in an existing Emacs session using su or sudo, without dropping down to a shell and doing sudoedit or sudo emacs. One way to do this is (require 'tramp) C-c C-f /sudo::/path/to/file but this requires an expensive round-trip through SSH. Is there a more direct way? [EDIT] @JBB is right. I want to be able ...

PHP webpage doesn't launch unix command even after updated sudoers

Hi everyone, Basically I am trying to restart a service from a php web page. Here is the code: <?php exec ('/usr/bin/sudo /etc/init.d/portmap restart'); ?> But, in /var/log/httpd/error_log, I get unable to change to sudoers gid: Operation not permitted and in /var/log/messages, I get Sep 22 15:01:56 ri kernel: audit(12220...

Quickly check whether sudo permissions are available

I want to be able to quickly check whether I both have sudo access and my password is already authenticated. I'm not worried about having sudo access specifically for the operation I'm about to perform, but that would be a nice bonus. Specifically what I'm trying to use this for is a script that I want to be runnable by a range of users...

PHP - shell_execute -change user password

Hi, I need to be able to change the users' password through a web page (in a controlled environment). So, for that, I'm using this code: <?php $output = shell_exec("sudo -u dummy passwd testUser testUserPassword"); $output2 = shell_exec("dummyPassword"); echo $output; echo $output2; echo "done"; ?> My problem is that this script is n...

pass password to su/sudo/ssh

I'm writing a C/Shell program that will be doing su or sudo or ssh. They all want their passwords in consol input rather than stdin. Does anybody know a solution? Setting up password-less sudo is not an option. Expect could be an option, but it's not present on my stripped-down system. ...

sudo changes PATH - why?

This is the PATH variable without sudo: $ echo 'echo $PATH' | sh /opt/local/ruby/bin:/usr/bin:/bin This is the PATH variable with sudo: $echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin As far as I can tell, sudo is supposed to leave PATH untouched. What's going on? How do I ...

How do I edit /etc/sudoers from a script?

I need to edit /etc/sudoers from a script to add/remove stuff from white lists. Assuming I have a command that would work on a normal file, how could I apply it to .etc/sudoers? Can I copy and modify it, then have visudo replace the original with the modified copy? By providing my own script in EDITOR? Or can I just use the same locks...

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

Is there a way for non-root processes to bind to "privileged" ports (<1024) on Linux?

It's very annoying to have this limitation on my development box, when there won't ever be any users other than me. I'm aware of the standard workarounds, but none of them do exactly what I want: authbind (The version in Debian testing, 1.0, only supports IPv4) Using the iptables REDIRECT target to redirect a low port to a high port (...

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 login, but this is not a secure login promp...

How can I install Gitosis to my server without sudo access?

I am trying to follow these commands. I managed install Git to my server without sudo access. However, I need sudo access to add a new user: See this. It seems that Gitosis is very hard to install without sudo access. ...

running a command as a super user from a python script

Heyas So I'm trying to get a process to be run as a super user from within a python script using subprocess. In the ipython shell something like proc = subprocess.Popen('sudo apach2ctl restart', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) works fine, but as soon as I stick it into a script I st...

Run a linux system command as a superuser, using a python script

I have got postfix installed on my machine and I am updating virtual_alias on the fly programmatically(using python)(on some action). Once I update the entry in the /etc/postfix/virtual_alias, I am running the command:sudo /usr/sbin/postmap /etc/postfix/virtual_alias 2>>/work/postfix_valias_errorfileBut I am getting the error:sudo: sorry...

Unable to install Python without sudo access

I extracted, configured and used make for the installation package in my server. However, I could not use make install. I get the error [~/wepapps/python/Python-2.6.1]# make install /usr/bin/install -c python /usr/local/bin/python2.6 /usr/bin/install: cannot create regular file `/usr/local/bin/python2.6': Permission denied make: *** [a...

In Mac OSX 10.5, it can't find my Terminal commands sudo, find, etc.

I don't know what has happened, but in my Terminal on Mac OSX 10.5 it can no longer find my sudo command, or find command, etc. They are there because if I put /usr/bin/sudo or /usr/bin/find it works fine... My .bash_login file looks like this: export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin$PATH" My .bash_pro...

how do you make sudo save the password?

how do you set it so that sudo doesn't prompt you for your password every time? i have root. ...

changing search-dirs for $ sudo gcc

On OS X I'm trying to install the zlib prerequisite for haskell's Cabal. I get this error: $ sudo ./Setup build Preprocessing library zlib-0.5.0.0… ld: library not found for -lgmp collect2: ld returned 1 exit status linking dist/build/Codec/Compression/Zlib/Stream_hsc_make.o failed command was: /usr/bin/gcc -lz -L/sw/lib/ghc-6.8.3/lib/...

How can I have a PHP script run a shell script as root?

Running Fedora 9/10, Apache 2, PHP 5... Can I run a shell script as root, from a PHP script using exec()? Do I just give Apache root priveleges, and then add "sudo" in front of them command? Specifically, I'm trying to start and stop a background script. Currently I have a shell script that just runs the app, start.sh: #!/bin/bash ...