On Tue, 28 Apr 2015 07:19:34 +0200, someone wrote: > You are perfectly correct, it was ed, not vi and sudoedit could be the > solution, thanks. > I will try to search the internet how to do the LD_PRELOAD trick with ed.
You cannot as LD_PRELOAD only works with dynamic executables and ed is static. The best you could hope to do is monitor it via ptrace(2). It's really a moot point since if you can write to files as root you can trivially get a root shell other ways, such as editing /etc/sudoers. The reason we have sudoedit is that there is no safe way to constrain what an editor run as root can do. - todd