You are not logged in.
I am using ranger as my file manager. And sometimes I run it with sudo. But then it want's to open all with nano. Even tough the environment variables (EDITOR & VISUAL) are set to vim.
Maybe it hast something to do with /bin/sh - but when that is the case, how do I change the default behaviour of /bin/sh?
Last edited by natepad (2015-04-02 16:07:36)
Offline
Add a line to sudoers:
Defaults editor=/usr/bin/vim
Offline
Add a line to sudoers:
Defaults editor=/usr/bin/vim
Did that. Changed nothing.
Maybe this helps. When I open a file inside ranger on the background the output is:
/bin/sh: nano: command not found
Offline
When sudo executes a command, this command will not inherit all the environment variables of the shell. See the man page for sudo.
Offline
Ok. So I can't use vim to open files inside ranger when I opened ranger with sudo?
Offline
Sure you can. As the sudoers man page describes, the env_reset option is on by default. You could use the env_keep options. Or use the -E flag for sudo. Or....
http://www.sudo.ws/sudo/man/1.8.13/sudo.man.html
http://www.sudo.ws/sudo/man/1.8.13/sudoers.man.html
Offline
Thanks a lot for your patience. Will have a look and when all works I will mark the thread as resolved.
Edit: I will use -E flag - but I am not sure if there is a security risk involved to do so. Thanks. Resolved!
Last edited by natepad (2015-04-02 16:07:11)
Offline
It is not only a security problem. You may also end up with files which are owned by root and not changeable by your user in the home directory of your user (depending on your vim configuration, vim may created backup files, just one example).
Offline
Ah, thanks a lot chris. Good point!
Offline