[ic] Gentoo: Different syntax for su command

Gary Norton gnorton at broadgap.com
Mon Jan 17 12:42:53 EST 2005

Davor Ocelic wrote:

>>Upon installing IC on a new Gentoo box I found that the following does 
>>not work:
>>     su -c "/usr/local/interchange/bin/interchange -r" interch (this is 
>>recommended during install/makecat)
>>Using this syntax you will get the following:
>>     "The Interchange server must not be run as root."
>>instead I needed to use the following syntax:
>>     su - interch -c "/usr/local/interchange/bin/interchange -r"
>Well, "su interch" and "su - interch" should both be valid, and do one
>little different thing; the inclusion of " - " creates a "login shell",
>whereas su without it doesn't; and this is the same everywhere.
>You both changed the order of parameters, and added " - ". I don't
>believe anyone would break su in a way you describe; try playing around
>some more to come to the *actual* source of problem.
>A little hint, as root, try running:
>  su -c id nobody
>If it reports ID nobody, then nothing has changed in Gentoo version
>of su.
You are correct, the "-" is not needed. I do that out of habit. However, 
if you put the user ID at the end of the command, it does not work. 
Perhaps someone more knowledgeable than me can explain why, but I wasted 
about an hour on the tangent trying to figure out why this is as it is.

The "man su" page for the Gentoo version is pretty much worthless. It 
does not list any arguments that it supports (the man page for other 
distros does list a helpful list of arguments).

Also here are the results of your sugguested test:
su -c id nobody
uid=0(root) gid=0(root) 

su nobody -c id
{doesn't return any results}

One of the test I ran initially to get to my conclusion was very similar 
to your approach, although I did not post it I probably should have:
su -c whoami interch

su interch -c whoami


More information about the interchange-users mailing list