Gerard Beekmans wrote: > Richard A Downing wrote: >> I just built the cross-lfs book, and noticed that the version of su >> installed comes from shadow. This version doesn't support -c, which IMO >> makes it useless. The version built in coreutils is the one I'm used to. > > The shadow version of "su" does support the -c option providing you an > option to pass command line arguments to 'su.' > > From its man page (based on shadow-4.0.14): > > Additional arguments may be provided after the username, in which case > they are supplied to the userĀ“s login shell. In particular, an argument > of -c will cause the next argument to be treated as a command by most > command interpreters. The command will be executed by the shell > specified in /etc/passwd for the target user. > > And to demonstrate it works as advertised: > > [EMAIL PROTECTED]:~$ touch /root/testfile > touch: cannot touch `/root/testfile': Permission denied > [EMAIL PROTECTED]:~$ su -c "touch /root/testfile" > Password: ************ > > And '/root/testfile' is created after running this. > > I believe "su" from the shadow package does work as expected, unless I > totally missed something, Richard? >
Gerard, If this behaviour is 4.0.14 then you have a different one to me! I suspect this is 4.0.13 - and that does work. [EMAIL PROTECTED]:/sources/shadow-4.0.14/src$ touch /root/thing touch: cannot touch `/root/thing': Permission denied [EMAIL PROTECTED]:/sources/shadow-4.0.14/src$ ./su -c "touch /root/thing" /sources/shadow-4.0.14/src/.libs/lt-su: invalid option -- c Usage: su [options] [login] Options: -h, --help display this help message and exit -, -l, --login make the shell a login shell -m, -p, --preserve-environment do not reset environment variables, and keep the same shell -s, --shell SHELL use SHELL instead of the default in passwd [EMAIL PROTECTED]:/sources/shadow-4.0.14/src$ R. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page