I cant restart sshd

Message
Author
atomick

Re: I cant restart sshd

#31 Post 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

Charlie Brown

Re: I cant restart sshd

#32 Post 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.

User avatar
siamhie
Global Moderator
Posts: 3852
Joined: Fri Aug 20, 2021 5:45 pm

Re: I cant restart sshd

#33 Post 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
This is my Fluxbox . There are many others like it, but this one is mine. My Fluxbox is my best friend. It is my life.
I must master it as I must master my life. Without me, my Fluxbox is useless. Without my Fluxbox, I am useless.

User avatar
DukeComposed
Posts: 1516
Joined: Thu Mar 16, 2023 1:57 pm

Re: I cant restart sshd

#34 Post 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.

User avatar
figueroa
Posts: 1106
Joined: Thu Dec 20, 2018 11:20 pm

Re: I cant restart sshd

#35 Post 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
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

User avatar
kerogaz
Posts: 94
Joined: Thu Dec 09, 2021 5:08 am

Re: I cant restart sshd

#36 Post by kerogaz »

grep " install " /var/log/dpkg.log
2024-07-18 15:14:03 install openssh-server:amd64 <none> 1:9.2p1-2+deb12u3

User avatar
kerogaz
Posts: 94
Joined: Thu Dec 09, 2021 5:08 am

Re: I cant restart sshd

#37 Post 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.

User avatar
kerogaz
Posts: 94
Joined: Thu Dec 09, 2021 5:08 am

Re: I cant restart sshd

#38 Post 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

Post Reply

Return to “XFCE Desktop Environment”