sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

1
vote
1answer
11 views

Run openvpn without root privilegies

I am working with openvpn, when I type: $ sudo openvpn Every is fine, but when I type: $ openvpn bash: openvpn: command not found I try in my Debian 8 with this instructions but in Jessie I can ...
62
votes
4answers
62k views

Why do I need a tty to run sudo if I can sudo without a password?

I have configured sudo to run without a password, but when I try to ssh 'sudo Foo", I still get sudo: sorry, you must have a tty to run sudo. Why does this happen and how can I work around it?
3
votes
2answers
54 views

command substitution: /dev/stdin: Permission denied

Want to read whole stdin into variable. Don't want to spawn new processes. From bash manual: The command substitution $(cat file) can be replaced by the equivalent but faster $(< file). It ...
7
votes
4answers
17k views

How to restrict to run commands in specific directory through SUDOERS?

I can configure sudo (via the sudoers file) to allow a user to run the chown and chmod commands on any file or directory in the system. However, I only want to grant a user permission to run these ...
8
votes
4answers
2k views

How does Bash path completion work with sudo?

Tab path completion does not work (at least on Ubuntu and AFAIK Arch) with sudo mount <whatever> The iso file I am trying to mount is not in /etc/fstab. If I just type mount <whatever> ...
5
votes
3answers
524 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 the salt command. The following line has been added into ~/.bashrc: complete -o default -o nospace -W "$(sudo ls -1 ...
2
votes
5answers
29k views

Username is not in the sudoers file. This incident will be reported

I am running Ubuntu 12.04 on my laptop using VMware Player. I am not sure why but I have an account called "User Account" in addition to my account that I usually login to use Ubuntu. Well that was ...
0
votes
1answer
16 views

Install script - sudo authorisation compatibility?

I am currently updating a few scripts, and am planning on releasing some useful ones so others can use them (so they need to work across a wide range of machines without crashing, and without breaking ...
2
votes
3answers
633 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 ...
0
votes
1answer
13 views

How to configure a user in sudoers such that the user can install app and can't access a specified directory

I want to add a user to sudoers, such that the user can do anything in root permission but: The user can't use mount command; The user can't access(read or write) to directory /home/protecteddir; ...
0
votes
2answers
21 views

Understanding Privileges in Sudoers File

I'm trying to make sense of the sudo documentation on the Debian Wiki. On it, it uses the two examples below. However I don't understand the difference between them. Why has the group sudo got ...
0
votes
2answers
37 views

Script works without sudo, fails with sudo

When I launch this script: #!/bin/bash -v sshpass -p '<pypasswd>' scp blah.img root@myip:/home/user/blah.img exit 0 with ./script.sh or nohup ./script.sh & it works. But when I do ...
44
votes
8answers
67k 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 ...
0
votes
2answers
28 views

Can't add sudo privilleges to a user

This is my first time with Debian and I don't really understand how to grant myself sudo access. I have a fresh install with a root password and a normal default user. I just want my normal default ...
2
votes
1answer
2k 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 ...
8
votes
4answers
14k views

Trouble with running cd with sudo as another user

I want to run a command on a shell on behalf of another user. The command is as follows: sudo -u USER cd /home/USER I get sudo: cd: command not found What is the correct syntax for the command ...
0
votes
1answer
870 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 ...
1
vote
2answers
34 views

sudo / su to user in a specific group

I am looking to setup a generic user that has the ability to su/sudo to any user in a specific group. Either that or to any user that has a specific naming scheme. Is this possible on linux? I ...
0
votes
1answer
35 views

pam_unix(sudo:auth): auth could not identify password for [asteriskpbx]

to install the asterisk program, I created a sudo user and added to /etc/sudoers file like this: asteriskpbx ALL=(ALL) NOPASSWD: ALL but, when I try to start the service, I get the following ...
1
vote
1answer
136 views

Why can't I use sudo on OpenBSD?

I'm running OpenBSD 5.7 on VirtualBox on my Windows 7, to learn more about Unix, but I can't use sudo with my password. I've set up a user called adminvpn but when I try to run any command using sudo ...
0
votes
3answers
28 views

switch to sudo user with AND command doesnt work

I am trying to copy the ssh private key from one user to another user in single shot. sudo su && cp /home/sk/keys/master.pem /home/sg-user/keys/ This command works well, when i run them one ...
2
votes
2answers
2k 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: ...
4
votes
1answer
3k views

Can edit file as root, but not using sudo

I just faced a really strange situation. I was trying to edit file /usr/lib/thunderbird/thunderbird.sh, which has the following permissions: $ ll /usr/lib/thunderbird/thunderbird.sh -rwxr-xr-x 1 ...
1
vote
1answer
50 views

Why sudo user can use sched_setscheduler SCHED_RR while root can not?

I am running Arch Linux on a Raspberry Pi 2. I have a user-space program that uses Gordon's wiringPi library and, in particular, the piHiPri() function that attempts to set the highest priority for ...
5
votes
2answers
6k 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 ...
1
vote
2answers
57 views

Prompt for sudo password rather than give access error

Can I configure Fedora 22 so anything needing root privileges asks for a password, rather than giving an error, and needing me to re-run with sudo? I wouldn't even mind having to type my password ...
1
vote
2answers
25 views

Disallow `apt-get`, `yum` to install setuid binaries when itself run via sudo

Assume you can install something on a system because you have sudo rights to do so, but only have sudo rights for the installer. In that case it is fairly easy to create a package that installs a ...
1
vote
3answers
58 views

Use alias after issuing sudo su command

I am on AIX 7.1. I have a bunch of aliases defined in my personal .profile. alias df='df -k' alias cl=clear alias h=history alias ll='ls -al' alias lt='ls -latr' alias ls='ls -Fa' alias psj='ps -ef ...
0
votes
1answer
44 views

What are the best practices for permissions and and methods for generally avoiding using sudo? [closed]

The main point is that I only want one user to have sudo access - really only for use in set up and emergencies. I don't even trust myself with sudo access all the time. Are there best practices ...
0
votes
1answer
27 views

Does sudo documentedly handles characters after backslash on all UNIX-like systems? - for breaking long lines

In general, you can put a "\" at the end of your long command/line to break it to several lines. The sudoers syntax allows this too, that's OK. But: If there is an ex.: "space" after the "\" ...
0
votes
0answers
11 views

System problems after trying to fix touchpad

I have an acer 720p chromebook and the touchpad doesn't work after installing Uberstudent (based on xubuntu 14.04) After looking it up the internet link told me to run a script called ...
-4
votes
1answer
70 views

Problem with sudoers file. Syntax error at line 82, but cannot find exactly what? [closed]

I ssh'ed into my new Linux machine (no physical access) and I have root credentials. However, I cannot run sudo commands because of some error in the sudoers file made by someone else who logged in as ...
89
votes
8answers
14k 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 ...
0
votes
1answer
19 views

dhcpd restart command asks for password from command line but not from a script?

I have a script that runs and will ssh into another server to restart its dhcpd. In the script, the command literally is: sudo ssh -n $SERVER /sbin/service dhcpd restart This works fine when the ...
3
votes
2answers
5k 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 ...
4
votes
1answer
91 views

Is it safe for my ssh user to be given passwordless sudo for `apt-get update` and `apt-get upgrade`?

I have an SSH standard user account on my personal server, and it has sudo access (via its password). I ssh in using a public key, so I don't have to type in the account password to log in. Is it ...
0
votes
4answers
64 views

sudo for command with specific options

Is it possible to configure sudo to get root privilege to a user for running a program with some special switches? for example, how can I configure it for user admin to run netstat command as the root ...
27
votes
3answers
57k views

How to make Fedora user a sudoer?

I want to give a Fedora user sudo privileges. How do I do that?
1
vote
1answer
42 views

Why is sudo slow when I mistype my password? [duplicate]

If I'm asked for the sudo password, after typing it in correctly, the terminal moves on almost instantaneously. However, if I mistype my password, it takes a few seconds before working it out and ...
62
votes
20answers
10k views

Root access that can't change root password?

We are having a little problem on a server. We want that some users should be able to do e.g. sudo and become root, but with the restriction that the user can't change root password. That is, a ...
2
votes
1answer
81 views

Why sudo env is not showing all the environment variables?

I have a variable set in a script file in /etc/profile.d/somescript.sh I have modified the /etc/sudoers and added "ansible" user to the sudoers file like this: Defaults !env_reset ansible ...
6
votes
1answer
59 views

How can I make `sudo crontab -e` use my `sudoedit` environment?

I've started using sudoedit <file> instead of sudo vim <file>. One of the advantages is that it uses my local ~/.vimrc. However, when using sudo crontab -e, it uses /root/.vimrc instead. ...
1
vote
2answers
92 views

How to restore to permissions to sudoers file with no password?

The complete story: I launched an Amazon EC2 "Tier" (VPS) running RHEL 7.1 and created a key for ssh. EC2 automaticly crates a user called ec2-user for new Rhel VPSs, and it have the permissions (in ...
3
votes
4answers
14k views

How to login as root from Bash and do stuff

This is my simple bash: cat test.sh #!/bin/bash echo "hello" su - root -c /path/to/script.sh <<EOF password EOF whoami echo "good bye" But I get this error: ...
6
votes
2answers
5k views

sudo: ulimit: command not found

I was using ubuntu 12.04 ,on which I run ulimit -n ,it is showing 1024, I want to increase my open file limit from 1024 to 65535,so I tried the following command: sudo ulimit -n 65535 but i get the ...
0
votes
1answer
56 views

PAM timestamp - how to inspecting the /var/run/sudo/<user> file?

The centos documentation stated that: ... In the PAM timestamp scheme, the graphical administrative application prompts the user for the root password when it is launched. When the user has ...
0
votes
0answers
41 views

How to manage any command access privileges on debian linux

I am using Debian 7, and my desktop is xfce. I want to achieve managing any command on Linux. For example, executing /usr/bin/xfce4-taskmanager command would not require sudo privileges so any user ...
1
vote
0answers
36 views

Allowing sudo kill for remote user for recovery purpose. Security implications?

I'm planning to create user allowed to SSH in and with right to sudo kill in case something disables local terminal/keyboard/display etc. Would probably add ps and/or htop to the list, as well. I ...
3
votes
1answer
172 views

program needs to be run as root by any user and can be located anywhere

I have some program called foo that needs root privileges when it executes. foo needs to be able to be run by any user and can be located at any path. The reason this program can be at any path is ...
2
votes
2answers
123 views

how to pass environment variable to sudo su

I basically need to do this: DUMMY=dummy sudo su - ec2-user -c 'echo $DUMMY' This doesnt work. How can I pass the env variable $DUMMY to su? -p doesnt work with -l.