Friday, August 25, 2017

Re: "sudo vim example" and "vim example"

On 08/25/2017 09:00 AM, Tobias Klausmann wrote:
> Well, if vim is run with sudo, it runs as root and uses root's
> settings (vimrc etc). What you probably want is sudoedit. It
> copies the file you want to edit and launches the default editor
> on it. Once you quit, it copies the file back with propepr
> permissions etc.

Further, sudoedit (which uses your $EDITOR) is safer than running vim under sudo.

At least from a security perspective, sudoedit is safer as many editors, vim include, provide a way to escape the editor and launch a shell.

"sudo vim /path/to/file" followed by ":shell" gives you root shell.

"sudoedit /path/to/file" followed by ":shell" gives you a shell as your normal user.



--
Grant. . . .
unix || die

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: