sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

4
votes
3answers
98 views

Booting a Raspberry Pi from an NFS share

I am trying to boot my Raspberry Pi using an NFS share. I have copied the boot partition of the Raspbian Wheezy image to the SD card and copied the root partition to a networked hard drive. I have ...
1
vote
1answer
307 views

How do I change file/directory permission of a nfs mounted directory, so I access files as user?

On a Ubuntu computer I mounted a directory from another computer using the following line in the fstab: 12.34.56.78:/space/Images /mnt/space/images nfs rsize=16384,wsize=16384,rw,auto,nolock 0 0 ...
6
votes
2answers
89 views

su authentication failure, sudo missing

After removing the vim-minimal package, because it was conflicting with the GUI Vim I was trying to install, sudo has disappeared, and su is giving an authentication failure. [portOdin@localhost ~]$ ...
3
votes
1answer
44 views

Suppressing “sudo: sorry, a password is required to run sudo” [closed]

I am trying to test if a user has the required sudo rights to run a command as another user without providing a password. What I have is this sudo -u other-user -n true if [ $? -ne 0 ]; then ...
42
votes
2answers
3k views

Why do we need to use visudo instead of directly modifying the sudoers file?

I understand that if you want to modify who can use sudo and what they can do with it that you should use visudo. I know I'm not supposed to directly modify the /etc/sudoers file myself. What is it ...
15
votes
5answers
1k views

Is there a way to tell sudo to set my username as owner for the files created instead of root?

If I do a sudo cp /etc/foo.txt ~/foo.txt, the new file is created with root as the owner. Right now, I see no way around this other than using the last two commands (ls to clarify use-case): ...
3
votes
1answer
165 views

How do I fill my password automatically from .bash_profile when running command as sudo?

I know I could just put something like sudo mypassword in my .bash_profile, but I don't want to run every command as root. I want password to autofill under following circumstances: only the ...
4
votes
3answers
474 views

Does sudo a command temporarily change $PATH to be the root's?

When running sudo <command> under a user login session, will that change $PATH to be the root's $PATH during the running of sudo <command>? If <command> relies on the user's $PATH, ...
4
votes
2answers
39 views

Is it possible to force a group member to run something allowed by sudoers as himself only?

The sudoers line is %game_servers ALL= NOPASSWD:/usr/bin/renice which allows group members renice any process run by any user without pw, but I'd like to allow group members renice their own ...
34
votes
5answers
4k views

Why doesn't the sudo command need the root password?

I've been using Linux for a while now and whenever I typed sudo I thought I was switching over to the root user for a command. Apparently this is not true because all I need is my user account's ...
2
votes
2answers
640 views

Using sudoers to allow php to run command

I am trying to get my php page to run this command: shell_exec("sudo /home/xbian/433Utils/RPi_utils/codesend {$num}"); So I added this entry to my sudoers file with visudo: www-data ALL=NOPASSWD: ...
3
votes
3answers
2k views

How to make `sudo` preserve $PATH?

I need to run a program installed on /opt/godi/sbin (a custom directory). If I add that directory to my PATH, by adding the following line to my .bashrc file export ...
3
votes
1answer
32 views

Software like Iceweasel and LibreOffice wont run without root/sudo

I recently decrypted my home directory by making a backup of my home directory, deleting the directory, and then replacing it again with the backup (followed a guide). Ever since, I can no longer run ...
1
vote
1answer
27 views

Allow AD Groups to SUDO

I'm adding some Fedora 20 workstations to our Windows 2003 domain. I've successfully joined the domain with the boxes, and can login with domain accounts. Now I'm trying to allow the default AD group ...
1
vote
1answer
34 views

Why does the sudoers file contain IP addresses?

According to the documentation, modifications of this file may enable local users to execute sudo commands on remote machines: user1 192.168.1.14=(user2:group1) ALL According to what I read, this ...
2
votes
2answers
1k views

How can I keep *all* environment vars for a specific command in sudo?

I have a script that sets several environment variables and then finally calls another script using sudo. The script run with sudo must be able to pick up those variables, and I'm not always going to ...
4
votes
1answer
67 views

How to compile programs on Linux systems when I don't have sudo privileges to install the dev dependencies [duplicate]

How should I go about compiling programs that depend on libraries whose development packages (headers and such) aren't pre-installed on the system when I don't have sudo access? In this particular ...
1
vote
1answer
6k views

switching from user to root and revers (FreeBSD)

I want to make some modification with root and then with my user, in fact I want to install sudo and he give me the error in the first step: cd /usr/ports/security/sudo make install clean ...
0
votes
1answer
33 views

install .deb package locally without using sudo [duplicate]

I am using Debian in my office which is controlled by an administrator. I want to install rescuetume. I downloaded the .deb file in my local disk and I want to install it locally. Every time I do ...
0
votes
2answers
60 views

Can malware run itself after user enters sudo mode?

As far as I know malware is very uncommon in Linux systems, because majority of important commands require root access. So my question is, can malware just wait until I enter sudo mode (for example by ...
1
vote
2answers
58 views

Why does sudo ignore aliases?

I am running Ubuntu 10.04 and I use upstart for daemon management. My enterprise application is run as a daemon and must be run as root because of various privileges. E.g.: sudo start ...
1
vote
1answer
34 views

Why do I get “Permission denied” when redirecting the output of sudo echo “xyz” to a file? [duplicate]

Why do I get -bash: test: Permission denied when I run sudo echo "xyz" > test The directory permissions are: drwxr-xr-x 3 root root 4096 2014-08-05 16:26 I have no problem creating a ...
6
votes
1answer
97 views

Send only one warning when the private key is not available

For added security, I would like to require a private key to use sudo on my Ubuntu Server box. I've added private key authentication for sudo as described at ...
7
votes
1answer
4k views

sshfs mount, sudo gets permission denied

I am using sshfs to mount a folder with some python projects over ssh to my ~/ directory. $ mkdir -p ~/mount/myprojects $ sshfs user@myserver:/home/user/myprojects ~/mount/myprojects I can perform ...
3
votes
1answer
25 views

sudo and fish: no credential caching

I use fish as my standard shell. And I use sudo sometimes. But I'm having problems with credential caching. On an Ubuntu system, this works: niklas@Niklas-Mobil~> sudo true [sudo] password for ...
5
votes
1answer
105 views

sudo - impersonating a user

I am trying to use the sudo command and sudoers file correctly so that I can run a command as another user. I have my sudoers file set up as follows: beans ALL = (root,apache) NOPASSWD: ...
0
votes
1answer
350 views

Webmin administrative panel options are missing

When I log into Webmin, with the Ubuntu administrative user frank, I cannot see most of the administrative options: frank is shown as the Administration username in Webmin. I accidentally ...
2
votes
1answer
48 views

mdadm inconsistencies when run programmatically

Update #1: I just gave an extra layer of testing, writing a shell script (.sh, #!/bin/bash) and a php script to be executed by php's cli. Bash works. It seems that it's not the Apache's HTTP ...
3
votes
3answers
2k views

Problem with vim when logged in as root

When I login as root or edit a file by sudo mode all of the options in my /etc/vimrc are not working (e.g. highlight line-number etc.)
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 ...
5
votes
3answers
852 views

Why is the 'sudo' password different than the 'su root' password

On my personal machine, I often type sudo in front of certain commands in order to accomplish administrative tasks. I had hoped to avoid doing this throughout the day, by typing su root and providing ...
1
vote
2answers
34 views

how to determine the permissions of groups?

When you invoke sudo, it prompts for password and then checks the /etc/sudoers configuration file to see if the user is permitted access to run the command. /etc/sudoers is the sudo configuration ...
12
votes
4answers
2k views

How does the OS know that a command needs sudo?

When you run an executable, sometimes the OS will deny your permission to. For example running make install with the prefix being a system path will need sudo, while with the prefix being a ...
1
vote
2answers
68 views

relation between chmod and sudo on an executable file

What is the relationship between chmod and sudo on an executable file for a user? Are the cases that "a user needs sudo to run an executable" the same as the cases that "chmod hasn't set the ...
15
votes
1answer
770 views

How can I `alias sudo !!`?

I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal !! and prints sudo: !!: command not found If I use double quotes, it substitutes ...
0
votes
1answer
33 views

How root can make sure that this time sudo will not prompt for password a specific user?

I am writing a script, that will setup lxc on the host, and then configure a container. I want this script to be unattended. After the container is created and run, there is a moment, when I want to ...
0
votes
1answer
37 views

What do you do when you try to sudo and root's PATH has gone kerblooey?

I've got a feeling something bad just happened to this machine. faheem@bulldog:/usr/local/src/mercurial$ sudo dpkg -i mercurial_3.0-1_amd64.deb mercurial-common_3.0-1_all.deb dpkg: warning: ...
2
votes
2answers
78 views

Piping tcpdump traffic via SSH - but no root ssh access

The situation I would like to use Wireshark to analyze traffic on one of our servers, but I don't want to install Wireshark on the server itself. I understand that I can pipe tcpdump traffic via SSH ...
28
votes
7answers
35k 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 ...
2
votes
0answers
111 views

Why sudo won't remember my password?

I use sudo in many systems, but I have one of them that makes me type my password each time I run sudo. All the others remember it for a while. This is debian 7.4 wheezy and sudo 1.8.5 I found this : ...
3
votes
1answer
58 views

How do I use sudo to run multiple commands as another user within a portion of a script?

I'm trying to run the following: if [! -f .owner ]; then creator=$(whoami) sudo -u appuser ksh echo "$creator" >> .owner mkdir test1 test2 test3 exit fi However, the ...
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 ...
0
votes
4answers
8k views

Is there a difference between sudo su - root and sudo -u root -H /bin/bash?

Like title says, is there a difference between these two commands : sudo su - root sudo -u root -H /bin/bash I'm using GNU/Linux, if that makes a difference.
3
votes
1answer
34 views

Difference between sudo -s and sudo su -

It might be a duplicate and I'm pretty sure I already show an answer to that somewhere, but I wondered what are the difference in term of right and variable and other stuff between sudo -s and sudo su ...
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 ...
4
votes
2answers
25 views

Use non-root user configuration for root account

When I work with the terminal and use su or sudo to execute a command with the root user's permissions, is it possible to apply the configuration of my "non-root user" (from which I am invoking su or ...
2
votes
1answer
83 views

How can I run as another user?

This is the bash code that should be runned. So first it substitutes the user to openproject and than runs all the code su openproject -c "bash -l" cd ~/openproject git checkout Gemfile.lock git ...
2
votes
2answers
331 views

Sudo Su automated login

I want to automate the login process with sudo su. I have seen lot of questions on these, but none of them are working for me. Automate login with sudo and su Here's my what I tried so far echo ...
1
vote
2answers
72 views

sudo for users with empty passwords

I want sudo to behave like this, for all users: If the user currently has a non-empty password, prompt for the password. If the user currently has an empty password, either prompt for the password ...
16
votes
4answers
1k views

How universal is sudo?

I was writing some instructions on how to install something (TeX-related - if you don't ask, I won't ruin your day by supplying more details) and used sudo to install system-wide. Someone commented ...