Verständnisfrage: SSH public key
-
- Posts: 660
- Joined: 2002-10-19 14:01
Verständnisfrage: SSH public key
Hi,
Daher ich evtl, dies hier machen werde:
--> http://www.rootforum.org/forum/viewtopi ... n&start=15
Wollte ich mal fragen, wohin mit dem public key?
Ich denke mir mal soweit ich es gelesen habe, das man den public key auf den rechner packt wovon aus die anfrage abgeschickt wird und auf dem ziehlrechner im ordner .ssh die datei autoresierte_keys gespeichert wird.
Habe ich das so richtig verstanden? Wenn nicht, dann bitte ich euch mich mal zu korrigieren. Weil ich mich später über das script was dort im forum steht dann auf dem remote rechner einloggen möchte.
die andere frage ist, muss man dann in der sshd_config es umstellen, wenn man sich per script mit der keyfile autoresieren will oder muss man das nicht?!
Wie man den key erstellt usw. weiss ich, nur welche datei wohin muss, das habe ich da noch nicht richtig vernommen, daher frage ich euch da noch einmal, bevor ich da anfange.
Daher ich evtl, dies hier machen werde:
--> http://www.rootforum.org/forum/viewtopi ... n&start=15
Wollte ich mal fragen, wohin mit dem public key?
Ich denke mir mal soweit ich es gelesen habe, das man den public key auf den rechner packt wovon aus die anfrage abgeschickt wird und auf dem ziehlrechner im ordner .ssh die datei autoresierte_keys gespeichert wird.
Habe ich das so richtig verstanden? Wenn nicht, dann bitte ich euch mich mal zu korrigieren. Weil ich mich später über das script was dort im forum steht dann auf dem remote rechner einloggen möchte.
die andere frage ist, muss man dann in der sshd_config es umstellen, wenn man sich per script mit der keyfile autoresieren will oder muss man das nicht?!
Wie man den key erstellt usw. weiss ich, nur welche datei wohin muss, das habe ich da noch nicht richtig vernommen, daher frage ich euch da noch einmal, bevor ich da anfange.
Re: Verständnisfrage: SSH public key
Private-Key: local:/home/user/.ssh/authorized_keys
Public-Key: remote:/home/user/.ssh/id_[dr]sa
Public-Key: remote:/home/user/.ssh/id_[dr]sa
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
Also irgendwie funzt das nicht.
Ich habe das schlüsselpaar auf meinem rooti erzeugt mit hilfe dieser guten anleitung:
--> http://www.rootforum.org/faq/index.php? ... artlang=de
So dann habe ich eine id_rsa und eine id_rsa.pub bekommen. Danach habe ich wie in der anleitung die autorized_keys erstellt, wo der public key drin erstellt wird bzw. eingetragen wird.
die id_rsa habe ich auf meinem Rechner kopiert und in putty eingefügt, dann gespeichert. Desweiteren habe ich in der sshd_config auf key auth umgestellt, aber sobald ich mich mit putty connecten will kommt folgende meldeung:
Das steht bei auth:
Also irgendwie funzt das nicht.
Ich habe das schlüsselpaar auf meinem rooti erzeugt mit hilfe dieser guten anleitung:
--> http://www.rootforum.org/faq/index.php? ... artlang=de
So dann habe ich eine id_rsa und eine id_rsa.pub bekommen. Danach habe ich wie in der anleitung die autorized_keys erstellt, wo der public key drin erstellt wird bzw. eingetragen wird.
die id_rsa habe ich auf meinem Rechner kopiert und in putty eingefügt, dann gespeichert. Desweiteren habe ich in der sshd_config auf key auth umgestellt, aber sobald ich mich mit putty connecten will kommt folgende meldeung:
und funzt nicht und fordert mich weiterhin auf ein password einzugeben. Habe auch zich anleitungen durch, aber nichts funktioniert :(Using username "web1".
Unable to use key file "D:Dokumente und EinstellungenAdministratorDesktopmicha21" (OpenSSH SSH2 private key)
Das steht bei auth:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
Bitte um hilfe.drwx------ 2 web1 web1 58 2005-08-16 17:45 .
drwxrwxrwx 28 root root 4096 2005-08-16 17:45 ..
-rw-r--r-- 1 web1 web1 224 2005-08-16 17:45 authorized_keys
-rw------- 1 web1 web1 887 2005-08-16 17:45 id_rsa
-rw-r--r-- 1 web1 web1 224 2005-08-16 17:45 id_rsa.pub
Re: Verständnisfrage: SSH public key
Code: Select all
ls -alh ~/
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
Ja da zeigt er mir unter /root das verzeichnis an.
Die frage ist, wo soll ich die keyfiles erstellen unter "p151036xx:~/.ssh" oder "web1@p151036xx:~/.ssh" ?
weil habe ja auch permitted rootlogin auf no gestellt also kein direkter rootlogin oder wird es durch den keyauth aufgehoben?
weil möchte mich ja als web1 mit der keyfile anmelden und nicht als root.
Ja da zeigt er mir unter /root das verzeichnis an.
Die frage ist, wo soll ich die keyfiles erstellen unter "p151036xx:~/.ssh" oder "web1@p151036xx:~/.ssh" ?
weil habe ja auch permitted rootlogin auf no gestellt also kein direkter rootlogin oder wird es durch den keyauth aufgehoben?
weil möchte mich ja als web1 mit der keyfile anmelden und nicht als root.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
So bin ein schritt weiter....
bekomme nun nur noch:
login as: web1
Server refused our key
Password:
will nicht funktionieren und google hilft mir da auch nicht weiter :(
So bin ein schritt weiter....
bekomme nun nur noch:
login as: web1
Server refused our key
Password:
will nicht funktionieren und google hilft mir da auch nicht weiter :(
Re: Verständnisfrage: SSH public key
Der Public-Key muss in /path/to/home/web1/.ssh/authorized_keys gespeichert sein. Zusätzlich sollten folgende Rechte vergeben sein:
Code: Select all
joeuser@server ~ $ ls -alh .ssh
total 16K
drwx------ 2 joeuser users 4.0K Aug 7 17:49 .
drwxr-xr-x 11 joeuser users 4.0K Aug 15 13:30 ..
-rw------- 1 joeuser users 4.5K Aug 7 17:48 authorized_keys
joeuser@server ~ $
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
So hab mir mal die logs reingezogen und folgendes gesehn:
der web1 ordner hat aber definitiv web1:web1 rechte, aber irgendwo klemmt es noch, weil weiterhin refused.
So hab mir mal die logs reingezogen und folgendes gesehn:
Code: Select all
Aug 16 19:31:27 p15103699 sshd[9704]: Authentication refused: bad ownership or modes for directory /home/htdocs/web1
Aug 16 19:31:27 p15103699 sshd[9704]: Authentication refused: bad ownership or modes for directory /home/htdocs/web1
Code: Select all
drwxrwxrwx 28 web1 web1 4096 2005-08-16 18:35 .
drwxr-xr-x 9 root root 88 2005-04-30 13:37 ..
drwx------ 2 web1 web1 28 2005-08-16 19:53 .ssh
Last edited by blnsnoopy26 on 2005-08-16 20:07, edited 3 times in total.
-
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: Verständnisfrage: SSH public key
Die Dateien dürfen nur für den Benutzer selbst lesbar sein.blnsnoopy26 wrote:der web1 ordner hat aber definitiv web1:web1 rechte, aber irgendwo klemmt es noch, weil weiterhin refused.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
ist es ja:Roger Wilco wrote:Die Dateien dürfen nur für den Benutzer selbst lesbar sein.blnsnoopy26 wrote:der web1 ordner hat aber definitiv web1:web1 rechte, aber irgendwo klemmt es noch, weil weiterhin refused.
Code: Select all
drwx------ 2 web1 web1 28 2005-08-16 19:53 .
drwxrwxrwx 28 web1 web1 4096 2005-08-16 18:35 ..
-rw------- 1 web1 web1 395 2005-08-16 19:31 authorized_keys
Re: Verständnisfrage: SSH public key
Poste bitte Deine /etc/ssh/sshd_config (ohne Kommentare).
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Meine config:
Code: Select all
Port 22
Protocol 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 1h
#ServerKeyBits 768
# Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# 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
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication no
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCreds yes
# Set this to 'yes' to enable PAM authentication (via challenge-response)
# and session processing. Depending on your PAM configuration, this may
# bypass the setting of 'PasswordAuthentication'
UsePAM yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#KeepAlive yes
#UseLogin no
UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
# no default banner path
#Banner /some/path
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
Re: Verständnisfrage: SSH public key
Führe mal folgendes aus (Backup der sshd_config anlegen!):
Danach sollte es funktionieren.
Code: Select all
cat > /etc/ssh/sshd_config << "EOF"
# This is the sshd server system-wide configuration file.
# See sshd_config(5) for more information.
# The strategy used for options in the default sshd_config shipped
# with OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.
Port 22
Protocol 2
#AddressFamily any
#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 1h
#ServerKeyBits 768
# Logging
#obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# 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
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords no
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
# no default banner path
#Banner /some/path
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
EOF
/etc/init.d/sshd restart
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
thx werd ich gleich mal Probieren.
thx werd ich gleich mal Probieren.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
tut mir leid funzt nicht selbe fehlermeldung:
verzweifle da schon.
tut mir leid funzt nicht selbe fehlermeldung:
Code: Select all
Aug 16 20:37:37 p15103699 sshd[62]: Authentication refused: bad ownership or modes for directory /home/htdocs/web1
Aug 16 20:37:37 p15103699 sshd[62]: Authentication refused: bad ownership or modes for directory /home/htdocs/web1
Re: Verständnisfrage: SSH public key
Code: Select all
chmod 0755 /home/htdocs/web1
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
JoeUser,Joe User wrote:Code: Select all
chmod 0755 /home/htdocs/web1
Wenn wir uns irgendwann mal sehn sollten geb ich dir nen bier aus, weil...
Code: Select all
Using username "web1".
Authenticating with public key "imported-openssh-key"
Last login: Tue Aug 16 20:21:10 2005 from xxxx.dip0.t-ipconnect.de
Have a lot of fun...
web1@p15103699:~>
Ein frage habe ich aber noch :)
Wenn ich über ein phpscript/perlscript mich mit einem public key authen möchte muss der remoteserver die selben einstellungen haben, oder reicht es wenn im .ssh Ordner mit den richtigen Rechten die datei autorized_keys drin ist?
Wenn ich quasi dies hier machen möchte:
http://www.rootforum.org/forum/viewtopi ... n&start=15
was ist da genau zu beachten?
Re: Verständnisfrage: SSH public key
Die Konfiguration vom Zielsystem (remote) hast Du ja jetzt durchgeführt ;) Auf dem Quellsystem (local) muss zusätzlich im ~/.ssh noch der Private-Key (chmod 0600 ~/.ssh/id_rsa) abgelegt werden. Danach sollte das Script funktionieren.
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
Werd es gleich mal probieren :)
edit: muss das perl net ssh noch installieren :(
Werd es gleich mal probieren :)
edit: muss das perl net ssh noch installieren :(
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
Gibt da leider noch ein Problem und zwar habe ich net Net::SSH installiert, wenn ich aber das script jetzt ausführe, dann kommt das:
Wieso kommt da jetzt ost key failed?
habe die id_rsa auf dem remoterechner installiert
Gibt da leider noch ein Problem und zwar habe ich net Net::SSH installiert, wenn ich aber das script jetzt ausführe, dann kommt das:
Code: Select all
Host key verification failed.
habe die id_rsa auf dem remoterechner installiert
-
- Posts: 660
- Joined: 2002-10-19 14:01
Re: Verständnisfrage: SSH public key
Hi,
Hat sich erledigt...
auf dem Remoterechner fehlte noch die datei "known_hosts" und nu geht es.
Hat sich erledigt...
auf dem Remoterechner fehlte noch die datei "known_hosts" und nu geht es.