admin管理员组

文章数量:1558034

使用秘钥登录远程服务器

#!/usr/bin/expect -f
#auto ssh login
set timeout 30
spawn ssh root@10.X.X.X
expect "password:"
send "mypassword\r"
interact

使用秘钥登录远程服务器

#!/usr/bin/expect -f
#auto ssh login
set timeout 30
spawn ssh -i /Users/scott/shells/keys/yj_test_private_key  root@xx.xx.xx.xx
interact

在这一步之前,需要对秘钥文件进行授权,4读 2写 1执行 权限,该文件需要对所有者有读写权限,数字权限需要三围8进制数字因此需要执行以下命令:

 chmod 600 yj_test_private_key

本文标签: 脚本服务器Shell