Testing ssh connection from KSH script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Testing ssh connection from KSH script
# 8  
Old 06-02-2005
Bakunin's clarification is acknowledged and appreciated. Now I understand the real concern.

Asking user's confirmation of accepting a key is the security feature. I don't know whether it is a good idea or not to automatically pass through it without intervention. The good thing about unix is, especially combined with business application, none and nothing is hundred percent absolutely right or wrong. It all depends on scenario. That said, have you thought about using expect? Expect can do such thing as detecting prompts on the screen and feeding corresponding response (string/characters).

Tom
# 9  
Old 06-02-2005
Quote:
Originally Posted by tom_xx_hu@yahoo
Asking user's confirmation of accepting a key is the security feature. I don't know whether it is a good idea or not to automatically pass through it without intervention. The good thing about unix is, especially combined with business application, none and nothing is hundred percent absolutely right or wrong. It all depends on scenario. That said, have you thought about using expect? Expect can do such thing as detecting prompts on the screen and feeding corresponding response (string/characters).
Many thanks for your answer Tom.

I won't even go so far to ask for automatically bypassing the security and *definitely* I'm not going to write passwords into shellscripts, as I would have to using expect.

What I would like to have is a mechanism, which would work in case the keys are exchanged and come up with an error if they are not. I have no problem with failing scripts, i have a problem with scripts hung indefinitely.

My goal is achieving something like this:

# dsh.ksh "date"
foomachine: Thu Jun 2 09:30:04 MSZ 2005
barmachine: Thu Jun 2 09:30:04 MSZ 2005
3rdmachine: ***failed to connect***
4thmachine: Thu Jun 2 09:30:04 MSZ 2005
...

The problem (speaking generally) is that most of the modern tools are designed only with interactive use in mind but can't be used in scripts. I really *like* graphic gimmicks, but they don't help anything if your goal is to automatically get something done every day at 3 am.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies

2. UNIX for Dummies Questions & Answers

Ftps connection by ksh script

Hi, I'm trying to access to FTP SERVER over SSL with this script unix : (credentials are correct) #!/usr/bin/ksh USER="test" PASSWORD="pwdtest" IP="**.***.*.***" ftp -s $IP 990 << EOF >>log_ftp user $USER $PASSWORD bin passive EOF but seems that credentials are not passed... (2 Replies)
Discussion started by: nash83
2 Replies

3. Shell Programming and Scripting

ssh connection through shell script with no interruption

Hi all, I need ssh in shell script. My requirement is: - Take user_name and password from user (in PHP) - Pass this to shell script which will: - connect via ssh - Run sql query - Pass the results back in PHP - Put the results to website. I know PHP has libraries for ssh and ftp, but... (3 Replies)
Discussion started by: shekhar2010us
3 Replies

4. Shell Programming and Scripting

Passing password in script for ssh connection - no except

Used the script posted on forum - unix.com/shell-programming-scripting/21597-script-change-passwords-same-user-multiple-servers.html but the last question posted on this seems to be still unanswered, tried different things with no success, can someone help giving an way to pass the password via... (5 Replies)
Discussion started by: sapadmin
5 Replies

5. Shell Programming and Scripting

testing postgres connection in shell script

I have a script that does db query in postgres. I'm trying to put in some error checking in the script. I keep running into the password prompt problem where when invalid credentials/or database is put it, it would prompt me for a password which hangs the script. Is there a way that I can check for... (0 Replies)
Discussion started by: zerofire123
0 Replies

6. Shell Programming and Scripting

Mysql command after a SSH connection (Script)

Hi all, Im new at scripting and i need to run a few commands at work every hours so i decide to make a script but on 1 of the steps i have a the follwoing problem: The command i do is this: #!/bin/bash ssh root@asdasd001 'mysql -h A-db-1 -uroot -password --execute "show slave status"'... (3 Replies)
Discussion started by: Aparicio
3 Replies

7. Shell Programming and Scripting

Testing connection with a script

I have a box that has to start dhcpd when a certain connection is down and stop the dhcpd when the connection is up again. I would appriciate any help making this script: From server A: ping server B if connection is ok then do nothing if connection is not ok then start dhcpd until... (8 Replies)
Discussion started by: KimJensen
8 Replies

8. Shell Programming and Scripting

Testing success of AWK code in KSH script

I need a bit of help here on something simple. I have a KSH script (must be KSH) that needs to change 2 positional variables in a CSV script. The CSV script looks like this: 00001,010109,01/01/2009 00:01:01 00008,090509,09/05/2009 13:47:26 My AWK script will change $2 and $3 based... (4 Replies)
Discussion started by: kretara
4 Replies

9. Shell Programming and Scripting

ssh connection script

Hi all, I'm writing a script that chooses the best computer available in an open lab. The script works great except every now and then there is a dead computer in the lab that begins the ssh handshaking, but freezes after the following: debug1: Offering public key: When the script happens... (2 Replies)
Discussion started by: x-375HK-x
2 Replies

10. Shell Programming and Scripting

Remote SSH Connection Using Script

Hi, I am new to Shell Scripting. Can anybody help me in writing a Script Which Could Login from a Unix box to a Remote Unix box which accepts the user credentials automatically and display the result for checking the Disk Space Utilisation (Without running any SSH agent). (1 Reply)
Discussion started by: ajith_tg
1 Replies
Login or Register to Ask a Question