Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zhangchenchen/c9f8fe32e9cc5bc91d5294781424bb06 to your computer and use it in GitHub Desktop.
Save zhangchenchen/c9f8fe32e9cc5bc91d5294781424bb06 to your computer and use it in GitHub Desktop.
salt command to ssh login with private key
salt '*' cmd.run 'mkdir ~/.ssh && chmod 700 ~/.ssh'
salt-cp '*' ~/.ssh/id_rsa.pub ~/.ssh/temp.pub
salt '*' cmd.run 'cat ~/.ssh/temp.pub >> ~/.ssh/authorized_keys && rm -f ~/.ssh/temp.pub'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment