chmod +x *.sh

This commit is contained in:
Luk Lu
2019-12-14 12:02:51 +08:00
parent e0f90ab6b4
commit be8adebf89
11 changed files with 15 additions and 11 deletions

6
exec-add-rsapub-to-remote.sh Normal file → Executable file
View File

@@ -1,3 +1,5 @@
#!/bin/bash
if [ $1 ]
then
REMOTEHOST=$1
@@ -5,6 +7,8 @@ else
read -p "Enter user@remotehost " REMOTEHOST
fi
scp ~/.ssh/id_rsa.pub $REMOTEHOST:~/tmp.pub
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"
echo ~/.ssh/id_rsa.pub is appended to $REMOTEHOST:~/.ssh/authorized_keys