• This forum has a zero tolerance policy regarding spam. If you register here to publish advertising, your user account will be deleted without further questions.

Frage zur ssh_config

sven79

New Member
Hallo zusammen, ich habe auf meinem Raspberry Pi 4 angefangen einen Server zu installieren.

Gerade habe ich mir die ssh_config vorgenommen und einige Eintragungen gemacht.

Jetzt bekomme ich beim Status folgendes angezeigt:
Code:
sven@server:/etc/ssh $ sudo /etc/init.d/ssh status
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-01-29 08:21:05 CET; 4s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 9392 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 9393 (sshd)
      Tasks: 7 (limit: 4164)
        CPU: 152ms
     CGroup: /system.slice/ssh.service
             ├─9128 sshd: sven [priv]
             ├─9130 sshd: sven@pts/1
             ├─9131 -bash
             ├─9393 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
             ├─9400 sudo /etc/init.d/ssh status
             ├─9401 /bin/sh /etc/init.d/ssh status
             └─9410 systemctl --no-pager status ssh.service


Jan 29 08:21:05 server systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Jan 29 08:21:05 server systemd[1]: ssh.service: Found left-over process 9390 (systemctl) in control group while starting unit. Ignoring.
Jan 29 08:21:05 server systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Jan 29 08:21:05 server systemd[1]: ssh.service: Found left-over process 9391 (systemd-tty-ask) in control group while starting unit. Ignoring.
Jan 29 08:21:05 server systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Jan 29 08:21:05 server sshd[9393]: Server listening on 0.0.0.0 port 1369.
Jan 29 08:21:05 server systemd[1]: Started OpenBSD Secure Shell server.
Jan 29 08:21:05 server sudo[9380]: pam_unix(sudo:session): session closed for user root
Jan 29 08:21:10 server sudo[9400]:     sven : TTY=pts/1 ; PWD=/etc/ssh ; USER=root ; COMMAND=/etc/init.d/ssh status
Jan 29 08:21:10 server sudo[9400]: pam_unix(sudo:session): session opened for user root(uid=0) by sven(uid=1000)
ich wollte einmal nachfragen ob das alles so korrekt ist. Ich habe den user root gesperrt.

Als System läuft Debian 11
 
Last edited by a moderator:
wie kann ich mir einen Bericht anzeigen lassen ob alles läuft.

die ssh_config sieht so aus:
Code:
       $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj 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.

Include /etc/ssh/sshd_config.d/*.conf

Port 1369
AddressFamily inet
Protocol 2
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_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 no
StrictModes yes
MaxAuthTries 6
MaxSessions 10
AllowUsers sven
PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile     .ssh/authorized_keys .ssh/authorized_keys2

#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
RhostsRSAAuthentication no
HostbasedAuthentication no
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
PasswordAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
 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 no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#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
 
Last edited by a moderator:
ich wollte einmal nachfragen ob das alles so korrekt ist. Ich habe den user root gesperrt.
Versuch dich als root einzuloggen. Geht nicht? Dann stimmt es.

Config kannst du mit
Code:
sshd -T
testen.

Code:
sudo /etc/init.d/ssh status
du solltest dringend darauf achten aktuellere / auf das OS zutreffende HOW-To's zu benutzen.
 
Last edited:
dort bekomme ich einen Fehler:

/etc/ssh/sshd_config line 57: Deprecated option RhostsRSAAuthentication
sshd: no hostkeys available -- exiting.

was für einen Schlüssel brauche ich?
 
bei sudo /etc/init.d/ssh status
Code:
 ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-01-29 13:06:42 CET; 56min ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 530 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 559 (sshd)
      Tasks: 10 (limit: 4164)
        CPU: 10.874s
     CGroup: /system.slice/ssh.service
             ├─ 559 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
             ├─ 800 sshd: sven [priv]
             ├─ 802 sshd: sven@pts/0
             ├─ 803 -bash
             ├─1138 sshd: sven [priv]
             ├─1140 sshd: sven@notty
             ├─1141 /usr/lib/openssh/sftp-server
             ├─1187 sudo /etc/init.d/ssh status
             ├─1188 /bin/sh /etc/init.d/ssh status
             └─1197 systemctl --no-pager status ssh.service

Jan 29 13:47:21 server sshd[1143]: rexec line 57: Deprecated option RhostsRSAAuthentication
Jan 29 13:47:21 server sshd[1142]: reprocess config line 57: Deprecated option RhostsRSAAuthentication
Jan 29 13:47:21 server sshd[1143]: reprocess config line 57: Deprecated option RhostsRSAAuthentication
Jan 29 13:47:22 server sshd[1142]: Accepted publickey for sven from 192.168.178.20 port 55522 ssh2: RSA…ct25IfI
Jan 29 13:47:22 server sshd[1143]: Accepted publickey for sven from 192.168.178.20 port 55523 ssh2: RSA…ct25IfI
Jan 29 13:48:23 server sudo[1153]:     sven : TTY=pts/0 ; PWD=/home/sven ; USER=root ; COMMAND=/usr/bin…re-up.d
Jan 29 13:48:23 server sudo[1153]: pam_unix(sudo:session): session opened for user root(uid=0) by sven(…d=1000)
Jan 29 13:48:23 server sudo[1153]: pam_unix(sudo:session): session closed for user root
Jan 29 14:02:50 server sudo[1187]:     sven : TTY=pts/0 ; PWD=/home/sven ; USER=root ; COMMAND=/etc/ini… status
Jan 29 14:02:50 server sudo[1187]: pam_unix(sudo:session): session opened for user root(uid=0) by sven(…d=1000)
Hint: Some lines were ellipsized, use -l to show in full.
ja ich habe root gesperrt
 
Last edited by a moderator:
sshd: no hostkeys available -- exiting.

was für einen Schlüssel brauche ich?

Per default die unter /etc/ssh/ssh_host_* liegen, die werden eigentlich automatisch mit
Code:
ssh-keygen -A
angelegt.


Du benutz Raspian? Wie hast du SSHd installiert?

Normalerweise sieht das so aus auf Debian 11:
Code:
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-01-28 02:09:24 CET; 1 day 12h ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 468 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 476 (sshd)
      Tasks: 1 (limit: 1890)
        CPU: 609ms
     CGroup: /system.slice/ssh.service
             └─476 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
 
Last edited:
ich habe den key mit ssh-keygen -b installiert.

das war automatisch installiert.

was mache ich das der Test wieder passt?
 
-b erstellt aber nicht die Keys in /etc/ssh (da wo SSH per Standard sucht) und ist allein auch kein valides Kommando für ssh-keygen.

Ausgabe
Code:
ls /etc/ssh/ssh_host_*

Und nochmal die frage

Wie hast du SSHd installiert?
Denn hier liegt anscheinend keine Standardinstallation mit nur leicht geänderter sshd_config vor. Eigentlich müsste ExecStartPre im Status Failen wenn dein sshd -t wirft das die Host Keys fehlen.
 
Last edited:
ssh-keygen -b 4069 habe ich eingegeben

doch es war alles installiert und ich habe die Datei nur so geändert
Code:
 ls /etc/ssh/ssh_host_*
/etc/ssh/ssh_host_dsa_key      /etc/ssh/ssh_host_ecdsa_key.pub    /etc/ssh/ssh_host_rsa_key
/etc/ssh/ssh_host_dsa_key.pub  /etc/ssh/ssh_host_ed25519_key      /etc/ssh/ssh_host_rsa_key.pub
/etc/ssh/ssh_host_ecdsa_key    /etc/ssh/ssh_host_ed25519_key.pub
sven@server:~ $
 
Last edited by a moderator:
Achse sorry so meinst du das.

ich habe mir das aktuelle Raspberry Pi OS Lite 64 bit installiert. Und dort war schon openssh server und client installiert.
 
Und nach welchem HowTo hast Du nun die sshd_config erstellt?
Auch wenn ich Debian und Derivate bekanntermassen nicht "mag", bezweifle ich stark, dass sie eine vorsätzlich kaputtgemachte Config für OpenSSH 7.8 mitliefern...
 
welches würdest du mir empfehlen?

die Grundeinstellungen habe ich nach einen YouTube Video gemacht und den erst nach einen Weiser buch von Galileo Computing
 
welches würdest du mir empfehlen?
Ein aktuelles und Deine exakte Version betreffendes HowTo, oder noch besser: Die offizielle Doku zu Deiner Version...
Keinesfalls aber irgendwelche Youtube-Kacke oder veraltete Bücher... (Diese können maximal als Denkanstoss zur weiteren Recherche dienen...)
 
Kleiner Tip am Rande für dein weiteres Vorgehen:
Lade dir eine Virtualisierungssoftware (VMWare, Virtualbox, whatever) auf deinen PC herunter und bau dir damit eine Testumgebung auf, an der du den richtigen Umgang mit einem unixoiden System und seinen Diensten lernen kannst.
Diese Option hat gegenüber deinem RasPi einen entscheidenden Vorteil: Du kannst den aktuellen Zustand deiner Installation sichern und jederzeit wiederherstellen...Bei deinem RasPi müßtest du jedemal neu installieren, wenn du bei deinen Tests irgendwas zerschießt.
Wenn du in deinem Lernprozeß so weit bist, daß du von deinem Serverchen auch Backups erstellen und wieder zurückspielen kannst, dann macht es auch Sinn, auf deinem RasPi weiter zu arbeiten bzw. zu lernen.
 
ich habe mal eine Frage. ich wollte mir vom Rheinwerk Verlag ein Buch mit dem Namen Linux holen. Das ist von 2020 und dort ist auch beschrieben wie man unter ubuntu einen server einrichtet. kann man danach arbeiten?
 
ich habe mal eine Frage. ich wollte mir vom Rheinwerk Verlag ein Buch mit dem Namen Linux holen. Das ist von 2020 und dort ist auch beschrieben wie man unter ubuntu einen server einrichtet. kann man danach arbeiten?
Das ist auf jeden Fall eine gute Basis, um die Grundlagen des Betriebssystems zu erlernen und dessen Funktionsweise zu verstehen.
Und natürlich ist es auch immer hilfreich, die offiziellen Dokumentationen des Systems und der verwendeten Programme zur Hand zu haben. ;)
 
Back
Top