PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.security.ssh > scripted ssh login
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.security.ssh SSH secure remote login and tunneling tools.

scripted ssh login

Réponse
 
LinkBack Outils de la discussion
Vieux 28/07/2007, 16h54   #1
Florian Schoenbeck
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut scripted ssh login


Hi all,

I need to fetch some data from a Database which can be reached via a ssh-tunneled TCP-port.
Manually, everything works fine. First, the ssh-connection is established and after that, the
data is fetched.

Now I need to run this as a cron job, so I need to establish the ssh-connection by script.
That should work without problems because the login is without password. But how can I shut
down the connection after the data is transfered?

Any ideas?

Thanks a lot,

Florian
  Réponse avec citation
Vieux 28/07/2007, 20h43   #2
K. Jennings
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: scripted ssh login

On Sat, 28 Jul 2007 17:54:15 +0200, Florian Schoenbeck wrote:

> Hi all,
>
> I need to fetch some data from a Database which can be reached via a
> ssh-tunneled TCP-port. Manually, everything works fine. First, the
> ssh-connection is established and after that, the data is fetched.
>
> Now I need to run this as a cron job, so I need to establish the
> ssh-connection by script. That should work without problems because the
> login is without password. But how can I shut down the connection after
> the data is transfered?
>
> Any ideas?
>


Can't you use scp?
  Réponse avec citation
Vieux 29/07/2007, 02h02   #3
René Berber
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: scripted ssh login

On Jul 28, 10:54 am, Florian Schoenbeck wrote:

> I need to fetch some data from a Database which can be reached via a ssh-tunneled TCP-port.
> Manually, everything works fine. First, the ssh-connection is establishedand after that, the
> data is fetched.
>
> Now I need to run this as a cron job, so I need to establish the ssh-connection by script.
> That should work without problems because the login is without password. But how can I shut
> down the connection after the data is transfered?
>
> Any ideas?


Use exit, it's just a regular terminal session.
--
René Berber

  Réponse avec citation
Vieux 29/07/2007, 04h14   #4
Darren Tucker
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: scripted ssh login

On 2007-07-28, Florian Schoenbeck <schoenbeck@b-block.de> wrote:
> I need to fetch some data from a Database which can be reached via
> a ssh-tunneled TCP-port. Manually, everything works fine. First,
> the ssh-connection is established and after that, the data is fetched.
>
> Now I need to run this as a cron job, so I need to establish the
> ssh-connection by script. That should work without problems because
> the login is without password. But how can I shut down the connection
> after the data is transfered?


What I used to do was run something like "sleep 5" with ssh -f and the
tunnel. If the sleep exits before the tunnel closes, the remote sshd
will wait for the tunnel to close before closing the ssh connection, so
the sleep just needs to be long enough to establish the tunneled
connection. This should work for most software and versions.

Another alternative, if you're using a recent OpenSSH, is to use the
ControlMaster option when establishing the connection, then use "ssh -O
exit" option to shut the master down when your script is done.

--
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h57.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11505 seconds with 12 queries