sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

11
votes
6answers
11k views

Is there a way to stop having to write 'sudo' for every little thing in Linux?

I'm a newbie when it comes to Linux. I do most of my development in a Windows environment. That said, I'm going to be doing a fair amount of PHP work shortly, and I'm interested in learning RoR, so ...
-1
votes
3answers
469 views

no root shell freely available sudoers policies

I want to prevent users who need escalated privileges from obtaining any kind of a root shell. However since there are many ways to attain this, and many non root commands ( like those found in ...
0
votes
0answers
297 views

Why do you need sudo for “sudo su root”? [duplicate]

Possible Duplicate: When do su and sudo use different passwords? Why do you need to use sudo su root ? Why won't it work to just use su root?
4
votes
1answer
2k views

sudo -u username -s “cmd arg” returns command not found

I used to execute the command: sudo -u elasticsearch -s "ulimit -Hn" and it was returning the value of ulimit -Hn as seen by user elasticsearch until I tried it on Ubuntu 11.10. There it returns: ...
7
votes
3answers
5k views

Why do some packages use 'make install' while other use 'sudo make install'

I recently installed LAME encoder on my server to convert wav to mp3 and that worked with './configure, make, make install; I then tried to install OGG encoder and that requires './configure, make, ...
4
votes
3answers
12k views

Bash Sudo Command Not Found

I have set up a VM using turnkey linux redmine and I'm trying to SSH into the server to install some more items. It doesn't appear to be recognizing the sudo command. Every time I try to sudo ...
7
votes
2answers
5k views

Why is sudo telling me my password is wrong?

I recently installed OpenBSD 4.9 in my computer, so I could learn a little bit about Unix-like operating systems. I added a new user to the system called bruno. Ok. When I use the 'sudo' command, it ...
2
votes
1answer
2k views

pass 1 environment variable using sudo

Is this a correct way for passing an environment variable in sudo ? sudo -u www-data -b env FOOBAR="foobar" /home/user/folder/daemon
0
votes
2answers
1k views

Run in root shell from within a user bash script

I have a script that , among other things, needs to do some stuff as root, like creating a mount folder. I tried: echo "Linux user password is needed in order to ..." sudo -s # also tried: # sudo su ...
3
votes
4answers
1k views

Detach a daemon using sudo?

I noticed that sudo continues to run after executing any of the following lines. Is there any way to detach the daemon completely so sudo does not continue running? sudo -u user daemon & sudo -u ...
7
votes
1answer
6k views

How to run a GUI program as a different user (Debian)?

Using a terminal, I can change the running user with su and sudo — but how can I do that by clicking on an icon/shortcut on the desktop/start menu? If I have to be root to execute I will be asked ...
1
vote
6answers
306 views

Minimize need for sudo

Very often I need to use the sudo command because the command I'm running needs higher privileges. Is there some method to minimize the usage of sudo and/or a way to use it that's faster than typing ...
2
votes
3answers
7k views

Difference between “make install” and “sudo make install”

Sometimes I encounter problems with using make install which gives me a permission denied error when writing to some folders. So instinctively I use sudo make install. Will this introduce additional ...
11
votes
3answers
10k views

Does mount always require root privileges?

I was under the impression that any sort of call to mount requires root privileges. But recently I was told "You should instead create appropriate entries in /etc/fstab so that the filesystems can be ...
2
votes
1answer
513 views

Default fedora 15 install, how do you get a network drive to mount after login?

I am running a default fedora 15 install. My goal is to have a couple of network drives get mounted right after the user logs in graphically (not via ssh). The script I want to execute is basically ...
1
vote
0answers
64 views

What is the difference between these two sudoers lines? [duplicate]

Possible Duplicate: What is the proper sudoers syntax to add a user? What is the difference between these two lines of /etc/sudoers: USERNAME ALL=NOPASSWD:ALL USERNAME ALL=(ALL) ...
4
votes
1answer
10k views

How do you get NOPASSWD sudo option to work in Fedora 15? [duplicate]

Possible Duplicate: How to run a specific program as root without a password prompt? I installed fedora 15. I use sudo visudo to modify sudoers file and add the following line: USERNAME ...
4
votes
2answers
376 views

Should I be using 'sudo' in scripts that I write?

I'm setting up a new machine (well actually, an Ubuntu VM) and am trying to write a script to setup a few common things that I use when doing this (Git, curl, vim + janus). So my script looks a bit ...
2
votes
4answers
631 views

sudo without password - security? [duplicate]

Possible Duplicate: What specific vulnerabilities am I creating by disabling the sudo password? I'm involved yet again in the old argument on whether sudo without password is secure enough ...
2
votes
2answers
1k views

When running sudo make install environment variables are not passed

I have problems with using pkg-config in a Makefile, while running in sudo mode. I need to have PKG_CONFIG_PATH set for pkg-config to find geany.pc file that is held in /usr/local/lib/pkgconfig. If I ...
7
votes
1answer
3k views

Why can't sudo redirect stdout to /etc/file, but sudo 'nano' or 'cp' can?

Why does redirection, using sudo give me an error for the following commands? $ sudo printf "foo" >/etc/file bash: /etc/file: Permission denied $ sudo printf "foo" ~/file; cat ~file ...
2
votes
4answers
350 views

sudo to remember password for list of commands?

Is there a way in Linux to make sudo command to remember the password the user entered for in the first of the lines? For example, for a list of commands that the user has to enter, the some of then ...
4
votes
2answers
939 views

Run Python Portio script as normal user without root access

I know there are risks running a root script as a normal user, but in this case I don't have a choice and what I am doing is machine related. I have an Small Board Computer that has GPIO ports and I ...
13
votes
2answers
5k views

What is the proper sudoers syntax to add a user?

According to the comments in /etc/sudoers (Fedora 13): ## Syntax: ## ## user MACHINE=COMMANDS ## ## The COMMANDS section may have other options added to it. My two related questions: What ...
28
votes
7answers
40k views

How to run a specific program as root without a password prompt?

I need to run something as sudo without a password, so I used visudo and added this to my sudoers file: MYUSERNAME ALL = NOPASSWD: /path/to/my/program Then I tried it out: $ sudo ...
1
vote
1answer
2k views

Are there any better/safer methods to launch the OpenVPN client as a normal user?

I'm trying to connect to an OpenVPN server. It works perfectly when I use root to give out the commands to connect: openvpn /etc/openvpn/client.conf but with a normal user I get this error messages ...
6
votes
4answers
2k views

Allow users to run only specific binaries with root permissions/privileges

I would like to allow a specific user to be able to sudo /sbin/iptables only. I have a bash script which configures iptables. The problem is that configuring /sbin/iptables as sudoable is not enough ...
9
votes
1answer
22k views

How to add a user to sudoers file?

I have an account named as Chankey (local user). I had to use some commands like viewing the shadow file etc. I tried it using sudo command sudo vim /etc/shadow It said: Chankey is not in ...
12
votes
2answers
2k views

How to safely pass variables to root-enabled scripts?

This question is totally general and not only applicable to my situation, but... I have a small busybox appliance where I want a non-root user to be able to execute a particular script with root ...
5
votes
4answers
1k views

How sudo/root-ness detection works

Programs that make changes system-wide require sudo unless I am already the root user. Now, the question is: how exactly does the system figure out that I am (not) root? Does it: Check to see if ...
2
votes
3answers
9k views

Why use `sudo yum install <pkgs>` when I can use `yum install <pkgs>`?

The above question can also be rephrased to, what is the use of the sudo command? man pages for sudo in the bash shell has the following description. sudo, sudoedit - execute a command as another ...
2
votes
0answers
812 views

Security of xhost (local) and sudo xauthority forwarding

Context: launch a GUI application as a linux service. I considered making a headless daemon with a GUI front-end but there is too much code involved to do it now. This service must start on user ...
6
votes
3answers
11k views

How to get back sudo on Ubuntu?

I have done this: sudo chown -R myname /usr/ and now I can't use the sudo command because of this error: sudo: must be setuid root And as I read this means that the owner of this file ...
2
votes
2answers
681 views

How do I reset ownership on /usr/bin/sudo on centOS? [closed]

I accidentlly changed ownership of /usr/bin/sudo to my current user (i also did this for some other stuff in my /usr directory). I can't change any of them back because I need ownership of ...
2
votes
3answers
5k views

Ways to execute shell command as root?

I'm developing an application that will run on an Amazon EC2 instance, and execute certain commands that require root access. The problem is that different VM's give root access in different ways. ...
1
vote
2answers
1k views

permission denied when executing a binary

I used these instructions to install mongodb on my OS X machine. I did not make the files owned by root though, I used my local user (markdsievers), and installed to /usr/local/mongodb and ...
8
votes
1answer
1k views

What is the difference between 'sudo' and 'su -c'

Is there any difference between using sudo and using su -c? There are situations where one should be used but not the other? I was previously using Ubuntu where sudo appears to be ubiquitous but now ...
2
votes
1answer
794 views

sulog with openSUSE 11.2 (x86_64)

I need to log as much as possible when users a doing su *... Best would be to log all commands especially for the case root does something as a user. We can assume root would not change this logging ...
10
votes
4answers
7k views

What environment do I get with sudo?

When I run sudo, what exactly happens to my environment? When I run sudo command, it doesn't seem to see my or root's environment. For example, my path for both includes /usr/local/bin, but if I try ...
4
votes
6answers
460 views

Any program like `sudo` to gain root by having two users enter a password?

I run a server which is used by a group of individuals for e-mail, mailing lists, personal web homes etc. I thought about ways to provide root access for other members to allow them handling problems ...
14
votes
1answer
1k views

What's the difference between sudo su - and sudo su --

When I am working on our RHEL machines, I use sudo su - to switch to being root. One day, a typo meant I typed sudo su -- instead - it seems to me that everything was the same as with a single hyphen, ...
2
votes
0answers
240 views

gksudo not caching credentials

I've built a shell script for mounting ISO images in Nautilus, and it worked fine in earlier versions of Ubuntu. One of the many problems encountered in 11.04 is that gksudo doesn't seem to cache the ...
1
vote
3answers
4k views

sudo does not allow me to run cp

Executing the following command on a CentOS 5 box: $ sudo cp file1 file2 gives me the following error: Sorry user my_username is not allowed to execute '/bin/cp file1 file2' as root on ...
12
votes
3answers
10k views

`/etc/sudoers` — specify `env_keep` for one command only?

Is there any way to specify that sudo should preserve certain environment variables for specified commands only? For some purposes I'd like my $HOME env. variable preserved when I run certain ...
4
votes
2answers
2k views

Centos: Adduser/Passwd/Sudoer Script

I'm currently running a VPS on CentOS. I have an application running in the background and it will run a script under sudo to either disable or enable any account. So what I'm trying to create is a ...
4
votes
3answers
303 views

Can I insert sudo via the ^ command?

Sorry if this is a yes/no question.. I am reading this unix tutorial and found the following: Repeating and Modifying the Previous Command [..] If you mistype leavenworth as leaveworth ...
2
votes
1answer
235 views

How do I make a certain command sudo-only on Debian?

What user and group should I chown it to? All admins are in 'admins' group. How do I chmod it?
17
votes
2answers
6k views

Is it possible to save as sudo from nano after you've forgotten to run as sudo?

A lot of the time I edit a file with nano, try to save and get a permission error because I forgot to run it as sudo. Is there some quick way I can become sudo without having to re-open and re-edit ...
4
votes
2answers
501 views

Sudo no longer available and users can't install or modify most files

I recently started messing with some files on a virtual hosted machine and I was logged in a normal/non-root user. At first everything was fine, I was able to install anything I needed using: sudo ...
4
votes
1answer
701 views

How to get the name of the user that launched `sudo`

My problem: I have a Python program, and the user launch it using sudo. Sometimes I have to get the user's home, and I can do this only knowing its name: import pwd pwd.getpwnam(username) So: how ...