The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Login Script vinna Shell Programming and Scripting 3 05-06-2008 05:31 PM
Help on a login script gbarnes Shell Programming and Scripting 1 04-09-2008 11:19 PM
login from a shell script????? skyineyes Shell Programming and Scripting 2 07-16-2007 02:59 AM
Login script newtoxinu UNIX for Dummies Questions & Answers 3 07-25-2005 01:50 PM
Script with SU Login bkhviking Shell Programming and Scripting 3 06-18-2005 04:35 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-08-2006
Registered User
 

Join Date: Feb 2006
Posts: 8
Stumble this Post!
Question How can we ssh login with script?

Hi all,

Normally, we give ip address to login with ssh like ssh 172.168.0.1
And we can give login name to ssh like ssh -l root 172.10.0.21
Then the shell asks the password, we enter the password and login to the system.
While using the script file, we are not able to supply the password to the shell.

Is there any option to provide user name and password to the ssh command in a single line?
OR
Is there any option to give password in next line script?

plz help me,
Thanks and regards,
P C Saji
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-08-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,546
Stumble this Post!
you need to create keys
swap them across servers
set the permission

man ssh-keygen
Reply With Quote
  #3 (permalink)  
Old 03-09-2006
Registered User
 

Join Date: Feb 2006
Posts: 8
Stumble this Post!
Details

Ok, thanks

Can you give more details about this or other ideas?
Reply With Quote
  #4 (permalink)  
Old 03-09-2006
Registered User
 

Join Date: Feb 2004
Posts: 91
Stumble this Post!
You can setup ssh keys. Here is a link to a decent tutorial on how to do it.

http://www.arches.uga.edu/~pkeck/ssh/

Another option is using "expect".

http://expect.nist.gov/

Here is an example of an expect script:
http://bash.cyberciti.biz/security/sshlogin.exp.php
Reply With Quote
  #5 (permalink)  
Old 03-27-2006
Registered User
 

Join Date: Feb 2006
Posts: 47
Stumble this Post!
I am trying to do the same thing, But in this case, I want the key to be generated for the local machine, coz i need to be root to run a few commands.

Can some one please assist me with this ?

Thanks
Reply With Quote
  #6 (permalink)  
Old 03-27-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,546
Stumble this Post!
to enable ssh between servers,
you need to generate keys,
public keys to be exchanged under appropriate directory of the server.

And none of the commands do need root privilege

do let us know about the commands that you are trying to execute to setup above ssh-settings that requires root privileges !!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 05:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0