This commit is contained in:
Luk Lu
2019-12-14 11:17:11 +08:00
parent cab00d1a94
commit e0f90ab6b4
4 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
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"