visudo is the command used to edit the sudoers file
Questions tagged [visudo]
35 questions
0
votes
0 answers
Efficient way to disable a user to sudo via puppet
I have puppet 6 installed in my environment and would like to ensure that the user centos cannot sudo on all of my agents. I can create somethings like this:
modules/sudoer/manifests/disable_sudo.pp
# Manage the sudoers file
class sudoers {
file…

Milan
- 21
- 4
0
votes
2 answers
SSHing from within a python script and run a sudo command having to give sudo password
I am trying to SSH into another host from within a python script and run a command that requires sudo.
I'm able to ssh from the python script as follows:
import subprocess
import sys
import json
HOST="hostname"
# Ports are handled in ~/.ssh/config…

user10096621
- 225
- 2
- 4
- 16
0
votes
1 answer
visudo nopasswd does not work for my command
I have tried most of the solutions to the other available questions, so please do not refer to them. None of them cover my case.
I am on Ubuntu-16.04 and I am trying the following command to run without password prompt:
/usr/local/bin/nanobox run…
user1329187
0
votes
1 answer
How to specify the rpm packages that a user can install using visudo?
I need to specify the prefix of the rpms that a specific user can install on a CentOS 7 server. For example, let's say that I have:
my_package_foo.rpm
my_package_boo.rpm
I thought that I could add this:
my_user ALL=NOPASSWD: /bin/rpm*…

Arthur Accioly
- 801
- 9
- 26
0
votes
1 answer
How to give sudo permission for user to run a script with process ID
I want to give sudo permission which does not ask a password while executing the script. The problem I face is I have to provide the process ID as argument while running the script. I have tried in visudo the following entry, but it fails and tells…

aravind
- 1
0
votes
1 answer
Run sh file from php with cron
I have an sh file with file-removing commands.
I run it from php like this:
shell_exec("sudo -n ./truncatefiles.sh 2>&1");
Thats works fine if I open the PHP file from browser, but doesnt work from scheduled cron tab.
PHP user: www-data
If i run…

bbenhu
- 23
- 4
0
votes
2 answers
LINUX php service restart not work
I need help, i have webinterface thar run this section in php:
$cmd="/usr/sbin/sudo /usr/sbin/service networking stop"
exec($cmd, $mes);
print_r($mes); #this is emptz message
$cmd="/sbin/ifconfig"
exec($cmd, $mes);
print_r($mes);…

M. Krupicka
- 11
- 5
0
votes
2 answers
how to fix broken sudoers file without root
How to fix broken sudoers file in rhel6, it's not allowing me to get into sudo
[bash ~]$ sudo su
sudo: >>> /etc/sudoers: syntax error near line 109 <<<
sudo: >>> /etc/sudoers: syntax error near line 109 <<<
sudo: parse error in /etc/sudoers…

anish
- 6,884
- 13
- 74
- 140
0
votes
1 answer
Enable passwordless sudo command using Visudo
I have a script called "rescan.sh" somewhere in my home directory. I created a symbolic link to the script and placed it in /usr/local/bin. The script does the following:
#!/bin/bash
sudo sh -c "echo 1 > /sys/bus/pci/rescan"
I need this script to…

Aeronaelius
- 1,291
- 3
- 12
- 31
-1
votes
1 answer
How to allow only one command for specific user in sudoers.d/user file
I'm trying to figure out the permissions for running ONLY specific number of commands (here /bin/ls cmd )for a user in sudoers.d/user file.
My sudoers./user file:
user1 ALL=(ALL) /bin/ls
the result after logout/login is that the user1 can run also…

Jeremy Acai
- 29
- 2
-1
votes
1 answer
Allow Apache to execute command in root?
I am setting up a bash/html CGI that will allow me to generate graphs with GnuPlot under RedHat 7.6.
My tutor ask me to create a cgi script that will be able to return a sudo id (root) without a password, only using the " id " command, not " sudo id…

Makmy
- 187
- 1
- 12
-1
votes
1 answer
How can I permanently grant sudo access to a user?
I created a service to automaticle initialize some scripts for me, but when I try to run, they do not work very well... keep asking my sudo password.
I tried to add my user on sudors with sudo visudo, but nothing changed.
My commands:
sudo…

Vitor Gonzaga
- 23
- 1
- 6
-1
votes
2 answers
Add line in visudo after root line
I'm testing some Ansible deployment and need to add ansible user to sudoers. Instead of editing I just every time copy this script:
echo 'ansible ALL=(ALL) NOPASSWD: ALL' | sudo EDITOR='tee -a' visudo
Which is adds ansible ALL=(ALL) …

user3428
- 37
- 1
- 8
-1
votes
1 answer
Executing sudo shell script by php
i am trying to execute pkill command by php script.
killengine.sh script runs fine from terminal, both with ./killengine.sh and php restart.php.
this is killengine.sh
#!/bin/bash
sudo pkill -f engine
and this is restart.php
$out =…

Aleks
- 45
- 9
-1
votes
1 answer
Linux/mac permissions as a jenkins slave
In short my jenkins on a slave machine can execute a program like for example ionic from the execute shell segment, although when I start it by executing a shell script .sh file then it says the command doesn't exist. Is that permissions related?…

kol23
- 1,498
- 3
- 16
- 35