旨在快速配置新服务器的登录权限Adduseruseraddjohnsmithconfiguresshsupportkeyloginvi/etc/ssh/sshd_config开启以下配置RSAAuthenticationyesPubkeyAuthenticationyesuserkeyssh-keygen-trsa在第一个输入字段中,输入密钥生成地址,例如/home/johnsmith/.ssh/johnsmith_rsa并在.ssh文件夹下创建一个权限文件,并写入公钥.catjhonsmith_rsa.pub>>authorized_keys获取私钥的内容(不带pub后缀)存放在需要的地方(服务器上的可以删除)。systemctlrestartsshd测试登录ssh-i./johnsmith_rsa-oIdentitiesOnly=yesjohnsmith@123.123.123.123禁用root登录(可选)vi/etc/ssh/sshd_configPermitRootLoginno