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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how do I make my workstation an installation server for a remote server?. calsum SUN Solaris 3 04-18-2008 04:54 PM
Script for automatic deletion of trash file of mail server crown2100bd SUN Solaris 1 09-20-2007 09:01 AM
Transfer file from local unix server to remote server indira Shell Programming and Scripting 2 05-03-2007 07:35 AM
Transfer file from local unix server to remote server indira HP-UX 2 05-02-2007 06:15 PM
FTP multiple files from remote server to local server berlin_germany Shell Programming and Scripting 2 12-20-2006 03:24 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-03-2007
tekline tekline is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 15
automatic ssh into remote server using ksh

I still have to enter the password when I want to auto login w/o having to do any command line entry. This code works but I don't want to have to enter the password at the command line. After manning ssh I still am not sure what settings I need to change. Please help. Thanks!


<<<output>>>
$ sh file_exists.ksh
clport@dwebapp1's password:
file exists


<<<code>>>
#!usr/bin/sh

hostname=dwebapp1
login_name=clport

# password=

if [ -n `ssh -l $login_name@$hostname 'ls test/testfile.txt 2>/dev/null'` ]; then
echo file exists
else
echo "file doesn't exist";
fi
  #2 (permalink)  
Old 07-03-2007
syndex syndex is offline
Registered User
  
 

Join Date: Jun 2007
Location: Pennsylvania
Posts: 46
Did you set up the SSH keys?
  #3 (permalink)  
Old 07-05-2007
dmohnot dmohnot is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 1
i suggest you to use "expect"
for details man expect

try these site
http://expect.nist.gov/
http://www.io.com/~wazmo/expect.htm
  #4 (permalink)  
Old 07-05-2007
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
As syndex points out, you need to configure ssh keys correctly for passwordless (i.e. key-based) authentication to work. There are plenty of documents detailing this on the net.

You might also want to look into the Net::SFTP Perl module.

Cheers,
ZB
  #5 (permalink)  
Old 07-23-2007
tekline tekline is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 15
I set up my keys using ssh-keygen ; copied the key to .ssh/authorized_keys on the remote server. Logged out, logged in and exicuted the script at the beginning of this post and I still was forced to enter command line password. ARGH! I don't understand what I am doint wrong.

The authenticity of host 'dwebapp1 (57.2.20.1)' can't be established.
. key fingerprint is RSA.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no'.
yes
Warning: Permanently added 'dwebapp1,57.2.20.1' (RSA) to the list of known hosts.
clport@dwebapp1's password:
file exists
$ ksh file_exists.ksh
clport@dwebapp1's password:
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 05:56 AM.


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