2010-02-09 11 views

risposta

9

sul client è necessario generare la sua chiave pubblica e aggiungerla all'elenco di chiavi autorizzato del server.

ssh-keygen -t dsa -f id_dsa //on client machine 
mv id_dsa* ~/.ssh/ //on client machine 
scp ~/.ssh/id_dsa.pub [email protected]:~/.ssh/HOST_NAME.key // on client machine 
cat ~/.ssh/HOST_NAME.key >> ~/.ssh/authorized_keys2 // on server

+3

Usa 'ssh- copy-id' invece del tuo 'scp' +' cat' dance. – ephemient

+0

Bello, come quel ssh-copy-id. Sono su un HP-UX e vorrei che fosse installato. –

+0

Oh, giusto ... Ho dimenticato che non tutto il mondo usa OpenSSH. Triste. – ephemient

0

Ricordati di

chmod 700 .ssh 

e anche

chmod 600 authorized_keys 
0

Si tratta di una soluzione per gli utenti di Windows

ho avuto un problema simile sulle finestre quindi ho usato Putty da http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Se è necessario generare una chiave pubblica th en uso: http://the.earth.li/~sgtatham/putty/latest/x86/puttygen.exe

Poi, quando si desidera automatizzare un lotto per scaricare dal server FTP del Pageant al fine di caricare la chiave privata nella sessione http://the.earth.li/~sgtatham/putty/latest/x86/pageant.exe

quindi utilizzare il PSFTP per connettere ed eseguire azioni http://the.earth.li/~sgtatham/putty/latest/x86/psftp.exe

ecco il codice di esempio per il lotto:

!--Loading the key to session--! 
@C:\pageant.exe "C:\privatekey.ppk" 
!--Calling the PSFTP.exe with the uaser and sftp address + command list file--! 
@C:\psftp [email protected] -b C:\sftp_cmd.txt 

file di elenco dei comandi (sftp_cmd.txt) sarà come in questo modo:

mget "*.*" !--downloading every thing 
!--more commands can follow here 
close 

Ora, tutto ciò che serve per programmare in attività pianificate * Vorrei che fosse semplice come lavoro cron di Unix ....

Problemi correlati