sshd 的配置

删除秘钥文件

rm /etc/ssh/sshd_host*

重启服务

/etc/init.d/sshd restart

查看新建的公钥和私钥

Date ll /etc/ssh/ssh_host*

启动ssh服务

/etc/init.d/sshd restart

查看ssh有没有启动

Netstat -tlup | grep ssh

远程连接至服务器

ssh ip地址 / 主机名

321

Sshd 详细配置

Vim /etc/ssh/ssh/sshd_config

#Port 22   开启端口

#port 443   开启端口

#port

#AddressFamily any

#ListenAddress 0.0.0.0  监听所有sshd

#ListenAddress ::

 

 

Protocol 2   使用ssh版本为:version 2

主机所使用的私钥

# HostKey for protocol version 1

#HostKey /etc/ssh/ssh_host_key

# HostKeys for protocol version 2

#HostKey /etc/ssh/ssh_host_rsa_key   version rsa 私钥

#HostKey /etc/ssh/ssh_host_dsa_key   dsa  私钥

 

 

 

登录文件的信息数据放置  /var/log/secure

#SyslogFacility AUTH

SyslogFacility AUTHPRIV

日志等级

#LogLevel INFO

 

 

#PermitRootLogin yes  是否允许root 登录

#StrictModes yes  是否让sshd 检查用户文件目录权限数据

#PubkeyAuthentication yes  是否允许用户自行使用成对的秘钥系统进行登录

#AuthorizedKeysFile     .ssh/authorized_keys  自定义的公钥数据放置用户的主目录下

#PasswordAuthentication no   验证码是否需要

#PermitEmptyPasswords yes  设置密码是否为空密码登录

PasswordAuthentication yes  

 

#ChallengeResponseAuthentication yes   允许任何密码认证

ChallengeResponseAuthentication no

 

 

#UsePAM no   利用PAM管理用户认证模块

UsePAM yes

 

 

X11Forwarding yes   

#X11DisplayOffset 10

#X11UseLocalhost yes

 

 

 

PrintMotd yes   登录后显示登陆的时间  地点等

#PrintLastLog yes  显示上次登陆的信息

#TCPKeepAlive yes  服务器会一直发送tcp数据包给客户端  判断对方是否一直连接

#UseLogin no  

#UsePrivilegeSeparation yes  

 

 

Public ['pʌblɪk]  公有的

private [ˈpraɪvɪt] 私有的

posted on 2017-05-04 22:08  6621  阅读(138)  评论(0)    收藏  举报

导航