sudo - Execute a command with superuser privileges.

learn more… | top users | synonyms

3
votes
2answers
98 views

`sudo -u user` in shebang line

I'd like to be able to run a script as another user, and only as that user. The way I currently have this set up is to have alice ALL = (bob) NOPASSWD: /home/alice/script.sh in the sudoers file ...
0
votes
2answers
48 views

Granting a 'normal' user ability to mount a drive (visudo)

I am running a server on AWS that requires a storage volume to be mounted on an as-needed basis. I need 'normal' users (those without any sudo privileges etc.) to be able to mount this drive and ...
1
vote
0answers
55 views

BASH dd problem

i am trying to learn bash and now im trying to do a script for burning isos. I made the number "4" command to make sure the variables were right. the message i get when i complete my program and ...
4
votes
1answer
120 views

Launch a sudoed command upon script termination?

I'm coding a bash script that: runs some sudoed command at initialization releases root permissions for security purposes (sudo -K) runs an unprivilegied program but needs root permissions when ...
4
votes
1answer
280 views

/proc/net/wireless does not show values unless run as root

cat /proc/net/wireless does not show statistics for wireless devices unless it is run as root, even though the permissions on the file are 444. The same seems to apply when accessing statistics via ...
1
vote
1answer
48 views

Variable expansion in sudoers file

Under /some/long/and/annoying/path I have several scripts I need to give sudo access to, so I write in my /etc/sudoers (A): Cmnd_Alias MY_SCRIPTS = /some/long/and/annoying/path/foo.sh, \ ...
1
vote
2answers
29 views

Is there a log for errors for process that reads the sudoers file?

On Ubuntu 14.04 or CentOS: If I'm editing the sudoers file and I make a mistake or something, is there a log file that I can check to see if there are any errors?
4
votes
2answers
5k 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 ...
2
votes
2answers
243 views

How to gain sudo access after powerwashing (factory resetting) my computer?

I just powerwashed (that's a factory reset on chromebooks) my computer so that it would be be 'brand new,' however now I don't have sudo access anymore. I used to not need a password to use sudo, ...
0
votes
0answers
30 views

Workaround for running privileged commands from www-data user

I would like to append a string to a file located in /tmp/ from a php script. The command I would like to execute is: sudo sed -e 's/$/,yes/' -i /tmp/a.csv The Problem I can't run a sudo command ...
1
vote
0answers
81 views

How can I switch from one user to another user inside a script?

.The issue is my id 'aaa' can read only the file name and not the contents inside it when I log in with my id "aaa". So to read the contents I have to switch to another user "bbb" which is having ...
9
votes
3answers
5k views

How could we allow non-root users to control a system.d service?

With sysvinit, a sudoers entry like this would suffice: %webteam cms051=/sbin/service httpd * This would allow for commands such as: sudo service httpd status sudo service httpd restart Now, ...
0
votes
2answers
74 views

First line missing in concatenation of SSH output [closed]

I am trying to concatenate two strings in bash script but I am not able to get the expected result, USERNAME="ubuntu" MASTER="some IP" KEYFILE="/Path/to/keyfile.pem" STR1=`sudo ssh -q -t -o ...
1
vote
0answers
50 views

Why does LXC-create returns error “sudo.conf should be 0”?

I try to create an unprivileged container and nothing works as expected. Here is my code : follows that tutorial #!/bin/bash sudo apt-get update sudo apt-get dist-upgrade sudo apt-get -y install ...
0
votes
1answer
55 views

Sudo cron job using arp-scan gives empty output

I made a script called hello.sh and it contains the following: #!/bin/bash printf "$( arp-scan --interface=eth0 --localnet )\n" printf "test\n" after making it executable (chmod o+x) and running ...
1
vote
2answers
39 views

How can I execute a script as root, execute some commands in it as a specific user and just one command as root

I would like to execute a script as a normal user and execute a command that shuts off apache (which needs a root password). I was wondering if is possible to run the script with sudo but it ...
0
votes
0answers
44 views

Is there a (256) character limit on linux/ubuntu user passwords when using sudo?

[I'm no expert in Linux.] When creating a user that I would rarely use the password on, I used an extremely long password (500 characters). Everything seemed fine, until I used sudo for the user and ...
0
votes
3answers
54 views

Execute command after GUI-application has started

I have to use a home-built tool at my company which requires 'root' privileges. To make things worse, it's a GUI application. Normally, I wouldn't execute such things, but I don't have much of a ...
0
votes
2answers
62 views

bash file permission error while appending to a file [duplicate]

I am installing Voipmonitor whose setup script has this step: sudo echo " * * * * * root php /var/www/html/php/run.php cron" >> /etc/crontab I am getting this error -bash: /etc/crontab: ...
1
vote
1answer
101 views

debian 8.2 can no longer su to root

If I try to "su root" with an incorrect password, I get the expected 'authentication failure'. If I try to with the correct password, I get 'setgid: Operation not permitted" I have tried the usual ...
30
votes
3answers
23k 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 ...
1
vote
0answers
35 views

Run mkvirtualenv command as another user

I want to run the "mkvirtual sth" but I have to run the script as superuser. sudo ./install.sh install.sh looks like this: # ... mkvirtualenv sth # su - geeret -c "mkvirtualenv sth" # (tried ...
10
votes
2answers
1k views

Cannot expand asterisk without proper permission

Can someone explain to me the following? $ ls -ld /temp/sit/build/ dr-xr-s--- 3 asdf qwer 4096 Jan 31 2012 /temp/sit/build/ $ ls -ld /temp/sit/build/* ls: /temp/sit/build/*: Permission denied So ...
0
votes
1answer
14 views

Setting www-data (lighttpd) as sudoer not working

I have installed lighttpd with fast-cgi on the raspberry pi. When running a python script that requires root priveleges, I get the following error: RuntimeError: No access to /dev/mem. Try running ...
5
votes
3answers
58k views

How to properly configure sudoers file, on debian wheezy?

I have seen many blog posts that say, it is enough to do aptitude install sudo su root adduser USERNAME sudo But that only protects aptitude, in other words: aptitude install sendmail will ask ...
4
votes
4answers
1k views

What is the best way to add a user to the sudoer group?

So far I have found four different ways to add a user to the sudoers group and not all methods work in all systems. Why so many different implementations? What is the best? What is the standard (i.e. ...
0
votes
0answers
72 views

Unable to use Nautilus

I've got Trisquel 7 GNU/Linux distro, with GNOME 3.8.4. I'm finding impossible to create a folder in Nautilus, or drag and drop files into the Desktop, out of other options. I find this quite ...
1
vote
1answer
85 views

How do I maintain sudo in a bash script?

If I run this script, how do I pass super user permissions to it? I wrote this just to setup new machines with the basics. I don't want to run every command with elevated permissions, but the commands ...
28
votes
2answers
20k views

What is the proper sudoers syntax to add a user?

According to the comments in /etc/sudoers (Fedora 13): ## Syntax: ## ## user MACHINE=COMMANDS ## ## The COMMANDS section may have other options added to it. My two related questions: What ...
3
votes
1answer
212 views

How to use sudo -u option?

I have 2 users, userA and userB. userB needs to run some commands as userA. I have specified these options in /etc/sudoers as below: userA ALL=(ALL) ALL userB ALL=(vinoth) /sbin/fdisk I ran this ...
3
votes
1answer
134 views

sudo script - best practice?

I have a script in which some of the commands need to be run as sudo. I have seen it asserted that running sudo inside scripts is a bad idea, and that is is better to run the whole script as sudo (and ...
1
vote
1answer
24 views

Getting syntax error in sudoers file I don't understand

I have an embedded system with the root mounted as read only. I want to set up so my sudo users are able without a password change the setting (I plan to use the commands in the login and logout ...
2
votes
1answer
79 views

Strange bash script behaviour

I have two bash scripts, which are binary identical, have the same permissions, are unique on my drive and are not found in sudoers. Still one passes the uid test for root, the other one not. If I ...
1
vote
1answer
59 views

Running a Bash expression from sudo

I can list my recent apt-get history with:- zcat /var/log/apt/history.log.1.gz I am trying to automate this for all history files. I tried: sudo for logf in $( /var/log/apt/history.log.?.gz ); do ...
8
votes
1answer
1k views

First sudo always slow

The first sudo I enter on my Ubuntu 14.04 server is always slow. The password prompt displays immediately, but after I press enter it takes about 10-15 seconds until the output is printed. All sudo ...
1
vote
0answers
26 views

User can sudo although he is not in sudo group nor in /etc/sudoers

I have two colleagues on a Red Hat Enterprise Linux Server (release 6.4). Both of them can execute the sudo commands. Curiously, only one of the colleagues is in the /etc/sudoers file - let's call him ...
1
vote
2answers
113 views

Why do I still need to run shutdown as sudo after this?

I'm running Linux Mint 17.3. By default, running shutdown or other commands like reboot, poweroff requires root privilege. So I added the following line lesaff_b ALL=(ALL) NOPASSWD: ...
112
votes
6answers
40k views

Where did the “wheel” group get its name?

The wheel group on *nix computers typically refers to the group with some sort of root-like access. I've heard that on some *nixes it's the group of users with the right to run su, but on Linux that ...
-1
votes
1answer
60 views

Report of sudo usage

How do I get a report (either CSV or an Excel file) on who is using sudo on my machine, and which account they're switching to?
0
votes
1answer
38 views

Why doesn't 'sudo' skip hostname-checking when the command can be run on 'ALL' hosts?

The sudoers file provides a way to limit which "runas" entries apply to which hosts. When running a command with sudo, the hostname is checked against the hosts on which a "runas" entry applies. When ...
2
votes
2answers
82 views

OpenSUSE disabled root login (no root psswd set) >> yast, config issues

I disabled the root login on my system (blank password). Now I cannot configure my system from GUI (it asks for the root password). Everything is fine in CLI (e.g. launch yast2 from CLI works ...
0
votes
1answer
90 views

Add AD users to sudo group not working | CentOS 6.7

Just as the title states I am on CentOS 6.7 and want to add two domain admins to the sudo group. I have tried adding both users individully and both together see below: someuser ALL=(ALL) ALL ...
0
votes
1answer
188 views

How to fix a corrupt .profile file for sudo user

My knowledge on unix is very less. I updated .profile file for sudo user but some path was incorrect in that file. When I am trying to reconnect as a sudo user it does not recognize any commands and ...
1
vote
1answer
52 views

PermitRootLogin No and Sudo user – Where is the difference?

So, I've read that I shouldn't permit root logins by disabling them in my sshd_config. I understand how that might make a server safer, but if I have a user that is allowed to do "su root" and log ...
-3
votes
2answers
75 views

How are setuid, suid, sudo, and su all related? [duplicate]

I have a feeling the setuid bit, the nosuid mount option, sudo, and su are all related given their names. But how do they relate to one another? Are some of them used in conjunction? If they are not, ...
0
votes
1answer
53 views

How can I undo a 'sudo' command before entering the password?

I typed sudo [bad command]. The system is asking for my password. I do not want to run this command. How can I exit the password-request prompt?
2
votes
2answers
32 views

Lock A Built-in Application?

I know I am able to lock an application using: sudo chmod a-x /Applications/'Application'.app but I encountered a problem while trying to lock an application, like safari, which is built in. ...
-1
votes
1answer
28 views

Ask password in window mode after sudo or other command line operations?

Was seen in movies, that after command line operations, the password was asked in separate GUI window. From my (small) experience, password, required from command line, was always asked in command ...
3
votes
0answers
35 views

exists a “two-factor authentication” for sudo, if not how to make one anyway?

tl;dr normaly to gain root priviledges via sudo requires a special user account and the use of its passphrase as means to authetication. Due to keylogging/replay (in X.org session) attacks, I would ...
1
vote
1answer
146 views

Centos 6.7 broken Sudo

After installing devtoolset 2, it appears my sudo command is broken. readlink -f $(type -P sudo) /opt/rh/devtoolset-2/root/usr/bin/sudo I believe the commands I ran to install devtoolset2 ...