sudo
closes any file descriptors greater than >&2
for invoked processes automatically - which might be a problem.
The whole sudoers
thing is yet another (arguably unnecessary) abstraction from the tried and true /etc/passwd
basic user/group Unix-style permissions scheme and it requires its own management.
For instance, from man growisofs
:
If executed under sudo(8) growisofs
refuses to start. This is done for the following reason. Naturally growisofs
has to access the data set to be recorded to DVD media, either indirectly by letting mkisofs
generate ISO9660 layout on-the-fly or directly if a pre-mastered image is to be recorded. Being executed under sudo(8)
, growisofs
effectively grants sudoers
read access to any file in the file system. The situation is intensified by the fact that growisofs
parses $MKISOFS
environment variable in order to determine alternative path to mkisofs
executable image. This means that being executed under sudo(8)
, growisofs
effectively grants sudoers
right to execute program of their choice with elevated privileges. If you for any reason still find the above acceptable and are willing to take the consequences, then consider running following wrapper script under sudo(8)
in place for real growisofs
binary.
#!/bin/ksh
unset SUDO_COMMAND
export MKISOFS=/path/to/trusted/mkisofs
exec growisofs "$@"
But note that the recommended alternative to the above "workaround" is actually to install growisofs
set-root-uid
, in which case it will drop privileges prior accessing data or executing mkisofs
in order to preclude unauthorized access to the data.
At least su
actually temporarily switches users and preserves Unix-style permissions. sudo
, on the other hand, transcends users. Still, if you properly cope with that in /etc/sudoers
sudo
can probably completely replace su
in most respects and do so conveniently - with some minimal cost to security, because su
presents most of the same security problems as sudo
- and maybe a few of its own. I consider this an excellent discussion on the subject.
But why not just skip them both and...
CTRL+ALT+Fn
login: root
Or...
ssh root@localhost
Whatever happened to root anyway?