Questions tagged [sudoers]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
13 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 ...
user avatar
0 votes
1 answer
31 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 ...
user avatar
0 votes
0 answers
31 views

Whitelisting approach for linux commands

I recently made a post about how to limit/restrict user commands in the linux shell Limiting sudo access However, a successful solution wasn't found, and I realized I might have phrased my problem in ...
user avatar
0 votes
0 answers
187 views

Limiting Sudo Access

I have been trying to limit sudo access so that the sudo-group only has access to certain commands. This is to ensure that only corporate matters are carried out through the terminal. To obtain this, ...
user avatar
0 votes
0 answers
56 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 ...
user avatar
  • 111
0 votes
1 answer
187 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 /...
user avatar
1 vote
0 answers
4k views

SUDO - 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 ...
user avatar
1 vote
0 answers
75 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 ...
user avatar
  • 218
0 votes
1 answer
2k 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 > ...
user avatar
0 votes
1 answer
40 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/ ...
user avatar
1 vote
1 answer
41 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 ...
user avatar
  • 115
1 vote
0 answers
64 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 ...
user avatar
  • 11
0 votes
2 answers
503 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 ...
user avatar
1 vote
1 answer
506 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 ...
user avatar
  • 11
1 vote
0 answers
626 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'...
user avatar
0 votes
1 answer
243 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 ...
user avatar
  • 13
0 votes
0 answers
280 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 ...
user avatar
3 votes
2 answers
1k 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/...
user avatar
0 votes
1 answer
151 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='...
user avatar
  • 317
2 votes
0 answers
866 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 ...
user avatar
  • 295
0 votes
1 answer
221 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 ...
user avatar
2 votes
2 answers
724 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 ...
user avatar
2 votes
1 answer
1k 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: !...
user avatar
  • 161
0 votes
1 answer
2k 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 ...
user avatar
  • 3
0 votes
2 answers
363 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/ ...
user avatar
1 vote
0 answers
22 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 ...
user avatar
2 votes
1 answer
699 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 ...
user avatar
  • 121
0 votes
1 answer
37 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 ...
user avatar
0 votes
1 answer
327 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 ...
user avatar
  • 165
1 vote
1 answer
5k 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 ...
user avatar
3 votes
2 answers
10k 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 ...
user avatar
0 votes
1 answer
585 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: ...
user avatar
  • 271
0 votes
1 answer
1k 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 ...
user avatar
0 votes
1 answer
4k 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 ./...
user avatar
0 votes
1 answer
617 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 ...
user avatar
0 votes
1 answer
65 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 ...
user avatar
  • 33
1 vote
1 answer
962 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 ...
user avatar
  • 11
0 votes
1 answer
37 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
user avatar
1 vote
0 answers
549 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 ...
user avatar
  • 11
0 votes
0 answers
167 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, ...
user avatar
0 votes
0 answers
325 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. ...
user avatar
  • 11
1 vote
1 answer
9k views

How to avoid "root is not allowed to run sudo"?

I am trying to execute some third-party installer script (ansible tower setup.sh) which needs to be started as root or via sudo as some of the commands rely on root privileges. However some commands ...
user avatar
7 votes
2 answers
9k views

Sudoers NOPASSWD for single executable but allowing others

Operating System: Arch Linux Linux version: 4.16.11 Sudo version: 1.8.23 What I need: be able to execute any executable with a sudo with a password prompt be able to execute one executable, /home/...
user avatar
0 votes
1 answer
874 views

Is there something like a sudoers list in Windows?

In UNIX-like systems, normal users can obtain higher priviledges using the sudo command (or they can temporarily switch the user using su). However, with a properly configured sudoers and PAM file, ...
user avatar
  • 163
2 votes
1 answer
39 views

Adding elevated permissions to scripts in a directory

I have a directory containing some scripts which I need to invoke from a web request. The scripts need elevated permissions to run. My current thinking is to add the following lines to /etc/sudoers: ...
user avatar
1 vote
2 answers
4k views

sudo inside docker (on fedora) ask for password, on host it doesn't ask password

I am testing something in docker, it requires sudo without entering password, I added required entries in /etc/sudoers. After that in host it doesn't ask for password. But in case of docker it still ...
user avatar
2 votes
2 answers
12k views

How to repair /etc/sudoers on OSX High Sierra

How I got here I installed an SSD drive after backing up my data. I installed OSX Maverick (because my laptop is circa 2014), and then I started copying over my data from user-2 to user-1 (because my ...
user avatar
  • 183
1 vote
1 answer
114 views

What is the purpose of %{seq} in sudo/sudoers?

I have the ability to configure IO logging for sudo by setting iolog_dir, and according to the sudoers man page, these are the following variables I can use: %{seq} expanded to a monotonically ...
user avatar
0 votes
1 answer
50 views

How in sudoers verify specific input adding to the script

I have one script that is taking as an input IP address. My question is, can I specify in sudoers what input can be added to my script. Now I'm doing like that: user ALL = !ALL, /bin/sh, /home/user/...
user avatar
  • 113
1 vote
1 answer
301 views

sudo -u <user> <cmd> vs sudoedit

I have read on the internet that you have to use sudoedit instead of sudo vim. I understand why this is and should be used so you can't just edit root-user files. However I would like to manage a ...
user avatar
  • 11