The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
grep unix.com with google



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

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 11-28-2009
Registered User
 

Join Date: Nov 2008
Location: Amsterdam
Posts: 1,259
Or you can just use a list:

Code:
for i in serverA serverB serverC serverD serverE; do
  ssh -1 $i "echo `pwd`"
done

  #9 (permalink)  
Old 11-28-2009
Registered User
 

Join Date: May 2008
Location: Maryland, USA
Posts: 118
I was going to suggest what Scrutinizer suggested, but he beat me too it.

Quote:
Originally Posted by sexyTrojan View Post
I have generate public and private keys and copy pub key to remote servers yet i'm still prompted for password.
Are you using keychain? It's available in the repositories of most Linux distros.

With it, I am prompted for my passphrase the first time I login after a reboot of my local machine. It keeps a process running, even if I logout, that maintains the passphrase in memory. Then when I use ssh or scp (even via cron when logged out) the keychain process supplies the passphrase. It's as safe as your local login.
  #10 (permalink)  
Old 11-29-2009
Registered User
 

Join Date: Mar 2009
Posts: 14
Either loops work, the problem is ssh-ing to the servers itself. I can ssh serverB on the command line without being prompted for a password. However when i use the script to do it, i'm being prompted for a password and i don't know the password to access these servers. Do you think i should add the known host on remote server ? I'm not using keychain -- I don't even know the passpharase of the existing keys. What should i do?
  #11 (permalink)  
Old 11-29-2009
Registered User
 

Join Date: May 2008
Location: Maryland, USA
Posts: 118
Quote:
Originally Posted by sexyTrojan View Post
... i don't know the password to access these servers. ... I don't even know the passpharase of the existing keys. What should i do?
If you don't know either the password or the SSH passphrase for any username on the servers, one wonders if you should be attempting this. If you are doing something that you are supposed to be doing, then you should reasonably demand the access you need to do it.

The way to get SSH to work without a password is to append your public key from the local machine to the ~/.ssh/authorized_keys file on the remote machine. When the known_hosts file give me trouble, I delete it and it starts over.
Sponsored Links
Reply

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 Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
update a common file in different/remote servers techychap Shell Programming and Scripting 1 11-09-2008 08:36 PM
Copy a file on remote server sunsysadm2003 Shell Programming and Scripting 1 06-30-2008 01:48 PM
restore mysql dump file in many remote servers? blesets Shell Programming and Scripting 2 09-13-2006 02:17 AM
help me to copy remote file manmohan73 HP-UX 8 12-20-2005 01:29 AM
Remote file copy lchunl UNIX for Dummies Questions & Answers 3 07-27-2001 12:35 PM



All times are GMT -4. The time now is 02:40 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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