sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

4
votes
1answer
152 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
109 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
52 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 ...
0
votes
1answer
66 views

Restrict user to run shell script except which is defined in sudoer file

I have scientific linux 6.4 running on my system, I have restricted other users to run shell script except one, which is defined in /etc/sudoers file. For example: I have one file.sh in my admin's ...
1
vote
2answers
82 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 ...
5
votes
1answer
219 views

Give user permission to rm without password or sudo

I'm trying to give the ubuntu user on my machine the ability to rm folders and files (mainly in the /www/ folder) without the need to invoke a password or the need to use sudo. I've been following ...
4
votes
1answer
64 views

keep aliases when I use sudo bash

I have a Centos 5.5 server that has my own alias commands for my account. When I do "sudo bash" I can still use those aliases, I didn't have to add the aliases to the root bashrc. I have another ...
1
vote
1answer
25 views

Replacing graphical sudo prompts with sudo command

I'm trying to replace gksudo, pkexec and its ilk with sudo. However, I'm told that using sudo <graphical_program> is a bad idea. Would the following work as a decent replacement? sudo -H ...
3
votes
1answer
327 views

sudo environment: “g++: command not found”

I have a relatively fresh RHEL 6.5 install, on to which I have installed from source GCCC 4.9. After I installed GCC 4.9, I uninstalled the distro-provided older GCC version via: sudo yum remove gcc ...
8
votes
3answers
600 views

Execute a line of commands with one sudo

For example if I want to create a file and enter text in one line I can redirect the output into a file with the use of the > operator: echo "something" > /path/foobar but if I don't have ...
5
votes
1answer
389 views

I changed /etc/sudoers, and now I can't run as sudo

I messed around with the sudoers file without really knowing what I was doing using this link. Assume I did everything that was in the top answer along with editing it with vim and not visudo. How do ...
0
votes
1answer
257 views

Running both sudo and nohup on a command

There is a complex command that requires sudo: sudo command par1 666 /home/me/... I need to launch it so that it persists after I log off from terminal (SSH). I have discovered that nohup command ...
2
votes
0answers
15 views

Why does xdg-open text_file differ from sudo -u me xdg-open text_file?

If I run the following command, the text file opens in my preferred editor (kate). $ xdg-open text_file However, if I try the following, where sparhawk is my username, I get several warnings, and ...
2
votes
1answer
58 views

How do I limit local user file system access? What is the best method?

I have a Linux installation with a default user and an admin user (and root). On startup, the default user is automatically logged in and a particular application is launched. My intention is to ...
1
vote
2answers
42 views

Disallow Changing of Passwords [duplicate]

I have a spare computer running as a small server doing various things, and I'd like to create another account for my cousin, so she can learn how do manage a server/run minecraft etc. I'd like to ...
1
vote
1answer
36 views

sudoers conditional/combo command is possible?

I want to allow sudo this way: myuser ALL=NOPASSWD:/usr/bin/pkill -fx "/usr/sbin/nethogs -v 3 -s" || /usr/sbin/nethogs -v 3 -s so I get only a single running instance of nethogs. visudo accepts ...
1
vote
1answer
30 views

How do I switch user without any references to the old one?

A while back, when playing with unprivileged LXC, I discovered that the command to create a container failed if I used su to switch to the user, but it worked if I used ssh user@localhost to login. ...
4
votes
2answers
290 views

How to get the name of the user who executed a bash script as sudo?

I want to create a bash script that must be executed with sudo but should take into account the name of the non sudo user who executed it. So if user bob runs sudo ./myscript.sh I would like ...
6
votes
1answer
55 views

How to make gksudo or gksu sessions last longer in Linux

Every time I want to open a GUI program that needs root permissions, I have to put my password. For example, I open synaptic and put my password then close it and a second later decide to reopen it it ...
0
votes
1answer
107 views

How to give All privilege rights to user ubuntu 12.04

I am working with my first VPS.I created a new user adduser username and then I added this line username ALL=(ALL:ALL) ALL under root in visudo I saved the changes and exit the ...
3
votes
1answer
2k views

“sudo: sorry, you must have a tty to run sudo” when using sudo in a remote script

I want to run a series of sudo-elevated commands on a remote machine from an embedded script. To simplify the question, I'm just trying to run sudo id and get it to tell me that it's root. I am ...
2
votes
3answers
153 views

Can sudo replace su?

There is much duplication of functionality on Linux-based systems, for example these do the same thing: sudo --login --user <user> sudo su - <user> The sudo-only approach looks more ...
3
votes
1answer
84 views

how to use rsync (using password-less ssh), with sudo just on the local side?

This command works fine for me with password-less ssh: rsync -aqve ssh ${user}@${remote_host}:/etc/bind /tmp/etc/bind Since I would like to rsync directly to my own local /etc/bind with root ...
2
votes
0answers
57 views

PHP exec and amixer

I'm trying to make php lower the dB level of amixer using exec, but it seems like php isn't able to perform the task which requires sudo-access. What should be the best way to solve this? I tried: ...
2
votes
1answer
1k views

Vim Error E138: Can't write viminfo file $HOME/.viminfo!

I'm afraid I've run into something rather strange. When I open a file normally, vim README.txt, everything is fine. But upon sudo vim README.txt, the file renders blank, and gives me a E138: Can't ...
1
vote
3answers
201 views

Send a command with password in upstart script

CentOS 6.5 The server is an AWS AMI, specifically this one I'm trying to use upstart to start a process on boot On this particular box, the root login is disabled, and every time I need to run ...
4
votes
1answer
80 views

How can I run growisofs via sudo?

Whenever I've attempted to run growisofs via sudo I've always gotten the following error message. $ sudo -i growisofs :-( growisofs is being executed under sudo, aborting! See NOTES paragraph in ...
1
vote
4answers
279 views

sudo not preserving PS1

The configuration below is in my /etc/sudoers: Defaults !visiblepw Defaults always_set_home Defaults env_reset Defaults env_keep = "COLORS EDITOR DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR ...
1
vote
1answer
275 views

Switch users with sudo or su in a shell script

I inherited this. Long story short I have an XML file that is calling a shell to run some commands. Everything I have tried has failed at the second su in the script. Here are some of the failure ...
1
vote
1answer
94 views

Slow sudo because of socket connections

Some time ago sudo started to behave very slow on our server. Some times we have to wait even a few minutes until it executes. I've checked all hostname and dns causes that forums all full of, but ...
1
vote
1answer
79 views

Sudo email notification setup error

I'm Using Centos version: [sysadmin@backup-srv ~]$ cat /etc/redhat-release CentOS release 6.4 (Final) I'm using this sudo version: [sysadmin@backup-srv ~]$ sudo -V Sudo version 1.8.6p3 Sudoers ...
2
votes
2answers
111 views

Will I be prompted for the sudo password a second time?

This is what I plan to do: #!/bin/bash sudo -i <<'EOF' iptables-save | awk '/^[*]/ { print $1 } /^:[A-Z]+ [^-]/ { print $1 " ACCEPT" ; } /COMMIT/ { print $0; ...
2
votes
1answer
126 views

How to create an executable bash script for these commands?

I wish to create an executable bash script that will run the following commands as root, that is, using sudo su iptables-save | awk '/^[*]/ { print $1 } /^:[A-Z]+ [^-]/ { print ...
0
votes
3answers
203 views

SSH Agent-Forwarding works, but what about sudo -u username no shell/ permissions? composer

Working on a remote server (A) I want to use my local SSH-Keys to access a repository on another server (B) that is not controlled by me. Generally this works like a charm. I log in as myUsername ...
0
votes
0answers
77 views

Debian wheezy using gnome classic requires root for system modifying changes

I am using Gnome classic on Debian Wheezy, and I sometimes get a popup for package updates. The UI prompts for a root password, and will only accept root. Is there some way for me to add my account to ...
1
vote
2answers
68 views

Why does it take more time for a login to fail than to succeed? [duplicate]

When logging in to my PC, and the password is correct, the login takes place nearly instantaneously. When the password is wrong, it takes a few seconds of waiting until the hint "The password is not ...
1
vote
3answers
137 views

Wrong Permission to /etc folder [duplicate]

I have given the wrong permission to the /etc folder chmod -R 777 /etc When I want to login as root it gives me an error and the following output. How can I correct the permissions? ...
0
votes
1answer
30 views

Write a file in /var/lib/sysnews/ [duplicate]

In that folder are stored the news files: they can be created by the system administrator to write some informations for the users, as suggested in this link. I tried as a normal user to add a file ...
5
votes
1answer
76 views

Why does visudo discourage other editors?

man visudo explains that visudo will not (by default) use EDITOR or VISUAL environment variables. It states that "There is no easy way to prevent a user from gaining a root shell if the editor ...
4
votes
1answer
520 views

Sudo permissions by ldap groups via nslcd

I have a problem with my sudo permissions in an MS ActiveDirectory to Debian LDAP authentication/authorization setup. What I have so far I've configured nslcd with libpam-ldap via ldaps and ssh login ...
0
votes
1answer
204 views

Adding www-data to /etc/sudoers dos not work for PHP shell_exec() to run a command

I'm running the webserver lighttpd on Raspbian (Debian based) on a Raspberry Pi. The server runs as user www-data (checked with ps aux). I added the following line to /etc/sudoers: www-data ...
2
votes
1answer
75 views

Root Password Policy and Refresh

Unfortunately the infrastructure I work in has static root passwords that are very rarely refreshed. So people leaving the company will have our root passwords and it can potentially be leaked to ...
-1
votes
1answer
111 views

Why sudo ./bin/mysqld_safe & on Mac OS X 10.6.8 doesn't ask for password?

I get the following permissions from terminal: $ cd /usr/local/mysql $ ls -l drwxr-xr-x 41 root wheel 1394 29 Apr 00:55 bin drwxr-xr-x 4 root wheel 136 29 Apr 00:55 docs ...
3
votes
2answers
581 views

I'm not getting privileges, edited /etc/sudoers [duplicate]

I want to run any program without asking root password. Because I'm the only person who use the system. So I googled and edited /etc/sudoers. What I did: # chmod 640 /etc/sudoers # vim /etc/sudoers ...
4
votes
2answers
112 views

System Crontab or Root Crontab

System crontab: /etc/crontab Root crontab: sudo crontab -u root -e Which way is preferred? As they all run tasks within administration privilege.
0
votes
1answer
64 views

Can't simulate initial login using sudo

$ sudo -iu cyrus sudo: unable to change directory to /srv/cyrus: Permission denied sudo: unable to execute /bin/zsh: Permission denied I don't understand why I would get permission denied for ...
2
votes
2answers
75 views

User created without a password behaves as if he had one

Inside one of my scripts, I created an user based on a directory arrangement on another machine. The thing is that this user, created without a password, behaves just as he had one : he has sudo ...
1
vote
1answer
445 views

How to execute changes on remote server as root?

I'm wondering if there is a way to execute a script/commands from the the local machine without making any modifications as root on the remote machine? Some background I'm trying to setup some tasks ...