首页 > 其他 > 详细

树莓派安装SSH

时间:2019-06-27 12:36:58      阅读:181      评论:0      收藏:0      [点我收藏+]

1. 安装ssh

 sudo apt-get install openssh-server 

2. 检查树莓派SSH服务是否开启

 ps -e|grep ssh 

3. SSH服务开启

 sudo /etc/init.d/ssh start 

4. 在树莓派终端输入(临时的,重启失效):

sudo service ssh start
sudo service ssh status

如果ssh运行会打印如下类似信息:

ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-06-17 17:17:04 CST; 20h ago
  Process: 403 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 439 (sshd)
   CGroup: /system.slice/ssh.service
           └─439 /usr/sbin/sshd -D

Jun 18 13:37:50 raspberrypi sshd[21733]: Accepted password for pi from 192.168.169.151 port 2805 ssh2
Jun 18 13:37:50 raspberrypi sshd[21733]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Jun 18 14:09:45 raspberrypi sshd[30043]: Accepted password for pi from 192.168.169.151 port 10399 ssh2
Jun 18 14:09:45 raspberrypi sshd[30043]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Jun 18 14:13:16 raspberrypi sshd[31028]: Accepted password for pi from 192.168.169.203 port 52093 ssh2
Jun 18 14:13:16 raspberrypi sshd[31028]: pam_unix(sshd:session): session opened for user pi by (uid=0)
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

5. 树莓派SSH服务开机自动启动

在终端命令行中启动SSH服务后,如果系统重启或关机后启动,SSH服务默认是关闭的,依然需要手动启动,为了方便可以设置SSH服务开机自动启动,打开 /etc/rc.local 文件,在语句 exit 0 之前加入:

 /etc/init.d/ssh start 

6.其他方式开启SSH

  1. 通过 sudo raspi-config 通过可视化界面开启SSH.
  2. 在SD开根目录创建SSH文件,开启SSH.

树莓派安装SSH

原文:https://www.cnblogs.com/Java-Script/p/11096042.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!