Jetson Orin(Ubuntu20.04)反馈SSH远程别的设备可以成功,别的设备无法登录本机设备

硬件设备,Jetson Orin设备

Jetpack 版本5.0.2

这样的问题一般都是本机的权限问题,看下你本机的配置

测一下登录本机ssh [email protected]
ssh: connect to host 127.0.0.1 port 22: Connection refused目前是禁止连接的。

正常是可以登录的。如下图:

 

 接下来的操作都是在修复jetson无法ssh登录的问题。

 sudo apt-get install openssh-server openssh-client

sudo apt-get install ufw

sudo ufw enable 

 这个时候还没想到直接下载iptables

 

如上图是在摸索,下面是正确的下载方式。

 

 继续查看22号端口的状态

sudo ufw allow 22  

lsof -i:22

sudo netstat -nltp | grep 22

到此只是解决了防火墙的使用问题。继续测试能否登录。如下,发现了红色报错部分。

下面是正确22号端口的状态

sshd -T

提示sshd: no hostkeys available – exiting.

 又做了如下操作。

 ubuntu下sshd: no hostkeys available -- exiting.

今天使用

/usr/sbin/sshd

代码想启动ssh,结果一直报错,一直报错,找寻各种方法无果。后来找安装教程,发现人用的是

ssh-keygen -t rsa

试了下,直接启动。如果你搜到这个问题,看看是不是也是这个情况。

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

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

systemctl daemon-reload         //重载systemctl服务

systemctl start ssh.service //重启服务

 到此还是无法正常使用,接着试吧。

 如下这个操作其实和我的错误没有关系,记录一下。

 按照朋友的方法最后忘了在哪看的,输入sudo dpkg-reconfigure openssh-server就可以了,然而对我的错误还是没有解决,不过还是要记录一下,看到这你别骂我,多记录总归是个回忆。

脑回路一转又撞到了防护墙,真实要撞南墙的节奏。

 发现开着也接受22号,不行就关了防护墙接受把,接着试试。

 

 我最后打开了22号端口,添加ubuntu22.04解决ssh登录,找不到匹配的host key算法,添加如下两行内容

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

sudo vim /etc/ssh/sshd_config 这是别人打开的配置文件,

我少打了一个字母添加到了sudo vi /etc/ssh/ssh_config,打开了22号注释,不过也能用了哈哈

 sudo systemctl restart sshd 

到此,可以登录了,果然无证驾驶又出了绕了弯路,欢迎大佬指点!

如下是系统问题无法SSH登录全过程终端操作命令历史记录,一般按照上面的过程安装一遍即可。

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):

猜你喜欢

转载自blog.csdn.net/weixin_46151178/article/details/129956857