Bugzilla – Bug 602
sudo -s and -i quoting behavior changed but documentation hasn't
Last modified: 2013-05-24 20:19:38 MDT
Background: The man page says: "The -s (shell) option runs the shell (...). If a command is specified, it is passed to the shell for execution." I interprete this as "'sudo -s <command>' does roughly the same as 'sudo sh -c command'", and this used to be the case in sudo 1.7.2. Steps to reproduce: sudo -s 'echo foo > /root/bar' sudo ls -l /root/bar Expected (1.7.2p1) result: $ sudo -s 'echo foo > /root/bar' $ sudo ls -l /root/bar -rw-r--r-- 1 root root 4 May 24 22:06 /root/bar Actual (1.7.4p5, 1.8.3p1) result: $ sudo -s 'echo foo > /root/bar' /bin/bash: echo foo > /root/bar: No such file or directory $ sudo ls -l /root/bar ls: cannot access /root/bar: No such file or directory Other thoughts: - does there remain any way to perform an output redirection as root, other than "sudo sh -c <command>" ? - I liked the old behavior better (and I'll have to adjust my collection of scripts), so I consider this a regression. However, *if* this new behavior is delibrate, then please consider mentioning this in the man page.
Oh I forgot tho post the link to the corresponding Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=699802