chmod +x *.sh
This commit is contained in:
6
exec-add-rsapub-to-remote.sh
Normal file → Executable file
6
exec-add-rsapub-to-remote.sh
Normal file → Executable 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
|
||||
Reference in New Issue
Block a user