LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] user change during script execution

[ILUG] user change during script execution

Jason A. Corcoran. Jason at corcoran.tc
Thu Jul 26 15:55:05 IST 2001


You could rexec the commands for the user...

man rexec.

Jason
On Thursday 26 July 2001 15:48, Richard O'Mahony wrote:
> Hi,
> 	I am working on a bash script in which I have to change user during the
> processing of the script in order to check certain environment variables
> are being correctly set for that user. Currently I am using the following
> appraoch
>
> change_user () {
>     NEW_USER=$1
>     echo "logging in as $NEW_USER."
>     su - $NEW_USER
>
>   #
>   #plus some error checking
>   #to ensure that the log in proceeds
>   #
> }
>
>
> change_user ismadm
> #
> #some commands to be run as ismadm user
> #
>
> the problem is that when I log in using the above approach is that the
> script seems to be halted and the terminal presents a log in for the
> $NEW_USER. I am looking for some method to login and run a few commands
> without the user ever knowing (apart from supplying the password).
> Thanks
> Richard...

-- 
Rgrd's 
Jason.

________________________
E-Mail Jason at Corcoran.tc
SMS     Jay at Corcoran.tc




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell