Questions tagged [visudo]
visudo edits the sudoers file in a safe fashion
85
questions
314
votes
18
answers
558k
views
How to modify an invalid '/etc/sudoers' file?
How do I edit an invalid sudoers file? It throws the below error and it's not allowing me to edit again to fix it.
Here is what happens:
$ sudo visudo
>>> /etc/sudoers: syntax error near ...
211
votes
2
answers
226k
views
How to change visudo editor from nano to vim? [duplicate]
When I use visudo, it always opens it with nano editor. How to change the editor to vim?
48
votes
3
answers
17k
views
What are the differences between sudo, su, visudo, chroot, and gksu?
What are the differences between sudo, su, visudo, chroot, and gksu ?
37
votes
4
answers
22k
views
Change the default editor when sudo visudo
When doing sudo visudo, the default editor is nano.
I want to change it to vi or vim.
I already made vim the default editor, and use it as a substitute for gedit to open php, .txt, .c and .h files,...
18
votes
1
answer
4k
views
Get email notification for using 'sudo' by a specific user
I have a server set-up and I let somebody that I trust with a little bit of sudo access have it. However, I also want an email anytime that they use sudo.
I know that I can use Defaults ...
10
votes
3
answers
7k
views
Why I must use 'visudo' to edit the '/etc/sudoers' file?
In /etc/sudoers, it says:
# This file MUST be edited with the 'visudo' command as root.
My question is, why must this file be edited with visudo?
It seems I was able to edit the file successfully ...
8
votes
1
answer
1k
views
Difference between "select-editor" and "update-alternatives --config editor"
I'm looking at how Ubuntu selects a default editor, and I notice that to set the default editor for editing crontabs, I use select-editor while to set the default editor for visudo I use update-...
7
votes
1
answer
1k
views
How disable mysql command in sudoers file?
How can I disable /usr/bin/mysql command in sudoers file? I've tried to use it this way:
%tailonly ALL=!/usr/bin/mysql
But when I access user 'tailonly' of group 'tailonly', this command is still ...
6
votes
2
answers
1k
views
How to see what pkaction a software uses
So, I have one software that always asks for password when starting. And I want to run this software without this gksu password prompt popping up everytime.
The first thing I tried was adding its ...
4
votes
1
answer
857
views
user not in sudo group but can perform sudo operations
Is this normal behaviour when I put a user student in sudoers file using visudo command like this :
visudo
student ALL = NOPASSWD: ALL
And he is not in sudo group but can still perform sudo ...
4
votes
1
answer
24k
views
Add user to sudoers
I want to add a user account to sudoers.
I type in
sudo usermod -aG sudo username
Then I reboot.
I type
apt update
I get permission denied.
I type
sudo apt update
Followed by account ...
3
votes
4
answers
9k
views
How to allow a command to be executed for a particular user without password with sudoers file?
Can anyone please explain the exact work of these in /etc/sudoers ? (I've done some research, so please don't share any links)
I want to add myself (member of sudo) to execute a command without ...
3
votes
4
answers
11k
views
Change in sudoers does not take effect. Ubuntu 16.10 fresh install + one line.
Trying to remove password on sudo. My current sudoers file:
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:...
3
votes
1
answer
2k
views
systemctl still asking for password even with sudoers
My /etc/sudoers
josh ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart servicename.service
running systemctl restart servicename.service still asks for password.
Does anyone have any ideas?
Running ...
3
votes
2
answers
2k
views
Certain commands not working for a user with sudo after adding to `sudoers` file
I cannot seem to allow the user (In this case Ruby) to run sudo rm -rf, sudo rmdir, or sudo mkdir. I have tried it with other commands and it works fine allowing that user to run sudo apt-get update ...
3
votes
1
answer
1k
views
Explanation of visudo lock file
When I edit /etc/sudoers using visudo, I think it saves to sudoers.tmp, checks it for errors, then copies it to the real /etc/sudoers.
However, I can't confirm my theory (how the lock file is used) ...
3
votes
1
answer
53k
views
sudo: can't open /etc/sudoers: Permission denied [duplicate]
sudo from a standard user works fine, but when I try to use it from root it returns this error:
sudo: can't open /etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
/etc/...
3
votes
1
answer
7k
views
visudo: specified editor (./sudo_editor) doesn't exist
I tried to run the
"sudo EDITOR=./sudo_editor visudo -f /etc/sudoers.d/relax_requirements"
command and the error came out as:
visudo: specified editor (./sudo_editor) doesn't exist
Anyone know what ...
3
votes
2
answers
10k
views
Mount samba share at login using startup script (not fstab)
Background
I'm trying to automatically execute a command that mounts a password protected Samba share when my user logs in. The catch is, I share my laptop with another user, and I don't want the ...
3
votes
0
answers
2k
views
Reset sudoers file
I want to add a new user to run all commands without a password, so I went to edit /etc/sudoers (using visudo of course) by adding the line myuser ALL=NOPASSWD: ALL.
Everything is OK, but 15 minutes ...
3
votes
0
answers
3k
views
Lost visudo - I seem to have lost visudo, to my great surprise
Lost visudo
I seem to have lost visudo, to my great surprise. I'm trying to add to /etc/sudoers or /etc/sudoers.d but when I try and run visudo as root I get this
sudo: visudo: command not found
...
2
votes
1
answer
2k
views
`sudo visudo /etc/hosts` gives syntax errors
Really dumb question, Ubuntu 20, and I have apache2 installed, not much else.
I go sudo visudo /etc/hosts and want to add an alias "dummy.com" domain alias as a hack to point to the server ...
2
votes
1
answer
6k
views
What is the difference between the group root and the group sudo? Why root user by default is not a member of the group sudo?
I am quite confused regarding this matter.
As far as I know the user root has all the privelages.
Also all the users of the group sudo has all privelages.
But the user root by default is not a ...
2
votes
2
answers
6k
views
Can't run visudo within Docker; sudoers file does not exist
Ubuntu n00b here. I am tinkering with a Docker container that I created using the following simple Dockerfile:
FROM ubuntu
CMD ["tail","-f","/dev/null"]
Inside the container, as the root user, I try ...
2
votes
1
answer
2k
views
Changes to sudoers have no effect. Following basic Ubuntu tutorial
I'm following along the Ubuntu sudoers tutorial.
Here's my exact /etc/sudoers file (screenshot instead of code block because the formatting was getting messed up).
Notice the lines at the bottom ...
2
votes
3
answers
2k
views
Run a specific sudo command without a password in Ubuntu 13.10
I would like to run vagrant without being prompted for a password. As this post suggests, I used visudo to add the following line to my sudoers file.
john-moz ALL=(ALL) NOPASSWD: /usr/bin/vagrant
...
2
votes
2
answers
339
views
Why micro is not recognized as text editor in Ubuntu 22.04?
I installed micro with sudo apt install micro on 22.04
I want to use visudo with micro.
export EDITOR=micro then next line visudo opens in nano.
So, then I tried sudo update-alternatives --config ...
2
votes
1
answer
628
views
sudoers doesn't work
I added powertop to /etc/sudoers (sudo visudo) but it doesn't work. I checked all possible problems I can imagine. What did I missed?
user@ellie:~$ whoami
user
user@ellie:~$ groups
user adm cdrom ...
2
votes
0
answers
29k
views
Sorry, user is not allowed to execute X as root on lt
Whenever I try to run a command from the termainal as sudo, I am now getting the error:
Sorry, user {user} is not allowed to execute {command} as root on lt.
lt is the name of my computer.
The only ...
2
votes
1
answer
583
views
Is there a GUI to `visudo`?
Quite simply, is there a GUI to visudo I can recommend to other users, and use for myself? I have to set up a system where over 50 users have different sudo privileges and I need to juggle them all.
1
vote
3
answers
141
views
Do I have to do a new installation?
I was in the /etc/sudoers and might done something wrong, beacuse after I couldn´t use the commandline again. Maybe i deleted sudo in /etc/sudoers. It said something was wrong i line 28. What can I do ...
1
vote
2
answers
3k
views
Visudo Command Not Working on Sudo User
I recently bought a vps and I have am fairly new to using ubuntu on it since I have always used shared hosting.
I have created a sudoer user and it worked perfectly fine yesterday except when I ...
1
vote
1
answer
2k
views
Adding my user to sudoers does not work. Still ask for password
I have a fresh install of Ubuntu 18.04
I made the mistake of editing /etc/sudoers with "vim" first instead of using "visudo".
Therefore when I was doing "sudo command" it kept asking for my password.
...
1
vote
1
answer
744
views
How can I run a sudo command as sudo (!) without password? (cryptsetup needs to be run as sudo in order to use kernel module 'device-mapper')
Solved
Besides not commenting the #includedir line in /etc/sudoers out, editing
sudoers.d/myOverrides with sudo visudo -f /etc/sudoers.d/myOverrides, and using the syntax I first tried, did the ...
1
vote
1
answer
579
views
Can I edit the sudoers file with visudo using my bootable USB
Something I did with a sudo dpkg ... installation in an attempt to fix problems with my audio clobbered my ability of my sole user-name to run sudo in 18.04 LTS (Bionic Beaver). This is a single OS ...
1
vote
1
answer
5k
views
What is the purpose of group privileges in sudoers file?
I removed my regular user from the sudoers file but it is still part of sudo group which has all privileges granted in the sudoers file. When I try to execute any command in sudo from my regular user ...
1
vote
1
answer
583
views
Visudo - Change user without password doesn't work
I want a user to be able to change to another user without a password and any other root rights. I followed already a hint on https://apple.stackexchange.com/questions/82438/allow-sudo-to-another-user-...
1
vote
1
answer
807
views
Upstart for docker and setuid permissions
OK, this has kept me busy for a day at least, since last night. I am trying to do something very simple: run a bash script which creates a few folders and runs a docker container - but using upstart. ...
1
vote
2
answers
2k
views
Auto-starting a GUI application that requires sudo
Question:
I need to auto-start a GUI application that requires sudo.
I know I need to edit the sudoers file with:
sudo visudo
However, I don't know what to write in the file.
What I already tried:...
1
vote
1
answer
279
views
/etc/sudoers file problem understanding
According to the documentation, modifications of this file may enables local users to execute sudo commands on remote machines:
user1 192.168.1.14=(user2:group1) ALL
According to what I read, ...
1
vote
2
answers
2k
views
Xubuntu visudo sudoers edit not working
I have been trying to specify a script that I would like to run without being prompted for a password. After a number of google and stack searches and a number of different syntax changes, I still ...
1
vote
1
answer
132
views
Changed suoders to an account that doesn't exist, what should I do
I've installed ubuntu 12.04 with single user, let's call him user1.
I then created a new user, let's call him user2.
I wanted user2 to be the only user with sudo rights, so I removed all users from ...
1
vote
1
answer
682
views
NOPASSWD option not working in sudoer file
I know this has been asked before, but I tried answers from dozens of other posts, and nothing is working. I've also used this on other servers successfully, so I'm not sure what I'm doing wrong this ...
1
vote
1
answer
174
views
Allowing {USER} to run a command against a process owned by another user
I have been scouring the forums to find out how you can allow a command / process to be ran by a user that is normally only permitted by root or itself.
There are some good resources out there but ...
1
vote
0
answers
50
views
Allowing a sudo command to run without needing password [duplicate]
I have the following command:
sudo service cron start
When I type it into the terminal, it asks me for a password, just as it should.
But I need for users (or if all users aren't possible, then at ...
1
vote
1
answer
177
views
Messed up the sudo access!
Not sure if this is the place for troubleshooting, but I am gonna give it a shot.
I was trying to make my computer turn off without needing sudo, and I must have done something wrong because I get a ...
1
vote
0
answers
636
views
Root user access for another user [duplicate]
I am trying to gain root user access to another user so that I can run a command with adding sudo in front of any command.
Example: fdisk -l
Getting the error message as:
fdisk: cannot open /dev/...
1
vote
1
answer
1k
views
I have somehow locked or removed my access to sudo - how can I fix it? [duplicate]
I am fairly new at Ubuntu system and commands. I was trying to follow some tutorial online explaining how to setup using no password to download apps. I was in visudo, and next thing I know I can't ...
1
vote
0
answers
486
views
In which cases multiple hostnames are set/uses with sudo
My computer has a label/hostname, let's say learn_linux.
In the /etc/sudoers the format is:
user ALL=(ALL:ALL) ALL
%group ALL=(ALL:ALL) ALL
the first field -> user, %group is referring to ...
1
vote
0
answers
1k
views
user in sudo group can't run sudo
I've seen other similar questions but they don't solve my problem unfortunately.
I've been added to the sudo group on my Ubuntu 14.04 with
usermod -aG sudo testuser
but I still can't run sudo:
:~...