raspberry--SSH远程登陆The remote system refused the connection.

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/caigen0001/article/details/100998040

如何解决第一次登陆SSH里面的The remote system refused the connection.

raspberry缺省安装了openssh-server所以在这里就不安装了,如果你的系统没有安装的话,再用apt-get安装上即可。

sudo apt install openssh-server

确认openssh-server是否启动:

pi@pi:~ $ ps -e | grep ssh
  574 ?        00:00:00 ssh-agent
  618 ?        00:00:00 ssh-agent

 如果只有ssh-agent,说明openssh-server没有启动。

启动:

pi@pi:~ $ sudo /etc/init.d/ssh start
[ ok ] Starting ssh (via systemctl): ssh.service.

再次查看openssh-server是否启动:

扫描二维码关注公众号,回复: 7614753 查看本文章
pi@pi:~ $ ps -e | grep ssh
  484 ?        00:00:00 sshd
  574 ?        00:00:00 ssh-agent
  618 ?        00:00:00 ssh-agent

出现sshd即说明openssh-server已经启动。

特别注意,一定要设置开机自启动openssh-server:

Ubuntu中配置openssh-server开机自动启动:

打开/etc/rc.local文件,在exit 0语句前加入:

    sudo /etc/init.d/ssh start

再次开机,即可完成开机自启动的效果!

pi@pi:~ $ sudo vim /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
sudo /etc/init.d/ssh start

exit 0

猜你喜欢

转载自blog.csdn.net/caigen0001/article/details/100998040
今日推荐