使用远程工具连接Linux系统

12 篇文章 0 订阅
8 篇文章 0 订阅
使用远程工具secureCRT (版本:Version 7.0.0 (x64 build 326) ) 连接Linux系统

1、检查Linux是否安装了ssh-server

输入命令

sudo dpkg -l | grep ssh

打印返回

ii  libssh-4:amd64     0.9.3-2ubuntu2.3     amd64       tiny C SSH library (OpenSSL flavor)
ii  openssh-client     1:8.2p1-4ubuntu0.9   amd64       secure shell (SSH) client, for secure access to remote machines

2、若不包含ssh-server,就安装

sudo apt-get -y install openssh-server

3、发生报错?

问题重现:打开ssh连接工具发生以下报错

Key exchange failed.
No compatible key exchange method. The server supports these methods: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256
报错说:
密钥交换失败。没有兼容的密钥交换方法。列举以下的方法
那就来添加交换密钥的方法

解决方法

vim /etc/ssh/sshd_config

在尾行输入以下内容

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

然后Esc键,输入:wq保存退出,输入以下命令,重启ssh服务

systemctl restart sshd.service

service ssh restart

4、查看ssh服务

4.1 进程信息

输入命令

sudo dpkg -l | grep ssh

打印返回

ii  libssh-4:amd64              0.9.3-2ubuntu2.3             amd64        tiny C SSH library (OpenSSL flavor)
ii  openssh-client              1:8.2p1-4ubuntu0.9           amd64        secure shell (SSH) client, for secure access to remote machines
ii  openssh-server              1:8.2p1-4ubuntu0.9           amd64        secure shell (SSH) server, for secure access from remote machines
ii  openssh-sftp-server         1:8.2p1-4ubuntu0.9           amd64        secure shell (SSH) sftp server module, for SFTP access from remote machines
ii  ssh-import-id               5.10-0ubuntu1                all          securely retrieve an SSH public key and install it locally

4.2 服务状态

输入命令

systemctl status sshd

service sshd status

打印返回(成功了!)

● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-11-26 16:56:39 PST; 17s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 56894 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 56895 (sshd)
      Tasks: 1 (limit: 4566)
     Memory: 1.0M
     CGroup: /system.slice/ssh.service
             └─56895 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Nov 26 16:56:39 vac-virtual-machine systemd[1]: Starting OpenBSD Secure Shell server...
Nov 26 16:56:39 vac-virtual-machine sshd[56895]: Server listening on 0.0.0.0 port 22.
Nov 26 16:56:39 vac-virtual-machine sshd[56895]: Server listening on :: port 22.
Nov 26 16:56:39 vac-virtual-machine systemd[1]: Started OpenBSD Secure Shell server.
root用户登录拒绝,参考 🔗使用远程工具连接Linux系统——使用Root用户登录
  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值