SSH配置

来源:互联网 发布:淘宝联盟怎么招代理 编辑:程序博客网 时间:2024/06/07 07:24

生成密钥

ssh-keygen -t rsa -f ~/.ssh/path/id_rsacat ~/.ssh/path/id_rsa.pub #为了下一步的复制做准备, 复制到authorized_keys中

复制密钥

useradd {name}su {name}cdmkdir .sshchmod 700 .sshvim .ssh/authorized_keyschmod 700 .ssh/authorized_keys

配置sshd文件

vim /etc/ssh/sshd_config> Port 60237> PasswordAuthentication no> PermitRootLogin noservice sshd restart

配置ssh_config

Host {name}    user {username}    HostName 115.29.36.237    Port 60237    IdentityFile  ~/.ssh/path/id_rsa
0 0