Page 1 of 1

I cant restart sshd

Posted: Thu Jul 18, 2024 7:16 am
by kerogaz
root@mx:/etc/ssh# systemctl restart sshd
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
root@mx:/etc/ssh#
root@mx:/etc/ssh# systemctl status sshd
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:19 am
by dolphin_oracle
systemctl is a systemd utility, which you are not using.

use service command

service SERVICENAME action

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:20 am
by kerogaz
service sshd restart
sshd: unrecognized service

service ssh restart
ssh: unrecognized servic

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:25 am
by Charlie Brown
Menu => "MX Service Manager".

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:34 am
by dolphin_oracle

Code: Select all

┌─[dolphin@mxXfceAHS]─[07:33:03 am]──────────────────────────────────────────────────────────────[~]
└─> sudo service ssh restart
Restarting OpenBSD Secure Shell server: sshd.
note the command uses "ssh" rather than "sshd". that's how the init script is labeled.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:35 am
by DukeComposed
kerogaz wrote: Thu Jul 18, 2024 7:20 am service sshd restart
sshd: unrecognized service
Confirm that sshd is installed and running. You can do this with "dpkg -l | grep openssh" and "netstat -na | grep LISTEN | grep 22" (as well as many other ways that are probably more efficient).

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:36 am
by kerogaz
Image

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:40 am
by kerogaz
I dont see sshd nor ssh

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:41 am
by Charlie Brown
Edit (according to your new post): It may be removed somehow. You can (re)install via "MX Package Installer".

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:44 am
by kerogaz
But ssh is installed and running beacose I can use ssh for connect to other computer

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:44 am
by dolphin_oracle
you can connect without the service. we do not install the service/server by default.

ssh is not a server. its a client.

so you got nothing to restart.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:45 am
by Charlie Brown
kerogaz wrote: Thu Jul 18, 2024 7:44 am But ssh is installed and running beacose I can use ssh for connect to other computer
Ok, but somehow the service is not listed:

Code: Select all

apt list ssh* -i

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:50 am
by kerogaz
apt list ssh* -i

Listing... Error!
E: input:0-10: error: Expected pattern
ssh_config
^^^^^^^^^^

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:53 am
by kerogaz
ssh -p 11954 pal@10.44.1.1
(pal@10.44.1.1) Password for pal@celebris:
Last login: Thu Jul 18 14:52:06 2024 from 10.44.7.77
FreeBSD 14.0-RELEASE-p6 (GENERIC) #0: Tue Mar 26 20:26:20 UTC 2024

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories: https://www.FreeBSD.org/security/
FreeBSD Handbook: https://www.FreeBSD.org/handbook/
FreeBSD FAQ: https://www.FreeBSD.org/faq/
Questions List: https://www.FreeBSD.org/lists/questions/
FreeBSD Forums: https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with: pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed: freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages: man man
FreeBSD directory layout: man hier

To change this login announcement, see motd(5).
To quickly create an empty file, use "touch filename".
-- Dru <genesis@istar.ca>


You see ssh works fine, but I can’t restart it

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:55 am
by Charlie Brown
:confused:

Code: Select all

$ apt list ssh* -i
Listing... Done
ssh-askpass-gnome/stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed]
ssh/stable-security,stable-security,now 1:9.2p1-2+deb12u3 all [installed]
sshfs/stable,now 3.7.3-1.1 amd64 [installed]
Even better with one more * :

Code: Select all

$ apt list *ssh* -i
Listing... Done
libssh-gcrypt-4/stable,stable-security,now 0.10.6-0+deb12u1 amd64 [installed,automatic]
libssh2-1/stable,now 1.10.0-3+b1 amd64 [installed,automatic]
openssh-client/stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed]
openssh-server/stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed,automatic]
openssh-sftp-server/stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed,automatic]
ssh-askpass-gnome/stable-security,now 1:9.2p1-2+deb12u3 amd64 [installed]
ssh/stable-security,stable-security,now 1:9.2p1-2+deb12u3 all [installed]
sshfs/stable,now 3.7.3-1.1 amd64 [installed]

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:16 am
by kerogaz
sudo apt reinstall ssh
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
openssh-server openssh-sftp-server
Suggested packages:
molly-guard monkeysphere
The following NEW packages will be installed:
openssh-server openssh-sftp-server ssh
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 696 kB of archives.
After this operation, 2,382 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org/debian-security bookworm-security/main amd64 openssh-sftp-server amd64 1:9.2p1-2+deb12u3 [65.8 kB]
Get:2 http://security.debian.org/debian-security bookworm-security/main amd64 openssh-server amd64 1:9.2p1-2+deb12u3 [456 kB]
Get:3 http://security.debian.org/debian-security bookworm-security/main amd64 ssh all 1:9.2p1-2+deb12u3 [174 kB]
Fetched 696 kB in 0s (1,559 kB/s)
Preconfiguring packages ...
Selecting previously unselected package openssh-sftp-server.
(Reading database ... 302063 files and directories currently installed.)
Preparing to unpack .../openssh-sftp-server_1%3a9.2p1-2+deb12u3_amd64.deb ...
Unpacking openssh-sftp-server (1:9.2p1-2+deb12u3) ...
Selecting previously unselected package openssh-server.
Preparing to unpack .../openssh-server_1%3a9.2p1-2+deb12u3_amd64.deb ...
Unpacking openssh-server (1:9.2p1-2+deb12u3) ...
Selecting previously unselected package ssh.
Preparing to unpack .../ssh_1%3a9.2p1-2+deb12u3_all.deb ...
Unpacking ssh (1:9.2p1-2+deb12u3) ...
Setting up openssh-sftp-server (1:9.2p1-2+deb12u3) ...
Setting up openssh-server (1:9.2p1-2+deb12u3) ...

Creating config file /etc/ssh/sshd_config with new version
Creating SSH2 RSA key; this may take some time ...
3072 SHA256:PbXpNR1cCa7o+xyykoEjf6t6r0q3dqlBwGNBGXe5aiE root@mx (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:AzRNrWEeav/KPJHlra6lrgghwGrEhxgnbleHywTLNfE root@mx (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:bVcT1rqeOE0TkAV0OaEGtyF399il5KvMTeNBA60nA0c root@mx (ED25519)
Starting OpenBSD Secure Shell server: sshd.
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.se
rvice.
Setting up ssh (1:9.2p1-2+deb12u3) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for ufw (0.36.2-1) ...

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:17 am
by kerogaz
root@mx:/etc/ssh# service status sshd
status: unrecognized service

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:20 am
by j2mcgreg
@kerogaz
You need to post the output from the QSI utility. The Quick System Info (QSI) utility is located in MX Tools and its output is automatically formatted for use here in the forum. Run the QSI utility, click “Copy for Forum” at the bottom and then just paste it here in your thread.
Forum Rules

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:22 am
by kerogaz

Code: Select all

System:
  Kernel: 6.1.0-23-amd64 [6.1.99-1] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1.0-23-amd64 root=UUID=<filter> ro quiet splash
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
    dm: LightDM v: 1.26.0 Distro: MX-23.3_x64 Libretto May 19  2024 base: Debian GNU/Linux 12
    (bookworm)
Machine:
  Type: Desktop Mobo: TYAN model: S5502 serial: <superuser required> BIOS: American Megatrends
    v: 1.03 date: 05/02/2011
CPU:
  Info: model: Intel Xeon X3450 bits: 64 type: MT MCP arch: Nehalem level: v2 built: 2008-10
    process: Intel 45nm family: 6 model-id: 0x1E (30) stepping: 5 microcode: 0xA
  Topology: cpus: 1x cores: 4 tpc: 2 threads: 8 smt: enabled cache: L1: 256 KiB
    desc: d-4x32 KiB; i-4x32 KiB L2: 1024 KiB desc: 4x256 KiB L3: 8 MiB desc: 1x8 MiB
  Speed (MHz): avg: 2089 high: 2660 min/max: N/A cores: 1: 1250 2: 1515 3: 2660 4: 1697 5: 1612
    6: 2660 7: 2660 8: 2660 bogomips: 42560
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
  Type: mds status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data status: Unknown: No mitigations
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Retpolines; IBPB: conditional; IBRS_FW; STIBP: conditional; RSB
    filling; PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: ASPEED Graphics Family driver: ast v: kernel ports: active: VGA-1 empty: none
    bus-ID: 0a:00.0 chip-ID: 1a03:2000 class-ID: 0300
  Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.18.0 driver: X:
    loaded: modesetting unloaded: fbdev,vesa dri: swrast gpu: ast display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1152x864 s-dpi: 96 s-size: 304x228mm (11.97x8.98") s-diag: 380mm (14.96")
  Monitor-1: VGA-1 model: Acer V226HQL serial: <filter> built: 2021 res: 1152x864 hz: 75 dpi: 61
    gamma: 1.2 size: 477x268mm (18.78x10.55") diag: 547mm (21.5") ratio: 16:9 modes: max: 1152x864
    min: 640x480
  API: OpenGL v: 4.5 Mesa 22.3.6 renderer: llvmpipe (LLVM 15.0.6 128 bits) direct-render: Yes
Audio:
  Device-1: C-Media CMI8738/CMI8768 PCI Audio driver: snd_cmipci v: kernel bus-ID: 0a:01.0
    chip-ID: 13f6:0111 class-ID: 0401
  API: ALSA v: k6.1.0-23-amd64 status: kernel-api tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel 82574L Gigabit Network vendor: Tyan driver: e1000e v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: bc00 bus-ID: 07:00.0 chip-ID: 8086:10d3 class-ID: 0200
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Intel 82574L Gigabit Network vendor: Tyan driver: e1000e v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: cc00 bus-ID: 08:00.0 chip-ID: 8086:10d3 class-ID: 0200
  IF: eth1 state: down mac: <filter>
  Device-3: Intel 82574L Gigabit Network vendor: Tyan driver: e1000e v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: dc00 bus-ID: 09:00.0 chip-ID: 8086:10d3 class-ID: 0200
  IF: eth2 state: down mac: <filter>
Drives:
  Local Storage: total: 931.51 GiB used: 14.63 GiB (1.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital model: WD1003FBYX-01Y7B1 size: 931.51 GiB
    block-size: physical: 512 B logical: 512 B speed: 3.0 Gb/s type: HDD rpm: 7200 serial: <filter>
    rev: 1V02 scheme: MBR
Partition:
  ID-1: / raw-size: 931.51 GiB size: 915.81 GiB (98.31%) used: 14.63 GiB (1.6%) fs: ext4
    dev: /dev/sda1 maj-min: 8:1
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 2 GiB used: 648.1 MiB (31.6%) priority: -2 file: /swap/swap
Sensors:
  System Temperatures: cpu: 37.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Repos:
  Packages: pm: dpkg pkgs: 2131 libs: 1055 tools: apt,apt-get,aptitude,nala,synaptic pm: rpm
    pkgs: 0 pm: flatpak pkgs: 0
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://mirrors.rit.edu/mxlinux/mx-packages/mx/repo/ bookworm main non-free
  Active apt repos in: /etc/apt/sources.list.d/opera-stable.list
    1: deb https://deb.opera.com/opera-stable/ stable non-free
Info:
  Processes: 280 Uptime: 1h 50m wakeups: 1 Memory: 3.81 GiB used: 3.38 GiB (88.6%) Init: SysVinit
  v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
  Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: BIOS (legacy, CSM, MBR)

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:24 am
by DukeComposed
kerogaz wrote: Thu Jul 18, 2024 7:53 am

Code: Select all

ssh -p 11954 pal@10.44.1.1
(pal@10.44.1.1) Password for pal@celebris:
Last login: Thu Jul 18 14:52:06 2024 from 10.44.7.77
FreeBSD 14.0-RELEASE-p6 (GENERIC) #0: Tue Mar 26 20:26:20 UTC 2024

Welcome to FreeBSD!
You see ssh works fine, but I can’t restart it
I see you misunderstand how SSH works.

SSH is a protocol. That's just a way of passing packets back and forth between two endpoints. This involves a client, which you have, and server, which you do not have. (The FreeBSD box is running sshd, though.)

You're asking the equivalent question of "I can connect to web servers, therefore I must be running Apache."

An sshd service is exclusively for when you want other people to be able to connect to you.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:57 am
by Adrian

Code: Select all

sudo apt install openssh-server
(you probably have only openssh-client installed).

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 3:07 pm
by Charlie Brown
kerogaz wrote: Thu Jul 18, 2024 8:16 am...
The following NEW packages will be installed:
openssh-server openssh-sftp-server ssh
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
...
Preparing to unpack .../openssh-server_1%3a9.2p1-2+deb12u3_amd64.deb ...
Unpacking openssh-server (1:9.2p1-2+deb12u3) ...
...
Setting up openssh-server (1:9.2p1-2+deb12u3) ...

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 3:10 pm
by Charlie Brown
kerogaz wrote: Thu Jul 18, 2024 8:17 am root@mx:/etc/ssh# service status sshd
status: unrecognized service

Code: Select all

$ service ssh status
sshd is running.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 4:30 pm
by kerogaz
service ssh restart
ssh: unrecognized service

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 4:34 pm
by kerogaz
Dear DukeComposed, don't pretend that you are the smartest, ssh is protocol and sshd is daemon of protocol ssh .....A daemon is a program that runs in the background (without a terminal or user interface), waiting for events and offering some services to carry them out. A good example of a daemon would be a web server waiting for a request to deliver a page, or an SSH server waiting for someone's login.
See better this:
service ssh restart
ssh: unrecognized service
And:

apt list ssh* -i

Listing... Error!
E: input:0-10: error: Expected pattern
ssh_config
^^^^^^^^^^
But ssh works !!!

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 5:01 pm
by Adrian
Adrian wrote: Thu Jul 18, 2024 8:57 am

Code: Select all

sudo apt install openssh-server
(you probably have only openssh-client installed).
Did you do this?

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 5:06 pm
by kerogaz
It’s strange that the ssh restarts here after changing the sshd config. For example, in FreeBSD and Archlinux, I restart the service sshd after changing the /etc/ssh/sshd_config.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 5:23 pm
by siamhie
kerogaz wrote: Thu Jul 18, 2024 5:06 pm It’s strange that the ssh restarts here after changing the sshd config. For example, in FreeBSD and Archlinux, I restart the service sshd after changing the sshd config.

MX Linux doesn't come with the server installed by default. Have you installed it like Adrian asked in post #26?

ssh-server.jpg

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 5:26 pm
by FullScale4Me
First off

Code: Select all

Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
    dm: LightDM v: 1.26.0 Distro: MX-23.3_ahs_x64 Libretto July 31  2023 base: Debian GNU/Linux 12
    (bookworm)
Info:
  Init: SysVinit v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0
  alt: 12 Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: UEFI
I did NOT have the SSH daemon installed so I went to MX Package Installer and selected "SSH Conduit" which completed without error.

Code: Select all

$ sudo service ssh status
[sudo] password for mike:         
sshd is running.
Next, I went to the Uncomplicated Firewall GUI and added an exception rule for SSH.

As a final step, I went to another PC and successfully connected. Nothing additional was installed.

Code: Select all

mike@dell-lt:~
$ ssh 10.0.0.33
The authenticity of host '10.0.0.33 (10.0.0.33)' can't be established.
ED25519 key fingerprint is redacted.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.0.0.33' (ED25519) to the list of known hosts.
mike@10.0.0.33's password: 
Linux OptiPlex7050 6.6.12-1-liquorix-amd64 #1 ZEN SMP PREEMPT liquorix 6.6-16~mx23ahs (2024-01-18) x86_64
[snip]
You have no mail.
mike@OptiPlex7050:~
Works for me!
kerogaz wrote:Dear DukeComposed, don't pretend that you are the smartest, ssh is protocol and sshd is daemon of protocol ssh .....A daemon is a program that runs in the background (without a terminal or user interface), waiting for events and offering some services to carry them out. A good example of a daemon would be a web server waiting for a request to deliver a page, or an SSH server waiting for someone's login.
Really? Do better, especially when asking for help!

Edit: added both PC identities back to SSH session capture that were snipped in error.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 5:31 pm
by FullScale4Me
kerogaz wrote: Thu Jul 18, 2024 4:34 pm apt list ssh* -i

Listing... Error!
E: input:0-10: error: Expected pattern
Try ssh-conduit-antix (from MX Package Installer info of "SSH Conduit")

Code: Select all

mike@OptiPlex7050:~
$ apt list ssh-conduit-antix -i
Listing... Done
ssh-conduit-antix/now 1.1.4 all [installed,local]

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 6:27 pm
by atomick
MX and most *Nix have an ssh-client installed. So there will be an /etc/ssh/ssh_config file present no keys no moduli and possibly per since 8.6p1 "L-ago ver". ssh developers added ssh_config.d sub dir and for sshd server added sshd_config.d sub dir also contained in /etc/ssh directory where by additional too main configs, can go. Perms I use 444 for ssh_config and 400 for sshd_config.. See in your post you did run the sudo apt install openssh-server. When this installs it will generate ssh_host_type_keys/pub for server private and public keys. Also will install a start script into /etc/init.d/ "ssh" along with /etc/default/ "ssh" I added a space after the slash to view an see.
restarting ssh is the daemon as 4scale4me shared. One other importance is when installing the Server per info here and your post. MX or any install of this app service enters start up scripts into the approp /etc/rcx.d standards directories.
who -r will show the run level. All start up scripts are in /etc/init.d and to set them square to rebootable support it will be done for you. Or you can fully verify by doing cd /etc/init.d ; sudo update-rc.d -f ssh defaults / spaced syntax.
So back to the 2 files both named ssh ; here just described is the actual sshd daemon start script , more ssh and see the top construct ! these show parms to what run level all get the ssh start script to be entered by its call selector S03ssh@ meaning linked to the /etc/init.d/ssh script in all startup dirs along with a K03ssh to shut down. /etc/default/ssh only has one line for SSH_OPTS= normally left blank. -D prevents sshd from forking dona worry. All under the hood.
Restarting or stats. consider getting back to like old Dos days "Cmdline" there is xfce-terminal shell app in the "Starter" konsole is a very nice need to install, other terminal shells are avail between xfce and konsole I use addictively. Tmux is quite cool for a sysAdmin dude he'd like such to learn this feature of a shell. (was, retired, found after its cool ). open a terminal sudo /etc/init.d/ssh status / restart / stop / start can all be entered one cmdline a time. sudo /etc/init.d/ssh/restart for your request. chg restart
to other or tail -6 /etc/init.d/ssh and see the sshd cmdline by ssh script usage. : tip : might consider sudo chmod 444 /etc/ssh/ssh_config ; sudo chmod 400 /etc/ssh/sshd_config // for running after you find to chng what options for sshd to be operated.
Keyless login is a very nice feature. Yet to work right the perms 444 for the ssh_config client is best. Last tip when you gen user or host keys consider chmod to "Read Only" No idea why any key or option feature would be actually write-able whilst running. prone to new hacks. and think some like ABC are using their secret black chassis AI bad boy to exploit SSH as they did back in 'heartbleed" hack. its still safe and smart. even docked or virtual guests. secure encrypted protocol

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 7:36 pm
by Charlie Brown
Adrian wrote: Thu Jul 18, 2024 5:01 pm
Adrian wrote: Thu Jul 18, 2024 8:57 am

Code: Select all

sudo apt install openssh-server
(you probably have only openssh-client installed).
Did you do this?
siamhie wrote: Thu Jul 18, 2024 5:23 pm
kerogaz wrote: Thu Jul 18, 2024 5:06 pm It’s strange that the ssh restarts here after changing the sshd config. For example, in FreeBSD and Archlinux, I restart the service sshd after changing the sshd config.

MX Linux doesn't come with the server installed by default. Have you installed it like Adrian asked in post #26?

ssh-server.jpg
viewtopic.php?p=783698&sid=58be00c43448 ... 3e#p783698


(Cause he (re)installed ssh ):

Code: Select all

Description: secure shell client and server (metapackage)
 This metapackage is a convenient way to install both the OpenSSH client and the OpenSSH server.

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 8:45 pm
by siamhie
Charlie Brown wrote: Thu Jul 18, 2024 7:36 pm
(Cause he (re)installed ssh ):

Code: Select all

Description: secure shell client and server (metapackage)
 This metapackage is a convenient way to install both the OpenSSH client and the OpenSSH server.

OK, I went back through the thread and saw this (wasn't in code tags)

Code: Select all

The following additional packages will be installed:
openssh-server openssh-sftp-server
Suggested packages:
molly-guard monkeysphere
The following NEW packages will be installed:
openssh-server openssh-sftp-server ssh
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.

Code: Select all

Creating config file /etc/ssh/sshd_config with new version
Creating SSH2 RSA key; this may take some time ...
3072 SHA256:PbXpNR1cCa7o+xyykoEjf6t6r0q3dqlBwGNBGXe5aiE root@mx (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:AzRNrWEeav/KPJHlra6lrgghwGrEhxgnbleHywTLNfE root@mx (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:bVcT1rqeOE0TkAV0OaEGtyF399il5KvMTeNBA60nA0c root@mx (ED25519)
Starting OpenBSD Secure Shell server: sshd.
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.se
rvice.
Setting up ssh (1:9.2p1-2+deb12u3) ...
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for ufw (0.36.2-1) ...

They are booted to sys-v and not systemd. Does that make a difference? (I don't have an ssh server installed)

Code: Select all

Info:
Processes: 280 Uptime: 1h 50m wakeups: 1 Memory: 3.81 GiB used: 3.38 GiB (88.6%) Init: SysVinit

Re: I cant restart sshd

Posted: Thu Jul 18, 2024 11:38 pm
by DukeComposed
kerogaz wrote: Thu Jul 18, 2024 4:34 pm Dear DukeComposed, don't pretend that you are the smartest, ssh is protocol and sshd is daemon of protocol ssh .....A daemon is a program that runs in the background (without a terminal or user interface), waiting for events and offering some services to carry them out. A good example of a daemon would be a web server waiting for a request to deliver a page, or an SSH server waiting for someone's login.

But ssh works !!!
I fail to see how anything I said contradicts the idea of running a daemon. Anyway, you're mistaking /usr/bin/ssh, the binary client, for an SSH service, which you don't need to run in order to be able to connect to a different host over SSH. I don't need to install Apache on my machine to connect to google.com. I don't need to install a BIND server in order to do DNS lookups. And I don't need to install sshd in order to be able to connect to another machine over SSH. Best of luck to you on figuring out how to restart a service you aren't running.

Re: I cant restart sshd

Posted: Fri Jul 19, 2024 12:39 am
by figueroa
If the ssh server isn't running, you can't restart it. You can only start. Use the command:

Code: Select all

sudo service ssh start
or

Code: Select all

sudo /etc/init.d/ssh start
Look at the files in /etc/init.d; these are the files that start various services.

An alternate way to determine if the ssh server is running is to use:

Code: Select all

ps ax | grep ssh

Re: I cant restart sshd

Posted: Fri Jul 19, 2024 1:03 am
by kerogaz
grep " install " /var/log/dpkg.log
2024-07-18 15:14:03 install openssh-server:amd64 <none> 1:9.2p1-2+deb12u3

Re: I cant restart sshd

Posted: Fri Jul 19, 2024 1:05 am
by kerogaz
sudo service ssh start
[sudo] password for pal:
Starting OpenBSD Secure Shell server: sshd.
pal@mx:~
$ sudo service ssh status
sshd is running.
pal@mx:~
$ sudo service ssh restart
Restarting OpenBSD Secure Shell server: sshd.

Re: I cant restart sshd

Posted: Fri Jul 19, 2024 1:57 am
by kerogaz
I don’t understand why there is such complexity: restart ssh so that sshd can restart? I have never seen this in any other Linux. Everywhere to restart sshd I restart sshd