ubuntuusers.de

PubkeyAuthentication=yes

Status: Gelöst | Ubuntu-Version: Ubuntu 24.04 (Noble Numbat)
Antworten |

silvertux

(Themenstarter)
Avatar von silvertux

Anmeldungsdatum:
18. April 2012

Beiträge: 200

lubux schrieb:

config-Datei auf den Hosts:

~/.ssh/config ist auf beiden hosts identisch und umfasst je die gleiche Definition für diese 2 hosts - bis jetzt:

Host ...
    HostName 192.168...
    User xy
    Port ....
    IdentityFile ~/.ssh/id_ed25519.pub
#   IdentitiesOnly yes
#   ForwardAgent no
PreferredAuthentications publickey
#   PreferredAuthentications password
#   PasswordAuthentication yes
PasswordAuthentication no 
#

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14790

silvertux schrieb:

Host ...
    HostName 192.168...
    User xy
    Port ....
    IdentityFile ~/.ssh/id_ed25519.pub
PreferredAuthentications publickey
PasswordAuthentication no 
#

Das:

IdentityFile ~/.ssh/id_ed25519.pub

ist falsch, denn in der ssh-Client-Konfigurationsdatei (~/.ssh/config) muss/soll der Pfad zum privaten Schlüssel angeben werden.
... und abgesehen von dieser falschen Zeile, ist deine ssh-Client-Konfigurationsdatei nicht optimal.

EDIT:

Siehe auch: https://wiki.ubuntuusers.de/SSH/#Public-Key-Authentifizierung

silvertux

(Themenstarter)
Avatar von silvertux

Anmeldungsdatum:
18. April 2012

Beiträge: 200

lubux schrieb:

Pfad zum privaten Schlüssel

Danke, habe ich korrigiert ☹ Darum ~/.ssh/config nun:

Host ...
    HostName 192.168....
    User ....
    Port ....
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes
#    PubkeyAuthentication yes
    ForwardAgent no
    AddressFamily any

Ich hoffe doch sehr, dass ich config nun vollständig und korrekt hingekriegt habe.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14790

silvertux schrieb:

#    PubkeyAuthentication yes

Ich hoffe ...

BTW: Warum hast Du diese Zeile kommentiert? ... oder willst Du z. Zt. nicht nur pubkey-Authentication benutzen?

silvertux

(Themenstarter)
Avatar von silvertux

Anmeldungsdatum:
18. April 2012

Beiträge: 200

lubux schrieb:

#    PubkeyAuthentication yes

Hatte eine Fehlermeldung die genau auf diese Zeile hinwies. Versuche, diese Reaktion nochmals zu provozieren.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14790

Versuch mal mit:

ssh -v <...>

(... für den Host in der lokalen ssh-Client-config-Datei und ohne spitze Klammern).

silvertux

(Themenstarter)
Avatar von silvertux

Anmeldungsdatum:
18. April 2012

Beiträge: 200

Habe die Reaktion nochmals ausgelöst - aber aufgrund einer Unachtsamkeit meinerseits:

userxy@host2:~$ ssh host2
/home/userxy/.ssh/config: line 21: Bad configuration option: pubkeyauthentications
/home/userxy/.ssh/config: terminating, 1 bad configuration options

heisst= nachdem ich via ssh bei host2 drin bin, versuche ich nochmals via ssh zu host2 zu gelangen - diesmal von host2 aus. Ergibt eben den Hinweis auf diese Zeile. Darum nun kein # in config.

userxy@host1:~/.ssh$ ssh -v host2
All keys already loaded
OpenSSH_9.6p1 Ubuntu-3ubuntu13.19, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /home/userxy/.ssh/config
debug1: /home/userxy/.ssh/config line 39: Applying options for host2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 18: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: Reading configuration data /home/userxy/.ssh/config
debug1: /home/userxy/.ssh/config line 39: Applying options for host2
debug1: /etc/ssh/ssh_config line 22: Applying options for *
debug1: Connecting to 192.168... [192.168...] port ....
debug1: Connection established.
debug1: identity file /home/userxy/.ssh/id_ed25519 type 3
debug1: identity file /home/userxy/.ssh/id_ed25519-cert type -1
debug1: identity file /home/userxy/.ssh/id_ed25519 type 3
debug1: identity file /home/userxy/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.19
debug1: Remote protocol version 2.0, remote software version OpenSSH_10.2p1 Ubuntu-2ubuntu3.6
debug1: compat_banner: match: OpenSSH_10.2p1 Ubuntu-2ubuntu3.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168...:.... as 'userxy'
debug1: load_hostkeys: fopen /home/userxy/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: sntrup761x25519-sha512@openssh.com
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:...
debug1: load_hostkeys: fopen /home/userxy/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '[192.168...]:....' is known and matches the ED25519 host key.
debug1: Found key in /home/userxy/.ssh/known_hosts:23
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: Sending SSH2_MSG_EXT_INFO
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256>
debug1: kex_ext_info_check_ver: publickey-hostbound@openssh.com=<0>
debug1: kex_ext_info_check_ver: ping@openssh.com=<0>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256>
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: agent returned 1 keys
debug1: Will attempt key: /home/userxy/.ssh/id_ed25519 ED25519 SHA256:... explicit agent
debug1: Will attempt key: /home/userxy/.ssh/id_ed25519 ED25519 SHA256:...
debug1: Offering public key: /home/userxy/.ssh/id_ed25519 ED25519 SHA256:... explicit agent
debug1: Server accepts key: /home/userxy/.ssh/id_ed25519 ED25519 SHA256:... explicit agent
Authenticated to 192.168... ([192.168...]:....) using "publickey".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_hostkeys: searching /home/userxy/.ssh/known_hosts for [192.168...]:.... / (none)
debug1: client_input_hostkeys: searching /home/userxy/.ssh/known_hosts2 for [192.168...]:.... / (none)
debug1: client_input_hostkeys: hostkeys file /home/userxy/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug1: Remote: /home/userxy/.ssh/authorized_keys:7: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /home/userxy/.ssh/authorized_keys:7: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: pledge: fork
Welcome to Ubuntu 26.04.1 LTS (GNU/Linux 7.0.0-31-generic x86_64)

 * Documentation:  https://docs.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

1 device has a firmware upgrade available.
Run `fwupdmgr get-upgrades` for more information.

Expanded Security Maintenance for Applications is enabled.

0 updates can be applied immediately.

1 device has a firmware upgrade available.
Run `fwupdmgr get-upgrades` for more information.

Last login: Wed Sep 16 14:24:10 2026 from 192.168....
userxy@host2:~$

silvertux

(Themenstarter)
Avatar von silvertux

Anmeldungsdatum:
18. April 2012

Beiträge: 200

Inzwischen kann ich meinen home von host2 via sshfs direkt innerhalb host1 mounten - mittels script = einfacherer Zugriff auf host2.

Antworten |