PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : ssh-connection ohne pw-abfrage



fratzi
02.09.02, 01:57
folgendes problem:
ich will ein script basteln, dass bestimmte files von rechner A auf rechner B kopiert (backup eben). dies soll per scp geschehen.
im prinzip alles keine große sache, nur wie bekomm ich es hin, dass er beim scp keine pw abfrage mehr macht?
das script soll als cronjob laufen, und wenn er nach einem pw fragt funktioniert das nicht.

ich hab schon mehrere how-tos ausprobiert, threads hier im forum gelesen, doch bei keinem hat es funktioniert (nur immer als root. nie als normaler user). ich habe auch schon mehere key-gen methoden probiert (dsa, rsa und rsa1). ging ebenfalls nicht.

in einem anderem forum hab ich das hier gefunden:



1) Wenn auf dem Rechner A schon /root/.ssh/id_dsa.pub schon existiert, gehe zu 3)
2) dsa-key erzeugen: als root
ssh-keygen -d
schreiben, und nur noch Enter druecken (kein Passwort eingeben).
3) Den Inhalt von /root/.ssh/id_dsa.pub von Rechner A auf Rechner B in die Datei /root/.ssh/authorized_keys kopieren (copy & paste).
Achtung: Der ziemlich lange Key darf in der root/.ssh/authorized_keys nicht ueber mehrere Zeilen umgebrochen sein, sondern muss ein einzige Zeile sein.

Wenn Du nun auf Rechner A "ssh -2 rechnerB ls" schreibst, fuehrst Du auf Rechner B ein ls ohne Passwortabfrage aus.
Das -2 sorgt fuer ssh2, das solltest Du in der /etc/ssh/ssh_config und /etc/ssh/sshd_config allerdings lieber gleich so einstellen, dass nur noch Protokoll 2 verwendet wird.

mit dem habe ich es zuerst probiert. funktionierte auch, aber nur als root :/

ssh_config von rechner A

# $OpenBSD: ssh_config,v 1.10 2001/04/03 21:19:38 todd Exp $

# This is ssh client systemwide configuration file. See ssh(1) for more
# information. This file provides defaults for users, and the values can
# be changed in per-user configuration files or on the command line.

# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for various options

Host *
# ForwardAgent no
# ForwardX11 no
# RhostsAuthentication no
# RhostsRSAAuthentication yes
# RSAAuthentication yes
# PasswordAuthentication yes
# FallBackToRsh no
# UseRsh no
# BatchMode no
# CheckHostIP yes
# StrictHostKeyChecking yes
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_rsa
# Port 22
Protocol 2
# Cipher blowfish
# EscapeChar ~

sshd_config von rechner B

# $OpenBSD: sshd_config,v 1.42 2001/09/20 20:57:51 mouring Exp $

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# This is the sshd server system-wide configuration file. See sshd(8)
# for more information.

Port 22
Protocol 1,2
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO
#obsoletes QuietMode and FascistLogging

# Authentication:

LoginGraceTime 600
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

# rhosts authentication should not be used
RhostsAuthentication no
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
PermitEmptyPasswords no

# Uncomment to disable s/key passwords
ChallengeResponseAuthentication no

# Uncomment to enable PAM keyboard-interactive authentication
# Warning: enabling this may bypass the setting of 'PasswordAuthentication'
#PAMAuthenticationViaKbdInt yes

# To change Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#AFSTokenPassing no
#KerberosTicketCleanup no

# Kerberos TGT Passing does only work with the AFS kaserver
#KerberosTgtPassing yes

X11Forwarding no
X11DisplayOffset 10
PrintMotd yes
#PrintLastLog no
KeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net
#ReverseMappingCheck yes

Subsystem sftp /usr/lib/ssh/sftp-server

ideen? *g*
thx for help.

--fratzi

fratzi
03.09.02, 01:06
juhu ich habs hinbekommen :D
ein update von OpenSSH_2.9.9p2 auf OpenSSH_3.4p1 hat geholfen :)

corresponder
03.09.02, 01:08
holy bowl
benutz da aufm server immer schön das neust mögliche,
sonst lachen irgendwann rootkits....

:D