sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

0
votes
2answers
15 views

Pass arguments to a command run by another user

I have a bash script that is supposed to take some arguments and then run in a different user: test.sh #!/bin/bash sudo su user2 <<'EOF' echo $1 EOF However it prints blank: $ ./test.sh ...
-1
votes
0answers
12 views

Firewall rules for user groups [duplicate]

Is there a way to define of firewall rules that are only applicable for a specify user group or a user? Assume I have a user ABC that is not a sudoer on a box, I would like to ABC to follow ABC's ...
2
votes
2answers
41 views

how to write a script that will run commands after su, without using -c

I'm trying to automate a standard activity on a system I do not have root access on. The administrator of the systems have given me authority to run sudo su - 'user' command, and only that command. ...
1
vote
1answer
32 views

Choice of editor when running under sudo

On an Ubuntu 12.04 machine I've used the alternatives system to set the editor to vim.basic. I get the correct editor when root but not when I sudo to root and run crontab, and I'm trying to ...
7
votes
7answers
225 views

Emptying a file for root user does not work [duplicate]

I use below command to empty a file > file.txt It works perfectly fine! But there are some files with root user permissions. So I tried sudo > different-file.txt and I got below verbose ...
1
vote
2answers
34 views

How does the script /etc/init.d/sudo work?

I was reading the script /etc/init.d/sudo. It has been written as a comment in the script that it provides limited super user privileges to specific users. Though, I could not understand the script ...
2
votes
2answers
30 views

sudo -E cannot excute some commands located in home dir?

symptom: $ sudo -E adb sudo: adb: command not found $ which adb /home/usr/opt/android/platform-tools/adb $ sudo -E echo ${PATH} ...:/home/usr/opt/android/platform-tools $ stat ...
0
votes
1answer
46 views

How does sudo decide whether a command is only executable by sudoers with ALL rights?

I just wondered why on a Debian system with sudo installed a default user can execute ls but not ifconfig since the binaries do have the same rights: -rwxr-xr-x 1 root root 114032 Jan 26 2013 ...
7
votes
2answers
121 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
53 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 ...
3
votes
1answer
185 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
490 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, ...
18
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
37 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 ...
35
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 ...
1
vote
1answer
45 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
38 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 ...
4
votes
1answer
76 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 ...
0
votes
1answer
38 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
64 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
1answer
38 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 ...
1
vote
2answers
60 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 ...
3
votes
1answer
29 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
137 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: ...
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 ...
2
votes
1answer
59 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 ...
1
vote
2answers
41 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
84 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 ...
0
votes
1answer
37 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
47 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: ...
3
votes
1answer
71 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 ...
3
votes
1answer
37 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 ...
4
votes
3answers
117 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 ...
2
votes
2answers
107 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 ...
4
votes
2answers
28 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
2answers
344 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 ...
2
votes
1answer
105 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
0answers
142 views

Reading from /etc/environment with sudo

Using Ubuntu 14.04 LTS, I'm having a problem trying to read environment variables from /etc/environment when using sudo env. Basically, they are not being displayed. When I do just env, these ...
2
votes
1answer
25 views

setup sudoers to mount network shares and loop devices and misc

I would like to setup sudoers to grant users to mount all kind of network shares and loop devices to their home directory. Here is a try that I found and changed a bit on one old post in ...
1
vote
0answers
95 views

sudo -u git clone

I'm on Ubuntu server 14.04. I am using apache web server which runs as the www-data. I need to do git clone from a script (a web hook). This script will run with www-data user privilages. Running ...
3
votes
1answer
20 views

How to execute as the logged-in user in a sudo script (OSX)?

Is there a way to switch contexts like that? The script in my specific case is an installer postinstall script, which requires sudo privileges only for some of the tasks and requires the logged-in ...
5
votes
1answer
191 views

No password to run command as root for fixed command? [duplicate]

Is it possible to define a rule in sudoers to allow one user to run one well defined command as root, without password or other authentication except being the right user? Are there alternatives to ...
1
vote
4answers
278 views

How to correctly enable sudo for user in Fedora 20

I followed this question in order to enable sudo command for my created user. So I added it into the wheels group and edited the /etc/sudoers file accordingly. But what I don't get about this is when ...
3
votes
0answers
143 views

bash does not autocomplete my command when using sudo?

I'm using SaltStack. I would like to auto-complete the minion name when calling salt command. The following line has been added into ~/.bashrc: complete -o default -o nospace -W "$(sudo ls -1 ...
4
votes
1answer
148 views

View List of Sudoers with No Sudo Priviledges

If I'm not a sudoer, is it possible to view the list sudoers? Does /etc/group show this information?
4
votes
1answer
108 views

How safe is sudo when running from root to run an application as a less privileged user?

Lets say I am logged in at a root terminal and I run something like the following command: sudo -u '#1000' dbus-launch chromium Are there any potential security issues I should be worried about? ...
3
votes
1answer
33 views

Is there an easy way to background a sudo shell?

A bit more details, what I'm looking for is some kind of ^Z for sudo shells. For instance when running a long command I can hit ^Z to suspend the command or when I do ~^Z in ssh after hitting Enter. ...
1
vote
0answers
50 views

What is the correct way to abort an operation from the sudo password prompt?

Sometimes it amazes me the "little" things I don't know about Unix. For years now I have occasionally noted that I don't actually know how to deal with the sudo password prompt cleanly. Every once in ...
1
vote
2answers
50 views

Problem executing command as differetn user with sudo -u

I have the following problem When I'm trying to execute ls as user abc with the following command I get an error: xyz@host:~/temp$ sudo -u abc ls [sudo] password for xyz: Sorry, user xyz is not ...