#!/bin/sh
user=$1
serverIP=$2
ssh $user@$serverIP "mkdir .ssh; chmod 0700 .ssh"
scp ~/.ssh/id_rsa.pub $user@$serverIP:~/.ssh/authorized_keys
这样可以实现单向无密码登陆
#!/bin/sh
user=$1
serverIP=$2
ssh $user@$serverIP "mkdir .ssh; chmod 0700 .ssh"
scp ~/.ssh/id_rsa.pub $user@$serverIP:~/.ssh/authorized_keys
这样可以实现单向无密码登陆