Home » Infrastructure » Unix » Relogin during shell script execution
Relogin during shell script execution [message #98316] Mon, 19 July 2004 08:47 Go to next message
Victor Ho
Messages: 1
Registered: July 2004
Junior Member
Hi,

I am trying to do a relogin during the execution of a shell script. The prompt for the user password always get directed to the console, is there any way I can programmtically supply the password?

e.g.

#!/bin/csh

su user_name => the password prompt goes to console output (how to supply password within the script?)

Thanks
Re: Relogin during shell script execution [message #98379 is a reply to message #98316] Tue, 31 August 2004 02:47 Go to previous messageGo to next message
andy
Messages: 92
Registered: December 1999
Member
Hi Victor,

I don't believe there is in a shell script.

Whenever I've need a script to su without a password, I have got it run it from the root account and used syntax:
su - user_name -c script_to_be_run

I believe that tcl expect is designed to supply information as if you were typing it in. You might want to have a look at that.

Good luck,
Andy
Re: Relogin during shell script execution [message #195549 is a reply to message #98316] Fri, 29 September 2006 07:44 Go to previous message
athyzafiris
Messages: 5
Registered: September 2006
Location: Switzerland
Junior Member
Victor

I know this is sometime ago when you posted this question but i wanted to know if you came to a solution with this problem as i am having the same problem. I am running a shell script as one user and try to su to another user but it prompts me for a password and i can't hard it.

If you can let me know how you solved this problem it would be good.
Previous Topic: Oracle 10g in HP UX 11.
Next Topic: how to use export cmd in unix script
Goto Forum:
  


Current Time: Fri Mar 29 00:28:19 CDT 2024