If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Login to another server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-26-04, 03:20
MANASH3250 MANASH3250 is offline
Registered User
 
Join Date: Jan 2004
Location: Singapore
Posts: 19
Login to another server

Hi ,

I have a requirement like .

I am executing a scripts like xx.sh . Middle of the script
I want to login into some other user and with same host (from that xx.sh only) and execute some scripts and want to print result from xx.sh and than come back to original user .

Please help me to write a script .

Thanks
Manash
__________________
Manash Ranjan

Last edited by MANASH3250; 01-28-04 at 08:35.
Reply With Quote
  #2 (permalink)  
Old 01-28-04, 12:27
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: Login to another server

Quote:
Originally posted by MANASH3250
Hi ,

I have a requirement like .

I am executing a scripts like xx.sh . Middle of the script
I want to login into some other user and with same host (from that xx.sh only) and execute some scripts and want to print result from xx.sh and than come back to original user .

Please help me to write a script .

Thanks
Manash
Check Openssh documentation and you will find the wanted solution...
Reply With Quote
  #3 (permalink)  
Old 01-29-04, 01:16
MANASH3250 MANASH3250 is offline
Registered User
 
Join Date: Jan 2004
Location: Singapore
Posts: 19
Re: Login to another server

Quote:
Originally posted by ika
Check Openssh documentation and you will find the wanted solution...
Hi ika .

I didn't find any solution in Openssh . Can u please tell me more
about this and how to do this .

Thanks
Manash
__________________
Manash Ranjan
Reply With Quote
  #4 (permalink)  
Old 01-29-04, 08:45
ika ika is offline
Registered User
 
Join Date: Oct 2003
Location: Slovakia
Posts: 482
Re: Login to another server

Quote:
Originally posted by MANASH3250
Hi ika .

I didn't find any solution in Openssh . Can u please tell me more
about this and how to do this .

Thanks
Manash
Search for following topic:
- key generation

You need generate the keys. You take the public key (usually id_rsa.pub or id_dsa_pub) and put its content in to the /home/user/.ssh/authorized_keys file on the remote machine
This is needed for automatic logon without entering the password (security is solved by the paar of keys).

Then "man ssh" and look at 7th line and there is answer how you can run the command over ssh.

Hope that helps. If not let me know
Reply With Quote
  #5 (permalink)  
Old 01-29-04, 10:15
TimoV TimoV is offline
Registered User
 
Join Date: Dec 2003
Posts: 56
If you are running your main script as root you might want to look into the su command.

An other option might be expect...It's a tool which can respond to certain phrases...you coud set up a expect script (called from xx.sh) to log in and give the poassword...unfortunatly expect doesn't use coded paswrods :/
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On