sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

6
votes
3answers
10k 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
637 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
734 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 ...
9
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
445 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 ...
13
votes
1answer
962 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
236 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
302 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
233 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?
16
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 ...
3
votes
2answers
491 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
643 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 ...
19
votes
3answers
6k views

How is sudo intended to be used?

I've tried configuring sudo before, but I haven't had too much luck with it. How is it different from su -l -c "x"? It seems that via the configuration file, one can make it so a user can only have ...
37
votes
5answers
3k views

Becoming root from inside Vim

Sometimes I start editing configuration files in /etc using Vim, but forget to use sudo to start Vim. The inevitable result then is that after finishing my edits I encounter the dreaded notice that I ...
4
votes
1answer
2k views

Can't add user to sudoers file [duplicate]

I'm installing Globus Toolkit . When i try to setup Certificate , this error comes : ERROR: could not run build command: /usr/local/globus-5.0.3/sbin/gpt-build -force ...
7
votes
6answers
1k views

Negatives/downsides of Ubuntu's no-root sudo setup

By default, Ubuntu does not create a root account that the user can login to. Instead users use sudo when they need to perform actions that require administrative access. Obviously, the people at ...
6
votes
5answers
8k views

Can I change root password by sudo, without su?

I can sudo, but I don't have the root password so I can't su root. Using sudo, can I change the root password?
7
votes
3answers
2k views

Why does my sudo ask for password only once but evaluate thrice?

$ sudo some_command Password: Sorry, try again. Sorry, try again. Sorry, try again. sudo: 3 incorrect password attempts $ This is what my shell prints when I enter a wrong password to a sudoed ...
1
vote
4answers
2k views

how can i use sudo within a function?

i have written a function which acts in a similar way to tee but also pre-pends a datestamp. everything works fine except when i want to output to a file which is only root writeable (in my case a ...
82
votes
7answers
11k views

Which is the safest way to get root privileges: sudo, su or login?

I would like to have the root account in safety even if my unprivileged user is compromised. On Ubuntu you can only use sudo for "security reasons" by default. However I am not sure it is any safer ...
7
votes
2answers
3k views

Forcing sudo to prompt for a password

If I do the following: sudo su - //enter password exit exit //login again straight away sudo su - The second invocation of sudo does not request a password because even though I have logged out ...
3
votes
1answer
4k views

How do I create a new file and edit it as root?

I've tried: gksudo gedit /etc/xinetd.d/tftp (this is the path I need). I got an error message: couldn't find the file /etc/xinetd.d/tftp please check that you typed the location correctly and try ...
4
votes
2answers
6k views

“No protocol specified” when running vim with sudo

Recently I start to get "No protocol specified" when using sudo vim. It's just a warning I guess, because everything was working normally (I can open, edit and save files). The message doesn't appear ...
25
votes
6answers
15k views

What is the need for `fakeroot` command in linux

Why do we need fakeroot command at all? Can't we simply use the sudo or su commands? The man page says: fakeroot - run a command in an environment faking root privileges for file manipulation ...
6
votes
2answers
3k views

Write to a file without redirection?

I am writing a regular compiled application that needs to create a special file and write a magic cookie into it. I can’t write the file directly from the application, the system security model ...
7
votes
4answers
1k views

sudo permission denied but su grants permission

this is the first occurrence where su was required for me. I read an article about changing the value in /sys/devices/virtual/backlight/acpi_video0/brightness to alter my laptop's screen brightness. ...
6
votes
5answers
4k views

How do I suppress dd output?

I have a bash script that creates some file using dd. The problem is dd throws a great amount of output that is going to mess with the output of my script. Searching around I've found a solution: dd ...
7
votes
2answers
2k views

Once sudo su'd to root, is there a command to see my username?

I have sudo rights on a redhat box; once I've "sudo su -" to become root in a shell, are there any commands I can run to see what username I su'd FROM?
0
votes
1answer
2k views

Debian 6.0 RC1: Cannot login as root and user is not a sudoer

After installing Debian 6.0 rc1, I can't do anything as administrator because I cannot login as root (but I did setup the password during installation) and user is not a sudoer either. Did I miss ...
3
votes
2answers
479 views

Why did my sudoers file suddenly reset itself?

After setting up Wave in a Box on my Debian server, I started noticing strange things happening: I could no longer use sftp to transfer files, and even worse, I couldn't run any sudo commands! ...
8
votes
2answers
8k views

JAVA_HOME not set in script when run using sudo

I'm trying to run an install script that requires java to be installed and the JAVA_HOME environment variable to be set. I've set JAVA_HOME in /etc/profile and also in a file I've called java.sh in ...
3
votes
1answer
1k views

Adding kill to a sudoers group

How can I give permissions in sudoers such that each member of a group is able to kill the process owned by another member of the group? Scenario: I have two users -- bill and dev-cron -- who are ...
4
votes
5answers
5k views

What sudoer spec allows users to mount cifs shares?

I'm trying create a line in /etc/sudoers that allows members of group "users" to mount cifs shares anywhere inside their own home directory. In my first attempt I tried: %users ALL=/bin/mount -t cifs ...
2
votes
3answers
795 views

How do I use redirection with sudo [duplicate]

Possible Duplicate: Redirecting stdout to a file you don't have write permission on Yeah I could (and probably will) just escalate to root, but I'd like to know why this doesn't work? ...
7
votes
3answers
10k views

How to set visudo to use a different editor than the default on Fedora?

Fedora 14 uses vi by default when one runs visudo. Is there a way to change this to something else?
22
votes
4answers
43k views

How to make Fedora user a sudoer?

I want to give a Fedora user sudo privileges. How do I do that?
14
votes
4answers
443 views

What specific vulnerabilities am I creating by disabling the sudo password?

Here are some instructions on how to disable your sudo password. These carry the following warning If you disable the sudo password for your account, you will seriously compromise the security of ...
8
votes
2answers
4k views

How do I get sudo -u $user to use the users env?

It seems when sudoing down that using sudo -u $user that the environment of root is still being used. How can I make sudo use the users environment? as a special note not all users that I will be ...
1
vote
2answers
3k views

How to insert text into a root-owned file using sudo? [duplicate]

Possible Duplicate: Redirecting stdout to a file you don't have write permission on Running a command like sudo echo 'text' >> /file.txt fails with: bash: /file.txt: Permission ...
6
votes
1answer
647 views

sudo missing on Palm WebOS - can I add it?

I've rooted my Palm Pre (WebOS 1.4.5) and installed a SSH server on it. Now I'd like to SSH into it with an unprivileged user and use sudo for elevated commands. However: There is no sudo on the ...
36
votes
4answers
15k views

How do I run a command as the system administrator (root)

I need to run a command with administrative privileges. Someone said I should run a command as root. How do I do this?
8
votes
2answers
9k views

using sudo on GUI applications

When I was using kubuntu, I could always open X applications with sudo, sudo kate for example. Now that I've switched to arch that doesn't work. I know I've always been told to use kdesu, but what ...
9
votes
2answers
3k views

When do su and sudo use different passwords?

I am able to run anything using sudo; my password is accepted. But whenever I try to do su from a shell, it fails with: su: incorrect password What can the problem be?
42
votes
5answers
3k views

Redirecting stdout to a file you don't have write permission on

When you attempt to modify a file without having write permissions on it, you get an error: > touch /tmp/foo && sudo chown root /tmp/foo > echo test > /tmp/foo zsh: permission ...