/etc/ssh/ssh_config和/etc/ssh/sshd_config都是ssh服务器的配置文件,二者区别在于,前者是针对客户端的配置文件,后者则是针对服务端的配置文件。

ssh config

ssh 指定sshkey文件登录

ssh -i <sshkey私钥文件> <user>@<address>
修改~/.ssh/config  

Host git.company.com
  User git
  IdentityFile /Users/guanliyuan/.ssh/test
  IdentitiesOnly yes

sshd config

/etc/ssh/sshd_config

禁止ROOT远程SSH登录
PermitRootLogin yes/no

使用密钥登录,禁止口令登录
PasswordAuthentication yes/no

修改ssh server 的端口号
Port 22

重启sshd服务

service sshd restart