Skip to main content

Questions tagged [sudoers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
88 views

How to execute a sudo NOPASSWD: allowed command from a binary executable?

I need a guru hint. Here is my sudoers file: myuser ALL=(root) NOPASSWD: /usr/bin/systemctl start my-service My problem is that when I run myuser@machine:~$ /usr/bin/sudo -u root /usr/bin/systemctl ...
Abdulkarim Mousa's user avatar
1 vote
0 answers
30 views

How to run a specific command as another user, without password, including passing arguments?

Due to the complex nature of Postfix sending mail as a custom user@address, and its interaction with openDKIM, when I send mail from bash, I execute a script mailSender.sh containing : TO=$1 USER=$2 ...
BrownianBridge's user avatar
0 votes
0 answers
42 views

Sudo privileges without access to others home dir - Debian Linux Server

I'm new to Linux server management and I have a small Debian server. I want some users to have sudo privileges such as installing a new package and etc. but I don't want them to be able to access or ...
CryptoRythmer's user avatar
0 votes
1 answer
92 views

Prompted for password after updating sudoers with NOPASSWD

My user is saroh and I need to be able to start the service crs_svc as user notify without being prompted for password. The command to accopmlish this is sudo -u notify /bin/systemctl start crs_svc ...
saroyr's user avatar
  • 3
0 votes
0 answers
59 views

sudo visudo in a Dockerfile with CentOS base image

I am creating a Dockerfile using the centos:7 base image. I need to edit the file at etc/sudoers and append NOPASSWD privileges to it for a new user and some groups. I have looked up in forums that ...
cumulo2nimbus's user avatar
0 votes
0 answers
48 views

How to restrict user to only certain domains with qemu:///session libvirt wtihout polkit?

How can I restrict users to starting user mode vms to specific domains? I don't want to use polkit for this, but I'm not sure it can even be used for delegating access to users running executables ...
ift-436t's user avatar
0 votes
2 answers
270 views

Why does sudoers.d ignore filenames with dots in them?

by default sudo parse config files in /etc/sudoers.d/* whose filename does not contain . and ~ , meaning user.conf is ignored and user_conf is parsed. Why does /etc/sudoers.d ignore files with dots in ...
hanshenrik's user avatar
  • 1,797
0 votes
1 answer
296 views

set system time without password

I have a (generally) off-network machine that has time info streaming through serial from GPS. I've captured that info and I'm trying to automatically update my system time using sudo timedatectl set-...
SBFRF's user avatar
  • 1
0 votes
0 answers
30 views

Param Cmnd_Alias bypass with script

I tried config de param NOEXEC in sudoers for ban the excution of certains programs, by example; Cmnd_Alias NOEXEC=!/*/bin/cp visudo But, if create a script with the command cp /usr/sbin/visudo , i ...
jllustres's user avatar
0 votes
1 answer
74 views

sudo for just one command IN lost+found folder, not more

I have this script # check lost+found folders function chklnf { #DOC echo "chklnf - list any files in lost+found folders on mounted devices" x="lost+found/" if [ "$EUID" != 0 ] ;then ...
Hannu's user avatar
  • 9,704
0 votes
1 answer
598 views

useradd not working for user despite having changed /etc/sudoers

I added a user to etc/sudoers with visudo with the goal that that user could add another user on a Ubuntu 22.04.3 LTS system. This is the line I added: hf99 ALL=/usr/sbin/useradd, /usr/sbin/userdel, /...
appfrosch's user avatar
  • 103
0 votes
1 answer
322 views

Why do `sudo` and `sudo -i` treat NOPASSWD differently?

I have an account that needs to masquerade as other accounts seamlessly, like so: manager$ sudo -u worker_A echo hello from worker A hello from worker A manager$ sudo -u worker_B echo hello from ...
Daniel McLaury's user avatar
0 votes
1 answer
348 views

Switching to su if you have no password

Ubuntu 22.04 Logged in as the ubuntu user, using an ssh key, I did: sudo su adduser test --disabled-password sudo su deploy So now, test is in the sudo group, and it has no password. I added the ...
EastsideDev's user avatar
0 votes
0 answers
750 views

Allow execution of shell script as different user from sudoers

User A (no general sudo permission given) shall execute a bash script as user B. One minimal script could look like this: #!/usr/bin/env bash touch /home/userB/testfile This script belongs to user A ...
Jannek S.'s user avatar
  • 113
0 votes
1 answer
847 views

sudo to allow apt-get install of remote packages, but forbidding arbitrary commands

I'm looking for a way to allow a user to install (only remote) packages via apt-get (or another mechanism?) but not allow them to run arbitrary commands as root. I can get some of the way there via /...
Michal Charemza's user avatar
2 votes
1 answer
21k views

Error with sudoers_audit plugin

I have one problem with sudo. When I run sudo in regular account I get: sudo: PERM_ROOT: setresuid(0, -1, -1): Permission denied sudo: error initializing audit plugin sudoers_audit But I commented ...
Running Child's user avatar
1 vote
0 answers
621 views

How to manage sudoers file when dealing with multiple similar rules?

When I add a rule in the sudoers file, how can I know that I will not override and invalidate it in another future rule addition? I don't want to eye-inspect the sudoers file and preferably things are ...
aderchox's user avatar
  • 266
2 votes
1 answer
10k views

How do I get to root on pfSense?

I am running pfSense 21.05.2 in AWS. I can ssh in as ec2-user, and I can see that the sudo package (0.3_6 with a dependency on sudo-1.9.7) came pre-installed. In the web interface, under System > ...
Gordon Fogus's user avatar
0 votes
1 answer
83 views

How to change default permission of file

I have 2 Debian machines. ======== Debain Machine 1=========== $ sudo install -m 0755 -d folder/kumar $ echo "something" | sudo tee -a folder/dict/file something $ ls -lcrt folder/dict/ ...
Pravin.2087's user avatar
2 votes
1 answer
297 views

Modify sudoers to bypass password requirements but it's not taking effect

I need to run a script with sudo without entering my password. I'm editing /etc/sudoers (using sudo visudo) and on the last line, I'm adding: MY-USER-NAME ALL=(ALL) NOPASSWD:ALL I just want to make ...
Amir's user avatar
  • 135
1 vote
0 answers
208 views

Is it possible to run a script which requires elevated permissions from inside zshrc without password prompt

I am trying to put a script in my .zshrc that alters the fn key settings on my keyboard. This is done by altering a value inside a read only config file, and I have successfully done it with the ...
msmit's user avatar
  • 11
0 votes
2 answers
2k views

Debian - user is not allowed to execute '/usr/sbin/reboot'

So I installed Debian 10.9.0, graphical install, logged in as the user I created. I can't do sudo commands with that user. (not in sudoers group) So I do su, type in the password. Then do sudo ...
theerrormagnet's user avatar
2 votes
1 answer
2k views

Sudoers: alias already defined "<garbage>"

I defined the following file in /etc/sudoers.d/50-apps Cmnd_Alias APPS=/usr/bin/systemctl start app-*, /usr/bin/systemctl stop app-*,\ /etc/init.d/app1, /etc/init.d/app2 Cmnd_Alias ...
PiotrP's user avatar
  • 21
1 vote
0 answers
1k views

FreeNAS remote shutdown

I want to write a program that remotely shuts down my TrueNAS server. When I enable sudo for the user myuser, the command ssh myuser@hostname -t "sudo poweroff" is actually enough. But I don'...
Elektropepi's user avatar
0 votes
1 answer
2k views

usermod command is not working despite giving permission in sudoers file

i have given linda user to run 2 commands (useradd & usermod) from the sudoers file, i successfully ran the useradd command but the problem is i can not run usermod command, i have checked ...
csx4's user avatar
  • 217
0 votes
0 answers
1k views

How does google cloud setup sudoers for googlecloudshell user without adding it to the /etc/group file

I am not a new user on unix and linux. Before today I know everything works needs a logical configuration to make it work. But today, when I create ubuntu instances on google cloud, I found something ...
Scott Lai's user avatar
4 votes
2 answers
2k views

Where is the sudoers file on Debian 10?

There is a server that was setup a while back, and I need to change a few settings, one of which is a user with super user privileges. However, everywhere I look tell to use visudo, or edit /etc/...
Yanick Rochon's user avatar
1 vote
1 answer
3k views

Let a single user execute a command without sudo password

I have already searched and found the many answers to this, but I still can't get it to work. This is on a debian 9 system - I have created an alias and a shell function in the profile: alias lscron='...
j4nd3r53n's user avatar
  • 399
3 votes
0 answers
2k views

Auto mount veracrypt partition after login - without root password

I'm working on a debian-based linux machine (MX linux), trying to automate the mount process for a veracrypt encrypted partition, right after user login - and it won't work and i don'k know what to do ...
xph's user avatar
  • 370
0 votes
1 answer
290 views

remote execution of command failing due to sudo issue

i am running a command from my server which would remotely ssh to by client machine as root and sudo as olcne user and run few commands for validation. I have added the olcne user in sudoer list. i ...
user1115980's user avatar
2 votes
2 answers
3k views

linux sudoers not work on command `su`

I want to disable command sudo and su for user in group staff. So I put this in /etc/sudoers: %staff ALL=ALL, !/usr/bin/sudo,!/usr/bin/su But I found, only sudo work, su still work for user in ...
Joshua Lee's user avatar
2 votes
1 answer
2k views

sudo -l and sudo -ll output

sudo -l gives me output: User test may run the following commands on server: (root) NOPASSWD: /usr/bin/vim /usr/bin/motd sudo -ll gives me output: Sudoers entry: RunAsUsers: root Options: !...
Paku's user avatar
  • 161
0 votes
1 answer
3k views

Solved - sudo into user instead of root with rundeck

i'm configuring a server for some bioinfo analysis on Centos7 and i installed rundeck. Rundeck seems to launch scripts as its own account name and i decided to use the sudo bypass to make it access my ...
ul.Duc's user avatar
  • 3
0 votes
2 answers
1k views

Parse error in sudoers after giving sudo access without password

I am making a desktop application for Linux that interacts with some Ubuntu system files. As such, during the end-user's installation of my software, I need to generate a file in /etc/sudoers.d/ ...
JeremiahDuane's user avatar
1 vote
0 answers
28 views

sudo asks password although there is nopasswd parameter [duplicate]

I edited the sudoers file like below: myuser ALL=(ALL) NOPASSWD: ALL newuser ALL=(ALL) NOPASSWD: ALL There is no another line that contains "myuser" in sudoers file. But ...
Jo Shepherd's user avatar
3 votes
1 answer
4k views

Add a user with permissions to install programs but without permissions to access the directories of other users

I need to create an user in a Linux system with permissions to install programs but without permissions to access the directories of other users. I've tried to do this: # Create restricted user user ...
Kroka's user avatar
  • 131
0 votes
1 answer
202 views

Debian - Let service read protected file

First things first, OS: Debian 10 I've created a systemd service that runs at startup. It needs to be able to read from a file that needs to be protected. Correct me if I'm wrong, but it seems like a ...
The Renaissance's user avatar
0 votes
1 answer
684 views

a change with visudo doesn't work

I issue visudo command, add this rule to the very end of the file, save the file and quit. newuser ALL=/usr/sbin/useradd However newuser is still able to run such commands as sudo touch file1 ...
Tomas.R's user avatar
  • 195
1 vote
1 answer
7k views

Changed root / file ownership, any way back?

I have made a typo and ran chown -R username /* instead of ./* as a root, and messed up everything. Now, can't login as a root and change the ownerships back. Any way to repair without having to ...
Sahil Gadimbayli's user avatar
6 votes
2 answers
35k views

Can someone explain what is `<user> ALL=(ALL) NOPASSWD:ALL` does in sudoers file?

I know that that line above allows <user> to run sudo command without having to type in the password. But what does the syntax actually mean? If you can link to an article then that would be ...
Nabeel Parkar's user avatar
0 votes
1 answer
1k views

sudoers sudoedit recursive wildcard

I want to allow editing any file (recursively) under specific directory via sudoers. None of the below works (Debian 9 sudo) ops ALL=(root) NOPASSWD: sudoedit /opt/myapps/ ops ALL=(root) NOPASSWD: ...
bobah's user avatar
  • 291
0 votes
1 answer
2k views

Unable to use sudo

I'm connecting via SSH to a Centos 7 machine. I have a user that cannot perform any command as super user. If I do: $ sudo ls / I get the error: "sudo: unable to fork: Resource temporarily ...
Haniver's user avatar
  • 101
0 votes
1 answer
6k views

Allow php to run shell script with sudo permission

command php -v is working when I execute simple shell_exec('./script.sh'); but when I use sudo it doesn't work without sudo service stop command is not working. var_dump(shell_exec('sudo bash ./...
Bot Digit's user avatar
1 vote
1 answer
3k views

grant access to a command only for certain arguments (chown for a path)

I have a script that require to change the owner recursively in a folder there is my specific sudoers file: /etc/sudoers.d/jenkins jenkins ALL=(ALL) NOPASSWD: /bin/chmod, /bin/chown and this is the ...
Antonio Fernandez's user avatar
0 votes
1 answer
93 views

How to fix script to umount device without password?

I have added a file named: umountscript to /etc/sudoers.d/ with this directive: xikri ALL=(root) NOPASSWD:/home/x/umountscript.sh inside umountscript.sh I have this code: umount /mnt/devicex But ...
Carlos's user avatar
  • 33
1 vote
1 answer
1k views

Abuse suid program

I have some questions about setuid binary. I know it exists some dangerous program (if you permit to use this program with sudo, it is possible to escape from the program and get a root shell) like ...
madem's user avatar
  • 11
0 votes
1 answer
41 views

Sudoers Command

I can't understand the difference in this two command's USER ALL=(ALL) NOPASSWD: ALL AND USER ALL=(OTHERUSER) NOPASSWD: ALL Can anyone explain the () change? Thanks
Pedro Macedo Vilas's user avatar
1 vote
0 answers
960 views

Error installing Sudo on Debian

I'm trying to install sudo on Debian. At first I logged as root and then apt-get install sudo when I open nano /etc/sudoers it is an empty file. Here is a screenshot of my apt-get install sudo. Does ...
Scrubby's user avatar
  • 11
0 votes
0 answers
260 views

Locked out while setting up nginx

It's my first time trying to setup a web server. I was trying to set up a Digital Ocean Droplet running CentOS. During nginx setup, I 'accidentally' changed the permission of '/' to the nginx user, ...
Márton Pitó's user avatar
0 votes
0 answers
476 views

Su/sudo not working consistently

I am running Debian on a Lenovo x220 and upgrade my packages quite regularly. I discovered recently a change in the way how I elevate with sudo. Normally I just su or sudo stuff like e.g. arp-scan -l. ...
Victor's user avatar
  • 11