How do I open a file in the file-manager "ranger" with superuser rights?
While ":open_with vim" opens the file as none root with vim, I am looking for something like ":open_with sudo vim", but that does not work.
How do I open a file in the file-manager "ranger" with superuser rights?
While ":open_with vim" opens the file as none root with vim, I am looking for something like ":open_with sudo vim", but that does not work.
According to man:
Flags give you a way to modify the behavior of the spawned process. They are used in the commands ":open_with" (key "r") and ":shell" (key "!").
f Fork the process. (Run in background) c Run the current file only, instead of the selection r Run application with root privilege (requires sudo) t Run application in a new terminal window
In your case you would need to use :open_with r vim
I usually open my file manager from a root terminal by simply typing in the program name with no parameters e.g.
root@machine: thunar
This will open the file manager as a root user and then anything I open to edit from the file manager is opened as the root user.
Or, if the file is easy to navigate to or name in the terminal such as "FSTAB" I just open my text editor with the named file such as
root@machine: mousepad /etc/fstab.
Further, if it an easy change, I simply use my terminal editor as a root user (nano in my case).