Why do all the sudo? [was Re: Software updater no longer functional]
silver.bullet at zoho.com
Fri Jan 27 16:51:45 UTC 2017
On Fri, 27 Jan 2017 13:59:05 +0000, Colin Watson wrote:
>On Fri, Jan 27, 2017 at 02:19:58PM +0100, Ralf Mardorf wrote:
>> Yes, sudo has got a benefit, especially in combination with the
>> timestamp, e.g. for scripts, that compile something without root
>> privileges and after that install something, that requires root
>As a side note, sudo is also superior to su in shell command design
>terms, because if it's being used in an adverbial style (i.e. "run this
>command with these arguments as another user") then it doesn't require
>the subsidiary command and arguments to be quoted and passed as a
>single argument. Shell quoting is complicated and error-prone, so
>it's always better where possible for adverbial commands to be written
>in a style that doesn't require an extra layer of quoting.
This is part of my guess, too. Actually it's possible to use su in a
shell script. I don't know if su allows to be configured with a
timestamp, if not, it might be another disadvantage. However, the
quoting at least makes a script less good readable. "sudo" has less
drawbacks for a script, e.g. resolving wildcards or portability issues
in regards to environment variables, but it's possible to workaround
It's nice to have su as well as sudo, because both could be used with
different settings. I don't know if auto logout could be set individual
for both, but at least the timestamp by default usually is set for
sudo, but not for su.
Apropos defaults, sudo has got an Easter egg.
[rocketmouse at archlinux ~]$ sudo grep insult /etc/sudoers
By default it takes longer to type the password again, after making a
typo, when using su. I don't know if this is related to a possible log
or by a time variable, anyway, with "Defaults insults" sudo lose this
advantage and sometimes the insults are annoying, but maybe they are
good to teach more careful typing.
More information about the ubuntu-users