美文网首页
配置 ssh

配置 ssh

作者: daifee | 来源:发表于2017-05-06 23:59 被阅读0次

ssh程序包含客户端服务端两个程序

客户端

配置文件:

  • /etc/ssh/ssh_config 全局配置
  • ~/.ssh/config 用户配置

我的配置

# 定义别名连接服务端 `server-1`
Host server-1  # 别名
  HostName 127.0.0.1  # 服务端IP或域名
  User root  # 远程主机用户名
  Port 22  # 服务端端口(默认值)
  IdentityFile ~/.ssh/id_rsa  # 客户端私钥(默认值)

# 定义别名连接服务端 `server-2`
Host server-2  # 别名
  HostName 8.8.8.8  # 服务端IP或域名
  User root  # 远程主机用户名
  Port 22  # 服务端端口(默认值)
  IdentityFile ~/.ssh/id_rsa  # 客户端私钥(默认值)

服务端

配置文件:

  • /etc/ssh/sshd_config 全局配置

我的配置

Port 8022  # sshd进程端口
PasswordAuthentication no  # 不允许密码登录
PermitEmptyPasswords no  # 不允许空密码

相关文章

网友评论

      本文标题:配置 ssh

      本文链接:https://www.haomeiwen.com/subject/pcuctxtx.html