Jetson Orin (Ubuntu20.04) feedback that SSH can successfully remotely access other devices, but other devices cannot log in to the local device

Hardware device, Jetson Orin device

Jetpack version 5.0.2

This kind of problem is generally the permission problem of this machine, look at the configuration of your machine

Test to log in to the local machine ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused Connection is currently prohibited.

You can log in normally. As shown below:

 

 The next operation is to fix the problem that jetson cannot log in with ssh.

 sudo apt-get install openssh-server openssh-client

sudo apt-get install ufw

sudo ufw enable 

 At this time, I didn't think of downloading iptables directly

 

The picture above is groping, and the following is the correct way to download.

 

 Continue to check the status of port 22

sudo ufw allow 22  

lsof -i:22

sudo netstat -nltp | catch 22

So far, only the problem of using the firewall has been solved. Continue to test whether you can log in. As follows, the red error reporting part was found.

The following is the status of the correct port 22

sshd -T

提示sshd: no hostkeys available – exiting.

 And did the following operations.

 ubuntu下sshd: no hostkeys available -- exiting.

use today

/usr/sbin/sshd

The code wants to start ssh, but the result keeps reporting errors, keeps reporting errors, and looks for various methods to no avail. Later, I found the installation tutorial and found that people used

ssh-keygen -t rsa

Tried it, started it directly. If you search for this question, see if this is also the case.

systemctl stop ssh.service    //关闭由systemctl控制的ssh启动

rm /lib/systemd/system/ssh.service      //删除ssh的服务配置文件

systemctl daemon-reload         //重载systemctl服务

systemctl start ssh.service //重启服务

 It still doesn't work, please try again.

 The following operation has nothing to do with my mistake, so record it.

 According to my friend’s method, I finally forgot where to read it. Just enter sudo dpkg-reconfigure openssh-server. However, I still haven’t solved my mistake, but I still have to record it. Don’t scold me when you see this. is a memory.

With a turn of the brain circuit, he hit the protective wall again, and it was really the rhythm of hitting the south wall.

 It is found that it can accept No. 22 when it is turned on. If it does not work, turn off the protective wall and accept it, and then try.

 

 I finally opened port 22, added ubuntu22.04 to solve ssh login, but could not find a matching host key algorithm, and added the following two lines

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

sudo vim /etc/ssh/ sshd_config  This is a configuration file opened by others,

I typed one less letter and added it to sudo vi /etc/ssh/ssh_config, and opened the comment No. 22, but it can also be used haha

 sudo systemctl restart sshd 

At this point, you can log in. Sure enough, driving without a license has taken a detour. Welcome to give advice!

The following is the history of terminal operation commands in the whole process of system problems that cannot be logged in through SSH. Generally, you can install it once according to the above process.

nvidia@tegra-ubuntu:~/Desktop$ sudo apt-get install ip6tables-persistent
[sudo] password for nvidia: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package ip6tables-persistent
nvidia@tegra-ubuntu:~/Desktop$ sudo apt-get install iptables-persistent
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  netfilter-persistent
The following NEW packages will be installed:
  iptables-persistent netfilter-persistent
0 upgraded, 2 newly installed, 0 to remove and 324 not upgraded.
Need to get 13.8 kB of archives.
After this operation, 89.1 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 netfilter-persistent all 1.0.14ubuntu1 [7,268 B]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 iptables-persistent all 1.0.14ubuntu1 [6,552 B]
Fetched 13.8 kB in 1s (16.6 kB/s)              
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package netfilter-persistent.
dpkg: warning: files list file for package 'openssh-server' missing; assuming package has no files currently installed
(Reading database ... 147380 files and directories currently installed.)
Preparing to unpack .../netfilter-persistent_1.0.14ubuntu1_all.deb ...
Unpacking netfilter-persistent (1.0.14ubuntu1) ...
Selecting previously unselected package iptables-persistent.
Preparing to unpack .../iptables-persistent_1.0.14ubuntu1_all.deb ...
Unpacking iptables-persistent (1.0.14ubuntu1) ...
Setting up netfilter-persistent (1.0.14ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/netfilter-persistent.service → /lib/systemd/system/netfilter-persistent.service.
Setting up iptables-persistent (1.0.14ubuntu1) ...
update-alternatives: using /lib/systemd/system/netfilter-persistent.service to provide /lib/systemd/system/iptables.service (iptables.service) in auto mode
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
nvidia@tegra-ubuntu:~/Desktop$ sudo netstat -nltp | grep 22
nvidia@tegra-ubuntu:~/Desktop$ sudo apt-get install ufw
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ufw is already the newest version (0.36-6ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 324 not upgraded.
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw enable
Firewall is active and enabled on system startup
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw allow 22
Skipping adding existing rule
Skipping adding existing rule (v6)
nvidia@tegra-ubuntu:~/Desktop$ 

sudo apt-get install iptables-persistent
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  netfilter-persistent
The following NEW packages will be installed:
  iptables-persistent netfilter-persistent
0 upgraded, 2 newly installed, 0 to remove and 324 not upgraded.
Need to get 13.8 kB of archives.
After this operation, 89.1 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 netfilter-persistent all 1.0.14ubuntu1 [7,268 B]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 iptables-persistent all 1.0.14ubuntu1 [6,552 B]
Fetched 13.8 kB in 1s (16.6 kB/s)              
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package netfilter-persistent.
dpkg: warning: files list file for package 'openssh-server' missing; assuming package has no files currently installed
(Reading database ... 147380 files and directories currently installed.)
Preparing to unpack .../netfilter-persistent_1.0.14ubuntu1_all.deb ...
Unpacking netfilter-persistent (1.0.14ubuntu1) ...
Selecting previously unselected package iptables-persistent.
Preparing to unpack .../iptables-persistent_1.0.14ubuntu1_all.deb ...
Unpacking iptables-persistent (1.0.14ubuntu1) ...
Setting up netfilter-persistent (1.0.14ubuntu1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/netfilter-persistent.service → /lib/systemd/system/netfilter-persistent.service.
Setting up iptables-persistent (1.0.14ubuntu1) ...
update-alternatives: using /lib/systemd/system/netfilter-persistent.service to provide /lib/systemd/system/iptables.service (iptables.service) in auto mode
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.17) ...
nvidia@tegra-ubuntu:~/Desktop$ sudo netstat -nltp | grep 22
nvidia@tegra-ubuntu:~/Desktop$ sudo apt-get install ufw
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ufw is already the newest version (0.36-6ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 324 not upgraded.
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw enable
Firewall is active and enabled on system startup
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw allow 22
Skipping adding existing rule
Skipping adding existing rule (v6)
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ service sshd restart
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.
nvidia@tegra-ubuntu:~/Desktop$ sudo service sshd restart
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service 
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-04-04 09:30:00 UTC; 19s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 4358 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=1/FAILURE)

Apr 04 09:30:00 tegra-ubuntu systemd[1]: ssh.service: Scheduled restart job, restart counter is at 5.
Apr 04 09:30:00 tegra-ubuntu systemd[1]: Stopped OpenBSD Secure Shell server.
Apr 04 09:30:00 tegra-ubuntu systemd[1]: ssh.service: Start request repeated too quickly.
Apr 04 09:30:00 tegra-ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Apr 04 09:30:00 tegra-ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
Apr 04 09:30:07 tegra-ubuntu systemd[1]: ssh.service: Start request repeated too quickly.
Apr 04 09:30:07 tegra-ubuntu systemd[1]: ssh.service: Failed with result 'exit-code'.
Apr 04 09:30:07 tegra-ubuntu systemd[1]: Failed to start OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ sudo vi /etc/ssh/ssh_config
nvidia@tegra-ubuntu:~/Desktop$ sshd -T
sshd: no hostkeys available -- exiting.
nvidia@tegra-ubuntu:~/Desktop$ systemctl stop ssh.service
nvidia@tegra-ubuntu:~/Desktop$ sudo rm /lib/systemd/system/ssh.service 
nvidia@tegra-ubuntu:~/Desktop$ systemctl daemon-reload 
nvidia@tegra-ubuntu:~/Desktop$ systemctl start ssh.socket 
nvidia@tegra-ubuntu:~/Desktop$ systemctl start ssh.service
nvidia@tegra-ubuntu:~/Desktop$ ls
gnome-terminal.desktop  nv_forums.desktop           nv_jetson_zoo.desktop
nv_devzone.desktop      nv_jetson_projects.desktop  nv_l4t_readme.desktop
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.serviceFailed to start ssh.service: Connection timed out
See system logs and 'systemctl status ssh.service' for details.
 failed!
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 2h 58min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ ssh-keygen -A
ssh-keygen: generating new host keys: RSA Could not save your public key in /etc/ssh/ssh_host_rsa_key.K1nvHGTwzM: Permission denied
ssh-keygen: generating new host keys: DSA Could not save your public key in /etc/ssh/ssh_host_dsa_key.ozu0XOi5Bt: Permission denied
ssh-keygen: generating new host keys: ECDSA Could not save your public key in /etc/ssh/ssh_host_ecdsa_key.gTMnQdFSb8: Permission denied
ssh-keygen: generating new host keys: ED25519 Could not save your public key in /etc/ssh/ssh_host_ed25519_key.33AuhJCeht: Permission denied
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh-keygen -A
[sudo] password for nvidia: 
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 2h 59min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ service ssh status
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 2min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh-keygen -A
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
nvidia@tegra-ubuntu:~/Desktop$ service ssh status
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 3min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:DaBMEybUCJchmu7cAK8xXOyKJNBN/mBTthQzzMmTjy4 root@tegra-ubuntu
The key's randomart image is:
+---[RSA 3072]----+
|oo==*=O+         |
|.=+O.*B=         |
|= .oO .+.        |
|=.o. +. .o       |
|+=.. .. S .      |
|*++ E .          |
|o+ . .           |
|                 |
|                 |
+----[SHA256]-----+
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
nvidia@tegra-ubuntu:~/Desktop$ service ssh status
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 4min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 5min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh-keygen -A
nvidia@tegra-ubuntu:~/Desktop$ sudo systemctl start sshd
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 7min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ sudo dpkg-reconfigure openssh-server
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 15min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 15min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
nvidia@tegra-ubuntu:~/Desktop$ ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ ssh localhost
ssh: connect to host localhost port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh [email protected]
[sudo] password for nvidia: 
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ sudo netstat -nltp | grep 22
nvidia@tegra-ubuntu:~/Desktop$ service ssh status
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 32min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw status 
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere                  
22 (v6)                    ALLOW       Anywhere (v6)             

nvidia@tegra-ubuntu:~/Desktop$ sudo ufw disable
Firewall stopped and disabled on system startup
nvidia@tegra-ubuntu:~/Desktop$ service ssh status
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (exited) since Tue 2023-04-04 09:35:36 UTC; 3h 34min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 4562 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)

Apr 04 09:35:36 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 09:35:36 tegra-ubuntu ssh[4571]: sshd: no hostkeys available -- exiting.
Apr 04 09:35:36 tegra-ubuntu ssh[4562]:    ...fail!
Apr 04 09:35:36 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
nvidia@tegra-ubuntu:~/Desktop$ sudo netstat -nltp | grep 22
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw status 
Status: inactive
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ ufw allow 22
ERROR: You need to be root to run this script
nvidia@tegra-ubuntu:~/Desktop$ sudo ufw allow 22
Skipping adding existing rule
Skipping adding existing rule (v6)
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
nvidia@tegra-ubuntu:~/Desktop$ sudo apt-get install openbsd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openbsd
nvidia@tegra-ubuntu:~/Desktop$ sudo vi /etc/ssh/ssh_config
nvidia@tegra-ubuntu:~/Desktop$ sudo systemctl restart sshd
nvidia@tegra-ubuntu:~/Desktop$ /etc/init.d/ssh start
Starting ssh (via systemctl): ssh.service.
nvidia@tegra-ubuntu:~/Desktop$ sudo ssh [email protected]
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:CCkCNwrmM/0rdsB6SeMRAX+5VjJNN0KmWTwkr2DzbuI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
[email protected]'s password: 
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.10.104-tegra aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

311 updates can be applied immediately.
229 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

Last login: Tue Apr  4 07:35:48 2023
nvidia@tegra-ubuntu:~$ exit
logout
Connection to 127.0.0.1 closed.
nvidia@tegra-ubuntu:~/Desktop$ systemctl status ssh.service
● ssh.service - LSB: OpenBSD Secure Shell server
     Loaded: loaded (/etc/init.d/ssh; generated)
     Active: active (running) since Tue 2023-04-04 13:19:58 UTC; 2min 23s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 5284 ExecStart=/etc/init.d/ssh start (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 36322)
     Memory: 1.0M
     CGroup: /system.slice/ssh.service
             └─5292 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups

Apr 04 13:19:58 tegra-ubuntu systemd[1]: Starting LSB: OpenBSD Secure Shell server...
Apr 04 13:19:58 tegra-ubuntu ssh[5284]:  * Starting OpenBSD Secure Shell server sshd
Apr 04 13:19:58 tegra-ubuntu ssh[5284]:    ...done.
Apr 04 13:19:58 tegra-ubuntu sshd[5292]: Server listening on 0.0.0.0 port 22.
Apr 04 13:19:58 tegra-ubuntu sshd[5292]: Server listening on :: port 22.
Apr 04 13:19:58 tegra-ubuntu systemd[1]: Started LSB: OpenBSD Secure Shell server.
Apr 04 13:20:19 tegra-ubuntu sshd[5318]: Accepted password for nvidia from 127.0.0.1 port 50654 ssh2
Apr 04 13:20:19 tegra-ubuntu sshd[5318]: pam_unix(sshd:session):

Guess you like

Origin blog.csdn.net/weixin_46151178/article/details/129956857