[root@i3 ~]# cat reset-centos-authorized-keys
#!/bin/bash
zoneid=37216800-4ebd-68b8-a467-852ce5ae8cef
ssh_pubkey='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDB4HL8HlR8J66lGtLpWL0TTqjDraPI8dY5uhMgup4y99LyFhA/qUYFRl0cR2m3LTq5ud9W7tiuSBjWVpwx11aFGn2FEw3BQKz8YTsLgaS1hCnnJbtn8OABozm/Q3y4SQFn9CHfvX3cejQ+J0iHh+NNL6kS8GfgF40uIZhbBvlfb/WoWS2dbjLQLFpacys+nmjACeaAXmU9A4Hk5oHbo8K4g8tmss+oNxlLNObk1rB41jaWgFGxsyUYgkTAlWc4wpylHeohSKtcqa/qAzEjaYfyke3aKsHEAWx3OKfw+nfGrutb2TpGWZ55SaTOBs+S/wnSFLwah0kH12lwxdm8gMa/ root@i3'
vmadm stop $zoneid
set -x
cd /zones/${zoneid}/config/
echo '{
"customer_metadata": {
"root_authorized_keys": "'${ssh_pubkey}'",
"user-script" : "/usr/sbin/mdata-get root_authorized_keys > ~root/.ssh/authorized_keys ; /usr/sbin/mdata-get root_authorized_keys > ~admin/.ssh/authorized_keys"
}
}' > metadata.json
#vmadm update $zoneid -f metadata.json
vmadm start $zoneid
[root@i3 ~]#
Yorumlar
Yorum Gönder