On 12/20/05, Michiel Faber <[EMAIL PROTECTED]> wrote: > I start writing scripts myself, but how can i script things if first a > user has to do something and later root. > I.e as user i do "./configure & make", but i have to do "make install" > as root. > > How you guys solve this? Of course i can do everything as root, but i > learned; " only use root when you have to"
Well, one obvious way is with sudo. Otherwise, you can wrap the command in an su -c command: su -c "make install" However, that prompts for the password every time you invoke su. For not using passwords, sudo might be the way to go. Another way to go would be to start the script as root and wrap the unprivelaged commands in an su -c. root doesn't have to be prompted on changing users: su user -c " ./configure && make" && make install I personally build as root to avoid the user switching despite the bad things that can happen. I just cross my fingers and hope that my scripts don't have errors in them. Package management can give some piece of mind in any case, but it's tough to be totally immune when building packages. -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page
