sudo

What does errno=13 mean when connecting via OpenVPN?

The tail-end of an OpenVPN connection (that otherwise appears successful) says (with leading timestamps omitted): Note: Cannot open TUN/TAP dev /dev/net/tun: Permission denied (errno=13) Note: Attempting fallback to kernel 2.2 TUN/TAP interface Cannot allocate TUN/TAP dev dynamically Exiting What is the problem here? ...

How to execute shell script via sudo user...

Hi All, I am new to shell scripting.... Can someone give an example of running shellscript via sudo user... I tried like this.... sudo /usr/local/sbin/deploy | ./tmp/cp1.sh the above script is executed as a normal user not as the sudo user... Any help is apprciated,... With Regards, Ramesh.T ...

Get netbeans to run my project with sudo?

I am working on a project in netbeans that requires the running project to have root privileges. I would like it so that each time I push "Run Project" (F6) my project is run as root, so with the equivalent of "gksudo javac Main", as it is has a GUI. One option is to start netbeans with root privileges, easily done by editing the short...

sudo rake with parameters

Is: sudo rake install -- --with-mysql-dir=/usr/local/mysql/ a valid terminal command? I try to run this but it doesn't seem to pass in the variable correctly.. However something like this works fine: sudo gem install do_mysql -- --with-mysql-dir=/usr/local/mysql/ ...

svn changes my files names

I'm using command line SVN 1.6.5 on my Ubuntu 9.10. This is my first time using it on the latest Ubuntu, I found svn confused about file names. The problem was as follow: I firstly used sudo svn co http://my-repository/h2m h2m after successfully checkout these files, I immediately used svn st and found dean@notebook:~/FAT32/h2m$ s...

pydev disappeared when sudo eclipse

pydev disappeared when sudo eclipse I am trying to run py script with root power within eclipse. So I started eclipse as 'sudo eclipse'. But then pydev plugin dispeared. The CDT plugin seemed to be OK. I installed eclipse from Ubuntu repository and pydev using eclipse 's installation manager under my user account. Pydev is working fin...

How can I avoid sudo-ing when installing Perl modules with cpan?

I have installed Perl from source into /usr/local, and adjusted my path accordingly, following brian d foy's suggestion here. I'm sure I'm missing something, but, now I'm trying to install stuff with the 'cpan' command and it's failing because it can't write to /usr/local. I have to use sudo, which feels wrong to me. Should CPAN stuff g...

Write shell script that can only be run by a sudo user in Ubuntu

I'm writing a shell script that is supposed to be run by users only in sudo user list, what's the appropriate way of doing this? what I'm thinking is in the shell script, try to create a dummy file in system dir such as /var/run/ and remove it, so users not in sudo list will receive a permission error, but I believe there gotta be a mo...

Using sudo commands in Cocoa and Objective-C?

What is the proper way to run something like $sudo touch folder_name or $sudo rm from within Objective-C/Cocoa? I'm changing and moving around a few files and need elevated privileges. Any code sample would be greatly appreciated. Thanks. ...

Open file via SSH and Sudo with Emacs

I want to open a file inside Emacs which is located on a remote server, with sudo powers on the server. I can open local files with sudo via Tramp like this: C-x C-f /sudo::/home/user/file But I want to use sudo on the server: C-x C-f /sudo::user@server/home/user/file But this gives me sudo powers on my local machine, it asks for m...

Most reliable way to identify the current user through a sudo

I have an application that may or may not be run while users are sudo'ed to a shared user account. I would like to reliably identify who the real user is for a sort of "honor-system" ACL. I think there's some way by tracing parent/group/session process ids the way that the pstree command does, but I'm not sure how to do that best or if...

PHP shell_exec() and sudo: must be setuid root

I have a shell_exec() command that accesses a directory above my document root so I need to use sudo "as root" to make it happen. (I understand the security issues and am putitng in measures to address it). The issue is when I run the shell_exec() I get a "sudo: must be setuid root" error in my apache error_log file. I thought the solu...

Python in SU cron gives different output than manually execution

Ubuntu Server 9.10, Here is my file, test.py import commands blkid = commands.getoutput('blkid') print blkid When I manually run (as SU) this: python test.py I get the output of the blkid as expected: /dev/sda1: UUID="3f0ac5bb-f0da-4574-81f5-77844530b561" TYPE="ext4" /dev/sda5: UUID="67df0e7c-74fb-47dd-8520-ad720fbed67d" TYPE="swa...

Calling ejabberdctl from PHP

I am working on a php social network that requires us to create XMPP accounts for all new members. I have a working Ejabberd server running with mod_admin_extra all working fine. I am trying to call ejabberdctl from a php file like so: exec('sudo /home/user/ejabberd-2.1.2/bin/ejabberdctl register test server pass 2>&1'); but i get t...

How can I prevent default_environment variables from getting set by Capistrano's sudo action?

My deploy.rb sets some environment variables to use the regular user's local Ruby rather than the system-wide one. set :default_environment, { :PATH => '/home/myapp/.rvm/bin:/home/myapp/.rvm/bin:/home/myapp/.rvm/rubies/ruby-1.9.1-p378/bin:/home/myapp/.rvm/gems/ruby-1.9.1-p378/bin:/home/myapp/.rvm/gems/ruby-1.9.1-p378%global/bin:/home/...

Script doesn't work when executed with sudo

Linux bash script: function Print() { echo $1 } Print "OK" This script runs successfully, when executed directly, and gives an error running with sudo: alex@alex-linux:~/tmp$ ./sample-script OK alex@alex-linux:~/tmp$ sudo ./sample-script [sudo] password for alex: ./sample-script: 1: Syntax error: "(" unexpected Why? ...

How do I run a sudo command in Emacs?

I'm trying to create shortcut keys for some commonly used sudo shell commands (for example, having C-c s run (shell-command "sudo /etc/init.d/apache2 restart")). I tried using a straight-up shell-command call as above, but it just outputs the following to the *Shell Command Output* buffer: [sudo] password for Inaimathi: Sorry, try agai...

Ant build.xml requires user input, but Eclipse has no tty

I'm trying to better integrate Eclipse with my build.xml. My build file calls GNU Make for the native portion of the program, and the Makefile uses sudo to movethe compiled libs into system path. Unfortunately that requires entering a password, and Eclipse's terminal doesn't accept user input. So the result from running the build in ecli...

How do I run my application as superuser from Eclipse?

I'm running in to an error when I try to run my server application from Eclipse. The error is java.net.BindException: Permission denied. I think this is because I am using port 443 to set up an SSL connection. I can get around this problem if I run my code on the command line using java and sudo. Is there a way to set up Eclipse so that ...

How does the vim "write with sudo" trick work?

Many of you have probably seen the command that allows you to write on a file that needs root permission, even when you forgot to open vim with sudo: :w !sudo tee % The thing is that I don't get what is exactly happening here. I have already figured this: w is for this *:w_c* *...