sysconfig/exec-add-rsapub-to-remote.sh
2019-12-14 11:17:11 +08:00

11 lines
284 B
Bash
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

if [ $1 ]
then
REMOTEHOST=$1
else
read -p "Enter user@remotehost " REMOTEHOST
fi
scp ~/.ssh/id_rsa.pub $REMOTEHOST:~/tmp.pub
ssh $REMOTEHOST "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat ~/tmp.pub >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && rm -f ~/tmp.pub"