Tag: Sudo

Emacs: Edit as root using sudo-edit

Friday, Apr 11, 2025

Figure 1: sudo plus emacs Emacs offers TRAMP as a way to edit files over ssh or as a different user. Combine with sudo-edit for easy superuser edits. VSCode has a feature reminiscent of TRAMP called Remote Development using SSH. At the time, I didn’t know of M-x sudo-edit so I wrote my own implementation. It sucked, didn’t work on chained TRAMP connections (e.g. ssh then edit as root on the remote host).

Continue reading…

You want sudo -i or su -

Sunday, Feb 14, 2021

You want to use sudo -i or su - to log into root. sudo su anything is superfluous, because you probably should be using sudo -i or sudo -s, which are roughly equivalent, depending if you want to simulate a login (su - or sudo -i) or not (su or sudo -s).1 When to use su -? You want to log into root using the root password. Typically you must be in the wheel group (check your PAM configuration).

Continue reading…