"sudo vim example" and "vim example"

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"sudo vim example" and "vim example"

Maksim Yugai
Hi, everyone.

Can someone help me? I saved vim config file into ~/.vim/vimrc. And when I use "vim example" all settings are working, but when I use "sudo vim example" - it doesn't work! Looks like problem with privileges. =)

Use Debian Stretch.

Thanks.      

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Tobias Klausmann
Hi!

On Fri, 25 Aug 2017, Maksim Yugai wrote:
> Can someone help me? I saved vim config file into ~/.vim/vimrc.
> And when I use "vim example" all settings are working, but when
> I use "sudo vim example" - it doesn't work! Looks like problem
> with privileges. =)
>
> Use Debian Stretch.

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.

HTH,
Tobias

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

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

Grant Taylor
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.