Questions tagged [sudoedit]

52 questions
13
votes
1 answer

sudoers and defaults

I need to allow to a user to run passwordless sudo without tty. I have a file under /etc/sudoers.d/ with the special commands and settings I need, since I don't fancy editing directly the sudoers file. In that file I have the following: # My list of…
Navarro
  • 470
  • 1
  • 5
  • 13
12
votes
3 answers

This file must be edited with the 'visudo' command.?

Why it is recommended to edit /etc/sudoers file with the visudo command? Here is a sample of the file: ## Sudoers allows particular users to run various commands as ## the root user, without needing the root password. ## ## Examples are provided at…
Ankit
  • 1,385
  • 3
  • 16
  • 24
11
votes
2 answers

Why is sudoedit writing to a temporary directory?

I used sudoedit to create a file: $ sudoedit /etc/systemd/system/apache2.service but when I went to save the file, it wrote it in a temporary directory (/var/temp/blahblah). What is going on? Why is it not saving it to the system directory?
Tyler Durden
  • 5,411
  • 16
  • 57
  • 96
8
votes
2 answers

Difference between sudo -e and sudo vim?

Is there a key difference between sudo -e and sudo vim. I have set up the sudoers file so that vim is my default editor. Is there a key difference between the two? Plus, should I switch from vim to rvim? I tried it but I had some problems with my…
Peter Petigru
  • 470
  • 2
  • 9
8
votes
1 answer

sudoedit root owned file in a non-root directory

Why can't I edit files owned by root but being e.g. somewhere deep in my personal directory, it says: sudoedit: existingFile: editing files in a writable directory is not permitted While I have the following function defined: function sunano { …
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
7
votes
2 answers

How to properly edit system files (as root) in GUI (and CLI) in Gnu/Linux?

System: Linux Mint 18.1 64-bit Cinnamon. Objective: To define Bash aliases to launch various CLI and GUI text editors while opening a file in root mode from gnome-terminal emulator. Progress For example, the following aliases seem to work as…
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
7
votes
4 answers

Sudoers blacklist

We need to add few users to the sudoers file on Linux. They should be able to to anything root can except the following: Should not modify, read, delete /nfsshare/config Should not modify, read, delete /etc/passwd Should not mount anything Should…
sagar
  • 259
  • 1
  • 3
  • 7
6
votes
4 answers

Sudoedit Vim force write (update) without quit

I'm doing some scripting with Vim and I've just started using sudoedit. Problem is, when I :w it writes to the temp file, so any testing of the script can't happen unless I quit the editor. How can I force an update of the original, or am I missing…
Ben
  • 165
  • 1
  • 6
6
votes
1 answer

How can I make `sudo crontab -e` use my `sudoedit` environment?

I've started using sudoedit instead of sudo vim . One of the advantages is that it uses my local ~/.vimrc. However, when using sudo crontab -e, it uses /root/.vimrc instead. Is there a way to make sudo crontab -e use my local…
Sparhawk
  • 19,561
  • 18
  • 86
  • 152
6
votes
3 answers

What bad things could happen if we don't use sudoedit?

We know it's safer* to use sudoedit, but what bad things can happen if we have the following in sudoers? Cmnd_Alias FOO = /bin/ed, /usr/bin/ed, /usr/bin/vi foouser LOCALHOST = NOPASSWD: NOEXEC: FOO Can the "foouser" escape to root prompt? - of…
4
votes
5 answers

How can I add lines into my sudoers file?

I have read this answer but don't know how to add the following line into my sudoers file. matthew ALL=(ALL) NOPASSWD: /usr/sbin/service fancontrol start I ran "sudo visudo", and a "/etc/sudoers.tmp" window popped up. Is "/etc/sudoers.tmp" the…
Matthew Wai
  • 427
  • 3
  • 10
  • 16
4
votes
1 answer

How do you run a command with sudo in `~/.profile`?

Is it a bad practice to run a command which requires sudo in ~/.profile? If really want to do that, how can I make the command run at rebooting Ubuntu? make the command running with sudo and under my user account not require password, by editing…
Tim
  • 98,580
  • 191
  • 570
  • 977
3
votes
2 answers

Using Visual Studio Code as EDITOR e.g. with sudoedit

I am using Kubuntu 20.04. When I run sudoedit /etc/fstab, VS Code opens to a blank document and the CLI immediately returns (see details below). If I run export SUDO_EDITOR=nano, the document opens in the nano editor with the contents of /etc/fstab…
kevcoder
  • 445
  • 1
  • 4
  • 12
3
votes
1 answer

Add "domain admins" group in sudo users

I want to give access domain admins group to sudoers access. I have come across with many commands but nun of works for me. fname.lname ALL=(ALL) ALL With this command i can give access to a particular user, But i want to give access to all the…
Rajat jain
  • 431
  • 1
  • 4
  • 9
3
votes
2 answers

Can I sudoedit a file in a writable directory when using vimdiff?

When I want to vimdiff root files, I use the following alias, as per this suggestion. alias sudovimdiff='SUDO_EDITOR=vimdiff sudoedit' I can then use the following command. $ sudovimdiff /root/a /root/b However, if one of the files is writable by…
Sparhawk
  • 19,561
  • 18
  • 86
  • 152
1
2 3 4