The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 12:25 PM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 07:19 AM
bash script for ssh login- big_pil Shell Programming and Scripting 5 10-29-2007 12:23 PM
How to get bash to be the login shell? amheck SUN Solaris 8 03-10-2006 05:39 PM
bash script help!!! shooroop Shell Programming and Scripting 3 10-06-2005 07:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-04-2008
modcan modcan is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 15
bash ssh login script

hello
anyone have done ssh login script without "expect"
(automatic login from host A / user b to Host B / user b without enter any passwords)?
cheers
  #2 (permalink)  
Old 06-04-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,257
Basically you don't need a script for that. Create a public key with an empty pass-phrase on host A, put it into the user's ~/.ssh/authorized_keys of the host B and you will be able to do ssh or scp to B without being prompted for a password.
If you write a script where you implement this, the option "batchmode" comes in handy sometimes.

"man ssh" or Google for more info.
  #3 (permalink)  
Old 06-04-2008
modcan modcan is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 15
maybe i missing something
i ran this script:


#!/bin/bash
if [ ! -r ${HOME}/.ssh/id_rsa.pub ]; then
ssh-keygen -b 2048 -t rsa
fi
#Append to the copy on the remote server
cat ~/.ssh/id_rsa.pub | ssh ${USER}@$1 "cat - >> .ssh/authorized_keys"

if [ $? -eq 0 ]; then
echo "Success"
fi


and still could not login automatcly to the host server
why?
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0