You are not logged in.

#1 2008-10-11 19:55:38

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

chroot bash prompt?

I am trying to set a bash prompt different for chroot. I put a .bashrc file in /opt/arch32/root/ and it works fine if I

su

to root then

chroot /opt/arch32

but if I just

sudo chroot /opt/arch32

it uses the colors from my normal user bash prompt.

I am trying to set an alias in my .bashrc so it will su then chroot /opt/arch32, but I have never used alias or dug into bash that much and I can't seem to get it to work.

I tried

alias arch32='su && chroot /opt/arch32

but that didn't work.

Any help would be great.

Thanks

Offline

#2 2008-10-11 20:05:47

pointone
Wiki Admin
From: Waterloo, ON
Registered: 2008-02-21
Posts: 379

Re: chroot bash prompt?

su -c chroot /opt/arch32

The -c switch passes a command to the shell started by su.

Your script currently starts a root shell and then runs chroot /opt/arch32 as the calling user.


M*cr*s*ft: Who needs quality when you have marketing?

Offline

#3 2008-10-11 20:10:57

cu3edweb
Member
From: USA
Registered: 2007-10-07
Posts: 291

Re: chroot bash prompt?

pointone wrote:
su -c chroot /opt/arch32

The -c switch passes a command to the shell started by su.

Your script currently starts a root shell and then runs chroot /opt/arch32 as the calling user.

Thanks for the reply this is what I get with your suggetion

su: user /opt/arch32 does not exist

I also tried it straight from the command line same error.

***[EDIT]***
I figured it out. I did

su -c 'chroot /opt/arch32'

that did the trick

Thanks pointone

Last edited by cu3edweb (2008-10-11 20:14:49)

Offline

Board footer

Powered by FluxBB