Bug 602 - sudo -s and -i quoting behavior changed but documentation hasn't
sudo -s and -i quoting behavior changed but documentation hasn't
Status: NEW
Product: Sudo
Classification: Unclassified
Component: Sudo
1.7.4
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-24 20:18 MDT by Kenno Vanommeslaeghe
Modified: 2013-05-24 20:19 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenno Vanommeslaeghe 2013-05-24 20:18:37 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.
Comment 1 Kenno Vanommeslaeghe 2013-05-24 20:19:38 MDT
Oh I forgot tho post the link to the corresponding Red Hat bug:
https://bugzilla.redhat.com/show_bug.cgi?id=699802