ubuntuusers.de

Back in Time: mit ssh auf NAS scheitert

Status: Ungelöst | Ubuntu-Version: Kubuntu 25.10 (Questing Quokka)
Antworten |

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

weholei schrieb:

Hast du das gemacht und funktioniert es? Oder habe ich es übersehen, dass du das gepostet hast?

Du hast es übersehen. Es funktioniert beim TE nicht, denn:

1
2
3
4
5
6
USER@RECHNER:~/.ssh$ ssh -i /home/USER/.ssh/id_ed25519 -p PORT 'USER@IP_DES_NAS'
USER@IP_DES_NAS's password: 

...

USER@NAS:~$ 

wired2051

(Themenstarter)
Avatar von wired2051

Anmeldungsdatum:
28. Februar 2007

Beiträge: 2904

lubux schrieb:

Hast Du in der sshd_config (oder gleichwertig) des NAS, die Passwort-Authentication deaktiviert?

Ich glaube nicht. Auf dem NAS in /etc/ssh/sshd_config steht in Zeile 58 PasswordAuthentication yes:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#   $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

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

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

# 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 override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
#AuthorizedKeysFile .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# 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 yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# 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 and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
AllowTcpForwarding no
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
#Subsystem  sftp    /usr/libexec/sftp-server
Subsystem       sftp    internal-sftp -f DAEMON -u 000

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server
Match User root
    AllowTcpForwarding yes
Match User admin
    AllowTcpForwarding yes
Match User anonymous
    AllowTcpForwarding no
    GatewayPorts no

lubux schrieb:

Was wird mit "-vv" zusätzlich angezeigt?

ssh -vv -i /home/USER/.ssh/id_ed25519 -p PORT 'USER@IP_DES_NAS'

...auf dem NAS:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
debug1: OpenSSH_10.0p2 Ubuntu-5ubuntu5.4, OpenSSL 3.5.3 16 Sep 2025
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname IP_DES_NAS is address
debug1: Connecting to IP_DES_NAS [IP_DES_NAS] port PORT.
debug1: Connection established.
debug1: identity file /home/USER/.ssh/id_ed25519 type 3
debug1: identity file /home/USER/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_10.0p2 Ubuntu-5ubuntu5.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2
debug1: compat_banner: match: OpenSSH_8.2 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to IP_DES_NAS:PORT as 'USER'
debug1: load_hostkeys: fopen /home/USER/.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
debug2: local client KEXINIT proposal
debug2: KEX algorithms: mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,kex-strict-c-v00@openssh.com
debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,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
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,kex-strict-s-v00@openssh.com
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256
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:D+qp1cbDOJSnDBI50HWQTEyM/sidntGh42qEQMJ22b8
debug1: load_hostkeys: fopen /home/USER/.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: checking without port identifier
debug1: load_hostkeys: fopen /home/USER/.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 'IP_DES_NAS' is known and matches the ED25519 host key.
debug1: Found key in /home/USER/.ssh/known_hosts:1
debug1: found matching key w/out port
debug1: check_host_key: hostkey not known or explicitly trusted: disabling UpdateHostkeys
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug2: KEX algorithms: mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,kex-strict-c-v00@openssh.com
debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,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
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /home/USER/.ssh/id_ed25519 ED25519 SHA256:+wyyFDV0ClNYqmzH/c57q2zibvQ6OftXLeL/wDwvthg explicit
debug2: pubkey_prepare: done
debug1: Offering public key: /home/USER/.ssh/id_ed25519 ED25519 SHA256:+wyyFDV0ClNYqmzH/c57q2zibvQ6OftXLeL/wDwvthg explicit
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
USER@IP_DES_NAS's password: 
debug2: we sent a password packet, wait for reply
Authenticated to IP_DES_NAS ([IP_DES_NAS]:PORT) using "password".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: Ignored authorized keys: bad ACL permission for file /volume1/homes/USER
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: channel 0: setting env COLORTERM = "truecolor"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_ADDRESS = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_NAME = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_MONETARY = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_PAPER = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LANG = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_IDENTIFICATION = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_TELEPHONE = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_MEASUREMENT = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_TIME = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug1: channel 0: setting env LC_NUMERIC = "de_DE.UTF-8"
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug1: pledge: fork
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0

Using terminal commands to modify system configs, execute external binary
files, add files, or install unauthorized third-party apps may lead to system
damages or unexpected behavior, or cause data loss. Make sure you are aware of
the consequences of each command and proceed at your own risk.

Warning: Data should only be stored in shared folders. Data stored elsewhere
may be deleted when the system is updated/restarted.

weholei schrieb:

Now try logging into the machine, with: "ssh -i /home/USER/.ssh/id_ed25519 -p PORT 'USER@IP_DES_NAS'" Zitierter Textand check to make sure that only the key(s) you wanted were added.

Hast du das gemacht und funktioniert es? Oder habe ich es übersehen, dass du das gepostet hast?

Hatte ich gemacht:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
USER@RECHNER:~/.ssh$ ssh -i /home/USER/.ssh/id_ed25519 -p PORT 'USER@IP_DES_NAS'
USER@IP_DES_NAS's password: 

Using terminal commands to modify system configs, execute external binary
files, add files, or install unauthorized third-party apps may lead to system
damages or unexpected behavior, or cause data loss. Make sure you are aware of
the consequences of each command and proceed at your own risk.

Warning: Data should only be stored in shared folders. Data stored elsewhere
may be deleted when the system is updated/restarted.

USER@NAS:~$ 

Da ich ohne Fehlermeldung auf dem NAS landete, interpretierte ich es als Erfolg.

EDIT:

@lubux interpretiert es als Misserfolg.

EDIT2:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
USER@NAS:~$ systemctl status sshd
● sshd.service - OpenBSD Secure Shell server
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/local/lib/systemd/system/sshd.service.d
           └─synorelay-service-handler.conf
   Active: active (running) since Fri 2026-03-20 11:07:53 CET; 2 months 20 days ago
 Main PID: 8977 (sshd)
   CGroup: /sshd.slice/sshd.service
           ├─ 8977 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups
           ├─28520 sshd: USER [priv]
           ├─28531 sshd: USER@pts/0
           ├─28532 -sh
           └─30765 systemctl status sshd

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

wired2051 schrieb:

lubux schrieb:

Hast Du in der sshd_config (oder gleichwertig) des NAS, die Passwort-Authentication deaktiviert?

Ich glaube nicht. Auf dem NAS in /etc/ssh/sshd_config steht in Zeile 58 PasswordAuthentication yes:

1
2
3
4
debug1: Next authentication method: password
USER@IP_DES_NAS's password: 
debug2: we sent a password packet, wait for reply
Authenticated to IP_DES_NAS ([IP_DES_NAS]:PORT) using "password".

Du hast auch PW-Authentication konfiguriert.

wired2051

(Themenstarter)
Avatar von wired2051

Anmeldungsdatum:
28. Februar 2007

Beiträge: 2904

lubux schrieb:

Du hast auch PW-Authentication konfiguriert.

In Zeile 102. War ich das? Wie? Wann? Und wie korrigierem ich das?

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

wired2051 schrieb:

Und wie korrigierem ich das?

In der sshd_config vom Server.

wired2051

(Themenstarter)
Avatar von wired2051

Anmeldungsdatum:
28. Februar 2007

Beiträge: 2904

Einfach in in /etc/ssh/sshd_config Zeile 58 PasswordAuthentication yes ändern in PasswordAuthentication no?

Wann und wie wurde das vermutlich auf yes gesetzt? Wann habe ich was falsch gemacht?

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

wired2051 schrieb:

... PasswordAuthentication no?

Ja, und bei bzw. mit:

AuthenticationMethods

in der sshd_config.

weholei

Anmeldungsdatum:
7. Februar 2019

Beiträge: 1090

Wohnort: Mittelfranken

Ich erlaube mir mal, euch meine sshd_config zu schicken, damit ihr vergleichen könnt:

Port xxxxx
PermitRootLogin prohibit-password
PasswordAuthentication no
PubkeyAuthentication yes
### ab hier war alles schon vorgegeben
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem       sftp    /usr/lib/openssh/sftp-server
IgnoreRhosts yes
IgnoreUserKnownHosts no
StrictModes yes
PermitEmptyPasswords no
KbdInteractiveAuthentication yes

###

Es sind nur die Einträge, die in nano grau, also nicht auskommentiert sind

./. seid ihr sicher, dass bei der Erstellung des key mit Enter kein passwort vergeben wurde?

noch etwas ist mir eingefallen 😉

Einfach in in /etc/ssh/sshd_config Zeile 58 PasswordAuthentication yes ändern in PasswordAuthentication no?

Meines Wissens ist "yes" vorgegeben, als Standard, ich habe es nur auf no gesetzt, weil ich unerwünschte loǵinversuche feststellte.

Wenn eine key erstellt ist fragt er nicht nach passwort

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

weholei schrieb:

Wenn eine key erstellt ist fragt er nicht nach passwort

Das ist eine Frage der Konfiguration auf dem Server. Z. B. (... nur zum hier zeigen und temporär) 2x unterschiedlicher pubkey mit unterschiedlicher passphrase (für dessen Benutzung) und 1x das Passwort vom user auf dem Server:

1
2
3
4
5
<user-client>@<rechner-client>:~$ ssh <host>
Enter passphrase for key '/home/<user-client>/.ssh/id_rsa_ax': 
Enter passphrase for key '/home/<user-client>/.ssh/id_ed25519': 
<user-server>@192.168.178.13's password:
<user-server>@<rechner-server>:~ $ 

In der sshd_config auf dem Server gibt es (temporär) u. a. diese wirksame Zeile:

1
AuthenticationMethods publickey,publickey,password

EDIT:

@TE:

Ergänze deine sshd_config mit der Zeile:

1
AuthenticationMethods publickey

und ändere in deiner sshd_config, die Zeilen 38 und 58 aus:

1
2
3
#PubkeyAuthentication yes

PasswordAuthentication yes

in:

1
2
3
PubkeyAuthentication yes

PasswordAuthentication no

Teste nach dem speichern, mit:

sudo sshd -t

wired2051

(Themenstarter)
Avatar von wired2051

Anmeldungsdatum:
28. Februar 2007

Beiträge: 2904

Nochmals Danke für die geduldige Hilfe! 👍

lubux schrieb:

Teste nach dem speichern, mit:

sudo sshd -t

Vor und nach der Änderung war das Ergebnis keine Ausgabe, also nur eine neue Prompt-Zeile.

Das ist die /etc/ssh/sshd_config auf dem NAS nach meinen drei Änderungen in Zeile 33, 42 und 63:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#   $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

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

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

# 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 override the
# default value.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#ORIGINAL: 'AuthenticationMethods publickey' nicht vorhanden
AuthenticationMethods publickey

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#ORIGINAL: #PubkeyAuthentication yes
PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
#AuthorizedKeysFile .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# 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!
#ORIGINAL: PasswordAuthentication yes
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# 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 and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
AllowTcpForwarding no
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
#Subsystem  sftp    /usr/libexec/sftp-server
Subsystem       sftp    internal-sftp -f DAEMON -u 000

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server
Match User root
    AllowTcpForwarding yes
Match User admin
    AllowTcpForwarding yes
Match User anonymous
    AllowTcpForwarding no
    GatewayPorts no

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

wired2051 schrieb:

Das ist die /etc/ssh/sshd_config auf dem NAS ...

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# override default of no subsystems
#Subsystem  sftp    /usr/libexec/sftp-server
Subsystem       sftp    internal-sftp -f DAEMON -u 000

Match User root
    AllowTcpForwarding yes
Match User admin
    AllowTcpForwarding yes
Match User anonymous
    AllowTcpForwarding no
    GatewayPorts no

Hast Du diese Zeilen:

1
2
3
4
5
Subsystem       sftp    internal-sftp -f DAEMON -u 000
 Match User root
     AllowTcpForwarding yes
 Match User admin
     AllowTcpForwarding yes

konfiguriert oder ist das die default Konfiguration auf dem NAS?
Wie ist die Ausgabe von:

1
ls -la /usr/lib/openssh/sftp-server

?

Versuch mal mit:

1
2
3
4
5
6
Subsystem sftp /usr/lib/openssh/sftp-server

# Match User root
#     AllowTcpForwarding yes
# Match User admin
#     AllowTcpForwarding yes

wired2051

(Themenstarter)
Avatar von wired2051

Anmeldungsdatum:
28. Februar 2007

Beiträge: 2904

lubux schrieb:

Hast Du diese Zeilen konfiguriert oder ist das die default Konfiguration auf dem NAS?

Ich habe an der /etc/ssh/sshd_config auf dem NAS nichts eigenständig geändett.

lubux schrieb:

Wie ist die Ausgabe von:

1
ls -la /usr/lib/openssh/sftp-server

...auf dem NAS und dem PC: ls: cannot access '/usr/lib/openssh/sftp-server': No such file or directory.

Soll ich dennoch die 4 Zeilen in /etc/ssh/sshd_config auf dem NAS auskommentieren?

weholei

Anmeldungsdatum:
7. Februar 2019

Beiträge: 1090

Wohnort: Mittelfranken

Dann hast du eine andere Konfiguration....

testuser@asrock:~ $ ls -la /usr/lib/openssh/sftp-server
-rwxr-xr-x 1 root root 88344 Mär  4 18:55 /usr/lib/openssh/sftp-server
testuser@asrock:~ $ 

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14831

wired2051 schrieb:

lubux schrieb:

Wie ist die Ausgabe von:

1
ls -la /usr/lib/openssh/sftp-server

...auf dem NAS und dem PC: ls: cannot access '/usr/lib/openssh/sftp-server': No such file or directory.

Such mal mit:

1
2
sudo find / -iname '*internal-sftp*'
sudo find / -iname '*sftp-server*'

auf deinem NAS nach diesen Dateien.

wired2051 schrieb:

Soll ich dennoch die 4 Zeilen in /etc/ssh/sshd_config auf dem NAS auskommentieren?

Ja.

wired2051

(Themenstarter)
Avatar von wired2051

Anmeldungsdatum:
28. Februar 2007

Beiträge: 2904

lubux schrieb:

Such mal mit:

1
2
sudo find / -iname '*internal-sftp*'
sudo find / -iname '*sftp-server*'

auf deinem NAS nach diesen Dateien.

...beides nicht gefunden.

wired2051 schrieb:

Soll ich dennoch die 4 Zeilen in /etc/ssh/sshd_config auf dem NAS auskommentieren?

Ja.

Erledigt. Dennoch kommt nach Start von Back in Time (Profil bearbeiten) die Meldung "Möchten Sie Ihren öffentlichen SSH-Schlüssel auf den entfernten Rechner kopieren, um die passwortlose Anmeldung zu aktivieren?". Wenn ich OK wähle muss ich ein PW (von USER fürs NAS) eingeben und lande in einer Endlosschleife bis ich die Frage verneine.

Ich bin ziemlich frustriert. Bisher, auf einem alten PC, lief das Backup mit einem einfachen Script:

1
rsync -au --delete --exclude=.Trash-1000/ /media/Daten/ IP_DES_NAS::backupDaten

Auf dem NAS gab es eine /etc/rsyncd.conf mit

1
2
3
4
5
6
7
8
[backupDaten]
path = /volume1/Daten
comment = Daten
uid = root
gid = root
read only = no
list = yes
charset = utf-8

Nachteil: es gab keine Versionen vom Backup.

Dennoch überlege ich das Backup wieder mit dem rsync-Scipt zu machen, denn dieses Drama hier kann ich ja niemandem länger zumuten... 😕