Switching users in a bash script?

veritosproject at gmail.com veritosproject at gmail.com
Sat Aug 26 08:53:44 PDT 2006


On 8/26/06, Angel Tsankov <fn42551 at fmi.uni-sofia.bg> wrote:
> Hello!
>
> I had prepared a bash script to install the LFS system. A few days ago I decided that I need a package management system and I chose
> to use package users. I'd also like to start from the ground up and build the whole LFS using package users. This means that I need
> to modify the long bash script that performs all the command in Chapter 6 of LFS 6.1.1 so that each package is installed as a
> diferent user. And here comes the trouble - at some point in the script I need to switch from root to another (i.e. a package) user,
> execute several of the commands that follow and return to the root user. This has to be done for every single package. Do I have an
> alternative that is better (and possibly easier) than extracting the commands that install a package in their own script and using
> 'su -c' in one "master" script?
>
> --
> http://linuxfromscratch.org/mailman/listinfo/lfs-support
> FAQ: http://www.linuxfromscratch.org/lfs/faq.html
> Unsubscribe: See the above information page
>

Write the script to execute as a user out, and pipe that into 'su'.



More information about the lfs-support mailing list