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

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 ...
3
votes
1answer
11k views

How to change user in winSCP?

I'm using winSCP to access Unix computers. How can I change user after I have logged into a Unix server using winSCP? E.g. I have personal account in unix computer A. I can log into this comp using ...
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.
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 ...
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 ...
2
votes
3answers
14k views

Automating the “sudo su - user” command

I want to automate sudo su - user from a script. It should then ask for a password.
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 ...
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 ...
31
votes
6answers
28k 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 ...
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 ...
4
votes
2answers
10k views

How to perform SCP as a Sudo user [duplicate]

Possible Duplicate: scp to remote server with sudo What is the best way of doing SCP from one box to the other as a sudo user. There are two servers Server A 10.152.2.10 ...
3
votes
2answers
516 views

Practical (closer to the classical Linux one) way to use (automate) SUDO for CygWin

Being able to use sudo commands in CygWin is useful, and faster than opening an elevated shell: Luis@Kenobi /cygdrive/c/Users/Luis $ net user /add TestUser System error 5. Access denied. Luis@Kenobi ...
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.
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 ...
5
votes
1answer
651 views

What is the + at the end of Unix permissions in a long listing format?

Here's an example drwxr-xr-x+ 6 reza reza 204 Mar 5 20:23 .ssh/ Although I am the owner of this directory, I cannot modify it without using sudo! Why is that? how can I remove '+' here ...
4
votes
3answers
4k views

Why can't I sudo some commands? (e.g., vim)

I have sudo access on my friends server, running centos-6.3, but when I try to run some commands like sudo vim /var/www/html/index.html I get an error sudo: vim: command not found I can, however, run ...
4
votes
2answers
4k views

Cannot do sudo: “/etc/sudoers is mode 0740, should be 0440”

I have a problem: I don't have a root password on my mac. I just have an Admin account, which can do stuff using sudo. Now, I wanted to add my normal user to the /etc/sudoers file as well. Since it ...
4
votes
2answers
954 views

Creating an alias containing bash history expansion

I often forget to run a command with sudo, so I find myself often typing sudo !! immediately afterwards. I tried aliasing this, but bash chokes on the !! part. Is there some way to represent this ...
3
votes
6answers
2k views

a safer no password sudo?

Ok, here's my problem - Please don't yell at me for being insecure! :) This is on my host machine. I'm the only one using it so it's fairly safe, but I have a very complex password that is hard to ...
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.
2
votes
5answers
3k views

Problem with running a script at startup as root?

The main question: Is there a way I can run 'completely' one of my script when ubuntu's desktop appears no matter if root , administrator, desktop user or an unprivileged user logged in? What does ...
1
vote
4answers
2k views

Alternative for sudo

I am aware that we can execute a command/script as a super/another user using sudo command. But Is there a possibility where the sudo utility itself is unavailable/removed by the user. If so, what ...
0
votes
2answers
839 views

How to use sudo with rcp command to copy files from linux host to HP-UX host?

I'm having this issue where when I try to use sudo to rcp some files from a Linux host to an HP-UX host (note that the destination directory requires root access to write to), I get the following ...
0
votes
3answers
557 views

Can't run command with sudo, even with the full path, I got an error

The command starling is located at /home/keating/.rvm/gems/ruby-1.9.2-p290/bin/starling. Only using rvmsudo starling will work properly. This is the result of me trying to invoke it in various other ...
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 ...
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 ...
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. ...
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 ...
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
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 ...
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 ...
12
votes
3answers
30k 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
12k views

sudo vs gksudo. difference?

What's difference between sudo and gksudo?
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 ...
3
votes
1answer
5k views

Allow users of a certain group to run a command without sudo

I know how to edit /etc/sudoers so that I can run a command as sudo without having to enter my password, however is there a way of allowing a program to be run completely without sudo, by all users of ...
3
votes
2answers
2k views

Lost permission to use sudo commands

I changed /etc folder permission to 711. After doing that, I lost the permission to use sudo commands. Any way to change the folder permissions back? What I have tried so far: 1) use su -, ...
3
votes
1answer
787 views

How to write a script to sudo the last command [duplicate]

Usually, for some commands such as apt-get install xxx, I forget to add sudo first, then I need to retype it. What I want is in such cases, I just type a simple command, for example resudo. It will ...
3
votes
3answers
10k views

How do I delete a file using the Terminal from my Trash in Mac OS X?

From a previous question I have applied following command to my file. sudo chflags -R nouchg TopSites.plist sudo chmod 444 TopSites.plist Now that the file is locked, I don't know how to remove it. ...
0
votes
2answers
9k views

“no valid sudoers sources found, quitting” error while chmodding /var/www

I'm new to Ubuntu and just installed LAMP. I'm trying to paste files into the /var/www/ directory so i can test my PHP projects, but I can't. I have searched on the web and all I read is: "type sudo ...
5
votes
4answers
243 views

Terminal: prefix previous command?

Frequently in Terminal (though I fully expect any answer will work in bash and most others), I type some command, and then get some sort of permission error due to missing sudo. Okay, so press 'up', ...
5
votes
1answer
737 views

Linux/Unix - how to enable one user to `sudo` without a password

How can a user be setup to sudo (or su -) without entering a password?
4
votes
1answer
453 views

sudo -k vs. sudo -K

I know what the man page has to say about the -K and -k : ‑K The ‑K (sure kill) option is like ‑k except that it removes the user's cached credentials entirely and may not be used in ...
4
votes
3answers
26k views

How to execute a command with admin privileges and access to files of the logged in user?

I have some problems understanding sudo. I am logged in on a terminal as an non-admin/non-root user. This "normal" user is not in the sudoers file (and shouldnt be, in my opinion). Now I try to ...
4
votes
3answers
22k views

Set password for root on virtualbox ubuntu

I loaded ubuntu into virtualbox. It all works well but it occurred to me that I was not asked (or did not setup) a root password. I want to use root on occasion, but I cannot seem to find out how to ...
3
votes
3answers
523 views

How do you set alias sudo='nocorrect sudo ' correctly?

Until Recently I had alias sudo='sudo ' in my .zshrc file. Today I ran into this error on trying to do sudo mv: ➜ ~ sudo mv nginx.conf.orig nginx.conf.orig2 sudo: nocorrect: command not found Now ...
2
votes
3answers
452 views

Mail me when someone runs sudo

I have added the below lines to /etc/sudoers.d/my_sudoers Defaults mail_always Defaults mailto="email@domain.com" I get an email every time sudo is run How can i modify this so I only ...
2
votes
1answer
5k views

Howto switch / chage user id witin a bash script to execute commands in the same script?

Is there a way to switch user identity within a script (executed as root as part of an installation process) to execute some commands without calling an external script, then return to root to run ...
2
votes
2answers
1k views

Wireshark: Accessing USB Bus Interfaces without sudo

I am trying to monitor some USB traffic using Wireshark on Linux (Ubuntu). If I start Wireshark as my normal user without root privileges, the USB bus interfaces are not listed. If I sudo wireshark ...