Switching users in a bash script?

lynx.abraxas at freenet.de lynx.abraxas at freenet.de
Mon Aug 28 02:13:33 PDT 2006


On 27/08/06 12:19:38, Scott wrote:
> On Sat, Aug 26, 2006 at 06:11:43PM -0700, veritosproject at gmail.com wrote:
> > Here's how you pipe commands.
> > 
> > Throw an "exit" on the end of that, your root password on the front, giving:
> > START FILE
> > 123456
> > ./configure --prefix=/usr
> > make
> > make install
> > exit
> > END FILE
> > 
> > Then simply call:
> > echo build-package-name.txt | su
> 
> I tried that before. On my system (Mandrake 10.1) I get:
> 
>   stdin must be tty

I  have never seen this technique before. But being curious I tried it too and
am getting:

su: must be run from a terminal

Also I wonder why to use echo and not cat? Wouldn't echo  just  output  build-
package-name.txt  and  cat it's actual content? Or does so open build-package-
name as a file? Are there different implementations of su out there? I have an
LFS 5.1.1

Lynx



More information about the lfs-support mailing list