Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between `sudoedit` and `sudo vim`? [closed]

Tags:

What is the difference between sudo vim /etc/services and sudoedit /etc/services? I tried to edit the /etc/services file in linux. sudoedit is allowing to edit, but sudo vim is not allowing to edit.

like image 485
Nadaraj Avatar asked Feb 28 '14 01:02

Nadaraj


People also ask

What is sudo vim command?

sudo. vim : Allows one to edit a file with privileges from an unprivileged session.

Is Sudoedit safe?

Of course, like any other security-related tool, 'sudoedit' has had its share of exploits, but it's still a recommended solution in many use cases.


1 Answers

sudoedit specifies sudo with the -e option. From the man page:

 -e          The -e (edit) option indicates that, instead of running a command, the              user wishes to edit one or more files.  In lieu of a command, the string              "sudoedit" is used when consulting the security policy.  If the user is              authorized by the policy, the following steps are taken. 

Therefore, it allows the system administrator to only allow sudo rights for editing certain files, not specific commands or all files in general. It allows the administrator to control which files a user (or groups of users) can edit with elevated privileges.

What's more, the user can still use his/her preferred editor, not one that is specified by the administrator. It also runs this editor as the user itself, meaning that any options or commands specified in a .vimrc by the user for example will apply.

like image 159
PurpleAlien Avatar answered Oct 04 '22 12:10

PurpleAlien