linux ssh连接

前言

整理以前的随笔。

正文

首先更新源  
sudo apt-get update

安装ssh服务

sudo apt-get install openssh-server

检测是否已启动

ps -e | grep ssh

看到有ssh字样,说明已启动,如果没有就手动启动

/etc/init.d/ssh start

配置ssh-server,配置文件位于/etc/ssh/sshd_config,默认端口为22,为了安全,一般自定义为其他端口,然后重启

sudo /etc/init.d/ssh resart

生成密钥对 ssh-keygen -t rsa 保存

在用户目录下的 .ssh 将公钥保存成authorized_keys

如果使用putty:

使用putty-gen将私钥变成putty格式

只允许秘钥连接

在/etc/ssh/sshd_config的PasswordAuthentication设置成no

原文地址:https://www.cnblogs.com/aoximin/p/13037728.html