Questions tagged [visudo]

visudo is the command used to edit the sudoers file

visudo is the command used to edit the file

35 questions
5
votes
1 answer

visudo nopasswd not working

I am trying to allow all users in the admin group to run a jar file as SUDO without a password, I have edited the sudoers file (using visudo) and tried a number of commands but it still prompts me for a password every time Contents of…
DaveB
  • 2,953
  • 7
  • 38
  • 60
3
votes
1 answer

Making a Python script run with root privileges

I have a Python script that needs to mount disks on an Ubuntu server without root privileges. I made the script executable (with #!/usr/bin/env python). I also renamed it to '.sh' (probably not important), and chmod it to be executable. Then, I…
ShaharA
  • 860
  • 8
  • 19
1
vote
1 answer

timeout error message when running sudo visudo

I was trying to install yabai on my Big Sur mac, and ran into an issue when trying to do visudo. After some playing around, I found that I was running into issues even with just sudo visudo (i.e., the problem isn't with yabai): ❯ sudo visudo Timeout…
ymhan
  • 63
  • 1
  • 4
1
vote
1 answer

Edit visudo using vim called from a script

I created an automated install script and while executing from the chroot I would like to uncomment the wheel group line. I could do it using sed -i "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/g" /etc/sudoers but I read that is not the best…
1
vote
1 answer

Allowing a guest user to run a script with elevated privileges

Using ubuntu 16.04LTS I am trying to allow a guest user who does not have sudo powers to reload nginx whenever they need to by executing a simple script: #!/bin/sh nginx -s reload which has permissions -r-xr-xr-x and allowing them to do that with…
Stregian
  • 31
  • 6
1
vote
1 answer

Grant permission for only specific sh file with visudo

I want to run an sh script from php. For this, i need to open visudo file: sudo visudo With this: www-data ALL=(ALL) NOPASSWD: ALL It works! But I dont want to enable all command, just a specific sh script. So i changed it to: www-data ALL=(ALL)…
bbenhu
  • 23
  • 4
1
vote
2 answers

How can I designate the editor for visudo?

I executed these two commands: export VISUAL=/usr/bin/vim export EDITOR=/usr/bin/vim And I checked if they were correctly updated by env. But I get a strange editor when I run sudo visudo. Though I do not know the editor, at the bottom of the…
jun
  • 27
  • 4
0
votes
0 answers

Visudo for multiple files in directory

I have a script that runs from user that don't have permission for read\etc files in directory and script uses command below: sudo /bin/find /var/log/some_logs -name "*access.log" There is a pack of logs which names like bla-bla-access.log, I want…
0
votes
1 answer

How to edit /etc/sudoers file from a golang application safely?

i want to give some user sudo access from my golang application. but in the sudoers file i saw the line "# This file MUST be edited with the 'visudo' command as root.". because when we edit sudoers file with visudo it will check for syntax error…
Siva
  • 1
  • 1
0
votes
1 answer

How can I give www-data permissions to run a .py script with sudo from an index.php?

I have a script in /var/www/Web-EvilBlock/EvilBlock.py It needs to have sudo permissions to work My problem is that from my web page in php, I have a button that executes that .py script, but it doesn't work.(Need sudo permissions) The only way…
electro
  • 11
  • 3
0
votes
1 answer

How to: sudo -u in sudoer?

I need to launch a command with sudo rights out of a php file (user: www-data), explicitly as user www-data: to be able to use sudo for…
Dominic
  • 440
  • 8
  • 22
0
votes
0 answers

Syntax Error in etc/sudoers and can't edit it in terminal

I was/am trying to run terminal commands without having to use sudo first and must have broke the file. Now I'm trying to fix it and it's giving me this error when I try to edit with the same sudo visudo command. /etc/sudoers: syntax error near…
alcoven
  • 321
  • 2
  • 14
0
votes
1 answer

sudoers NOPASSWD not working - Ubuntu 20.04

I know this question was often asked before, but it's not possible for me to get it working. I want to shutdown the system without entering a password with user holmer I added the following line holmer ALL=(ALL:ALL) NOPASSWD: /sbin/shutdown…
Florian K
  • 29
  • 1
  • 4
0
votes
1 answer

Which user is AppleScript using when executing scripts

• Here is the script to be executed via AppleScript: bash-3.2$ cd /Users/jack/Desktop/ bash-3.2$ ls -l | grep static -rwxrwxrwx 1 jack admin 65 5 May 08:10 static-routes.sh bash-3.2$ cat static-routes.sh #!/bin/bash sudo route -n add -net…
readonly
  • 89
  • 7
0
votes
1 answer

Add command to visudo with dynamic parameters

I've writen a perl script that needs sudo rights, but it accepts parameters that are always different. eg sudo /home/user/script.pl user I guess adding this to visudo will not work. Is this possible? If not I was thinking about maybe using…
TheChosenOne
  • 181
  • 1
  • 1
  • 8
1
2 3