On 09/12/2018 12:24 AM, J. Roeleveld wrote:
Does sudo have a shell-mode?
You can use "-i" to invoke a shell, but that's just the target users
destination shell.
I prefer to use a utility (wrapper) that I wrote that allows me to
leverage sudo in my user shell without having to think about it.
Link - Sudify
- https://dotfiles.tnetconsulting.net/tools/sudify/sudify.html
TL;DR: Sudify lets me use all the power of sudo without having to think
about it. It does what I want without getting in my way or me thinking
about sudo.
Sudify is a simple wrapper that sits in your (optionally personal) $PATH
that uses the base name to call sudo for you. You then create
sym-links from the command names that you want to sudify. Actually,
sudify does this for you. I.e.:
$ sudify ip
Will create a sym-link from (by default) ~/bin/ip to ~/bin/sudify.
Note: I've been using ~/bin, but nothing prevents using
/usr{/local,}/bin if you want to do this system wide.
Thus when ever I type ip at my normal users command prompt, it actually
invokes sudify, which sees that the sym-link's base name is ip, and
automatically runs sudo with the full path tot he real ip command.
This allows me to do a LOT of things that normally require "sudo
$command…" without ever needing to think about it. I've gotten to the
point that almost all of my sudo interaction is through sudify.
All of this is logged via sudo's standard logging mechanisms, which can
be off box.
--
Grant. . . .
unix || die