Automatisches SFTP

Backup, Restore und Transfer von Daten
Post Reply
typolos
Posts: 57
Joined: 2003-03-26 18:44

Automatisches SFTP

Post by typolos »

Hallo,

Ich habe mal wieder ein Problem. Ich möchte von einem Server mittels SFTP von einam anderen Server jeden Abend eine Datei abholen und diese dann auf dem Remote Server löschen. Mit SFTP sollte das ja mittels einer Batch Datei auch kein Problem sein. Nur bekomme ich es nicht hin das ich mich ohne Passwortabfrage anmelden kann.
Folgendes habe ich ausprobiert:

Code: Select all

$ ssh-keygen -t dsa -b 2048 -f ~/rsync-key
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]
Your identification has been saved in /home/user/rsync-key.
Your public key has been saved in /home/user/rsync-key.pub.
The key fingerprint is:
8c:57:af:68:cd:b2:7c:aa:6d:d6:ee:0a:5a:a4:29:03 user@localhost
Dann den öffentlichen Schlüssel auf den Remote-Sever kopert und da dann folgendes ausgeführt:

Code: Select all

mkdir ~/.ssh
chmod 700 ~/.ssh
mv ~/rsync-key.pub ~/.ssh/
cd ~/.ssh/
touch authorized_keys
chmod 600 authorized_keys
cat rsync-key.pub >> authorized_keys 
Und dann folgenden Test durchgeführt:

Code: Select all

ssh -i ~/rsync-key user@remotehost.
Doch leider fragt er mich dann nach dem Passwort. Was mache ich falsch?

MfG
Christian S.
Last edited by typolos on 2006-02-01 12:02, edited 1 time in total.
oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim

Re: Automatisches SFTP

Post by oxygen »

starte ssh mal mit -v
typolos
Posts: 57
Joined: 2003-03-26 18:44

Re: Automatisches SFTP

Post by typolos »

Kommt folgende Meldung (IP geändert):

Code: Select all

OpenSSH_3.8p1, SSH protocols 1.5/2.0, OpenSSL 0.9.7d 17 Mar 2004
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /root/rsync-key type 2
debug1: Remote protocol version 2.0, remote software version 3.2.9.1 SSH Secure Shell (non-commercial)
debug1: no match: 3.2.9.1 SSH Secure Shell (non-commercial)
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '127.0.0.1' is known and matches the DSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_dss_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /root/rsync-key
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
Leider werde ich daraus nicht wirklich schlau.

Gruß
Christia S.
Post Reply