The sudo command is a program for some Unix and Unix-Like operating systems, that allows a user to execute programs with the security privileges of another user. Typically those of a superuser or the root user.

learn more… | top users | synonyms

67
votes
2answers
14k views

How to append to a file as sudo? [duplicate]

Possible Duplicate: sudo unable to write to /etc/profile I want to do: echo "something" >> /etc/config_file But, since only the root user has write permission to this file, I can't ...
48
votes
9answers
62k views

sudo with password in one command line?

On busy days, I'd like to run $ ./configure && make && sudo make install && halt on the night and go to bed, hoping the application would automatically be installed. But ...
35
votes
3answers
23k views

Why won't “sudo cd” work?

Why typing sudo cd whatever won't change the directory?
31
votes
6answers
27k views

scp to remote server with sudo

I have a file on server A (which is behind a NAT so not directly addressable). The file needs to be copied to server B in a directory restricted to root. I have an account on server B with sudo ...
30
votes
2answers
5k views

What does the command “sudo !!” mean?

I saw the command sudo !! in a video. What does this mean?
30
votes
2answers
34k views

SSH: execute sudo command

I have an interactive shell script, that at one place needs to ssh to another machine (Ubuntu based) and execute something as root (the user should enter his password, but the remote command should ...
27
votes
3answers
47k views

How do I make sudo preserve my environment variables?

Using sudo 1.7.4p4 on Solaris 5.10 and sudo 1.6.7p5 on RHEL4 u6 I can't see how to preserve my environment variables, for instance $PYTHONPATH. I've added this line to sudoers, but it doesn't make any ...
24
votes
5answers
3k views

Sudo vs root; any actual differences?

I'm working with a support member for a product, and he insists that I need to be root to install a series of patches, and that sudo won't work; he doesn't provide a reason but seems very firm in his ...
23
votes
3answers
2k views

Sudo su vs su linux

If I enter in the password to su when prompted, it doesnt work while sudo su does. Also, when a command is executed using sudo (command), does sudo automatically execute it by root by default (since ...
23
votes
4answers
74k views

How can I add a regular user to the sudoers file?

How can I add more users to the "sudoers" file?
22
votes
3answers
53k views

Command: sudo su -

I understand what su - does logs you into root with the root environment (as opposed to su which logs you into root with your environment) And I understand what sudo does you are root for one ...
18
votes
8answers
7k views

VIM: “sudo vim bad_idea”?

An irc-user in #Vim urged me not to use Sudo with Vim like: sudo vim bad_idea When I am doing things in locations such as /var/www/, I cannot write without it. So not-using sudo becomes a problem. ...
18
votes
2answers
3k views

Make sudo ask for my password again?

Is there any way to make sudo forget my password instantly instead of remembering it for 5 minutes?
18
votes
4answers
4k views

sudo keeps asking me for my password in fish shell

sudo in Ubuntu keeps asking me for my password for every command. Previously, I only had to enter the password once, and then it would be remembered for a period of time. This recently changed, ...
17
votes
9answers
14k views

What's the difference between the commands “su -s” and “sudo -s”?

What is the difference between the two super user commands, su -s and sudo -s? They both give a shell with access to the superuser account.
17
votes
8answers
81k views

User not in the sudoers file. This incident will be reported

I need to install a package. For that I need root access. However the system says that I am not in sudoers file. When trying to edit one, it complains alike! How am I supposed to add myself to the ...
16
votes
9answers
43k views

Opening Explorer shell with admin privileges 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 ...
16
votes
4answers
5k views

How to prevent sudo users from running specific commands?

I have a very sensitive network setup and I really dont want to mess up with it. My network consists a bunch of users who are with sudo privilege. I want to stop them from running service ...
16
votes
2answers
9k views

fine-grained sudoers configuration (allowed commandline arguments)

is there a straight-forward way to allow a user to run (for example) /usr/bin/pacman -S -u as root, without allowing him to run /usr/bin/pacman -S -u some_package ? The line user ALL=(root) ...
16
votes
4answers
15k views

Run rsync with root permission on remote machine

I want to sync a folder from my machine with a folder on a remote machine. The remote folder can only be manipulated by root. I have an account on the remote machine which can use sudo. How can I run ...
15
votes
7answers
13k views

How to kill a process started with a different user without being root or sudoer?

in a Linux environment, I need to kill a process which has been started by user2 if I am user1 without being sudoers or using root. Do you know if there is a way of setting that when launching the ...
14
votes
2answers
441 views

killall shenanigans

So I was sitting around wondering what would happen if I typed: sudo killall -u root ...aaaaaand now the OS will not load. How do I fix this without just doing a reinstall? I'm not super worried ...
13
votes
3answers
12k views

UNIX - mount: only root can do that

I need to allow a non-root user to mount/unmount a device. I am a total noob when it comes to UNIX, so please dumb it down for me. I've been looking all over teh interwebz to find an answer and it ...
12
votes
2answers
3k views

Keeping the fancy sudo warning forever

The first time I do sudo on openSUSE I'm always warned with a someway fancy message We trust you have received the usual lecture from the local System Administrator. It usually boils down to these ...
12
votes
1answer
13k views

sorry, you must have a tty to run sudo

I had already asked this question in Stack Overflow, but I've been asked to post it here. So doing the same. I ran this command using my java program- sudo -u <username> -S pwd I got this ...
11
votes
4answers
12k views

sudo vs gksudo. difference?

What's difference between sudo and gksudo?
11
votes
3answers
29k views

How to check if I have sudo access?

I recently got into trouble because of this. $sudo vim /etc/motd [sudo] password for bruce: bruce is not in the sudoers file. This incident will be reported. Is there a way to check if I have ...
11
votes
4answers
7k views

How do I make sudo ask for the root password?

When I run sudo as a normal unprivileged user, it asks for my password, not the root password. That's often convenient, but it reduces the amount of information someone would have to have in order to ...
10
votes
5answers
3k views

sudo unable to write to /etc/profile

I am following the instructions on this site for Grails installation, but am not able to write to /etc/profile like it instructs. sudo echo ‘JAVA_HOME=/usr/lib/jvm/java-6-sun’ >> /etc/profile ...
10
votes
4answers
5k views

How I can make sudo session an hour and not few minutes in Ubuntu 10.04?

How I can make sudo Ubuntu 10.04 session an hour and not few minutes? Now I have to write my password for sudo commands every few minutes.
10
votes
5answers
7k views

Running docker as sudo

I installed boot2docker and the i run ./boot2docker start export DOCKER_HOST=tcp://localhost:4243 so i started the tutorial from their docker site. I don't understand one thing: when i run ...
10
votes
4answers
13k views

Passing PATH through sudo

In short: how to make sudo not to flush PATH everytime? I have some websites deployed on my server (Debian testing) written with Ruby on Rails. I use Mongrel+Nginx to host them, but there is one ...
10
votes
4answers
3k views

How can I properly set sudo/visudo's editor?

I am using Ubuntu 10.04 Server and trying to set up sudoers to respect a user's EDITOR choice (within limits) In my sudoers I have: Defaults editor=/usr/bin/nano:/usr/bin/vim Defaults ...
9
votes
5answers
3k views

Why does “sudo -u root echo `whoami`” not return root?

How do you use sudo to run a command as the actual root user on Ubuntu? I originally thought this was the default behavior of sudo, until I ran: myuser@localhost:~$ sudo echo `whoami` myuser ...
9
votes
4answers
16k views

How to make Shared Keys .ssh/authorized_keys and sudo work together?

I've setup the .ssh/authorized_keys and am able to login with the new "user" using the pub/private key ... I have also added "user" to the sudoers list ... the problem I have now is when I try to ...
9
votes
2answers
2k views

I need sudo without password prompt, for scripts. Where did I go wrong?

I am in sudo group all right: $ id uid=1002(molot) gid=1002(molot) groups=1002(molot),27(sudo),33(www-data) In my sudores I seem to have appropriate setting: sudo ALL=(ALL:ALL) NOPASSWD: ALL ...
9
votes
5answers
12k views

sudo access for desktop actions in Gnome/KDE?

I feel kinda silly asking this question. I'm using CentOS 5.4 and KDE. I downloaded an archive and I want to drag/drop the contents into a folder that I need root access to write to. I can obviously ...
8
votes
2answers
899 views

Why is sudo required to start up a webserver on a given ip:port?

I'm setting up a Python-based webserver on my Debian box. Setup: The Debian OS is VM based, but I've switched the VirtualBox from NAT to Bridged. IP of the VM setup = 192.168.1.7 (per my router's ...
8
votes
5answers
5k views

How do I tell sudo to write files with a umask of 0022?

I recently upgrading to Snow Leopard. I have noticed that some files written by MacPorts are installed with the wrong permission -- they are written with a umask of 0077. I think I have narrowed down ...
8
votes
5answers
13k views

sudo chmod -R 777 /

sudo chmod -R 777 / I did this. It was a mistake. Is there any way to undo it? Basically it's messed up more things than I can list. I don't have time-machine enabled on my mac.
8
votes
2answers
3k views

Can't write to file /sys/class/backlight/acpi_video0/brightness (ubuntu)

I am trying to change the brightness by overwriting the value on this file: sudo echo 5 > /sys/class/backlight/acpi_video0/brightness -bash: /sys/class/backlight/acpi_video0/brightness: Permission ...
7
votes
7answers
20k views

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

(Originally posted on Stack Overflow. They suggested I try here instead. Here's the original post: ...
7
votes
3answers
16k views

command not found when using sudo

There are a few question on the site that seem related to my problem but I could not find a solution in any of them. My operating system is Ubuntu 12.04. I have mvn installed in ...
7
votes
4answers
17k views

On Mac, how do I give myself permanent sudo privleges?

In Mac OS X 10.6, how do I give myself permanent sudo privleges? is it like linux, in the "/etc/sudoers" file?
7
votes
5answers
17k views

How to reset folder permissions to their default in Ubuntu?

I recently typed the command sudo chmod 777 -R / after that some things like sudo -i are not working normally. So I am wondering if there is any way I could reset the folder permissions to their ...
7
votes
1answer
2k views

non-interactive ssh sudo… prompts for the password in plain text

I'm running some non-interactive ssh commands. The ssh authentication is taken care of fine through the ssh agent, but if I run a command that requires sudo then the password prompt in my terminal is ...
7
votes
1answer
4k views

Why is “sudo unmount” required for unmounting an sshfs-mount if it was mounted without sudo privilges?

I have an sshfs FUSE filesystem mounted in ~/mountpoint. I tried umount mountpoint and diskutil unmount mountpoint (on a Mac here) and both failed. I used sshfs -o IdentityFile=<key> ...
7
votes
1answer
685 views

Why sudo is needed for rebooting in terminal but not from the GUI?

When I turn on my machine and I log in to my account I can do whatever I want and even shutdown my machine or say reboot. But if I open terminal and try to run the command reboot or shutdown then I ...
6
votes
3answers
1k views

Logged in to vi, made changes, forgot to sudo first - now what

I made lengthy changes to a configuration file on a Ubuntu Linux computer with the vi editor. Unfortunately, I forgot to sudo first, so now I'm in the editor, but can't save my changes because of ...
6
votes
7answers
14k views

How to run a program as root without “sudo”?

I have a certain binary program on OS X that can only be run as root. I'm tired of prepending sudo each time I invoke it and typing the password, and would like it to automatically run as root when I ...