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 Beekmans

/* If Linux doesn't have the solution, you have the wrong problem */

--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to