Make sure server exists in ~/.ssh/config
Signed-off-by: Jacob Kiers <jacob@alphacomm.nl>
This commit is contained in:
parent
b3e4231ae0
commit
9a9d1beb88
@ -21,13 +21,19 @@ if [ -z "$IP" ]; then
|
|||||||
IP=$HOST
|
IP=$HOST
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Adding server to .ssh/config...
|
grep "Host $HOST" ~/.ssh/config 2>&1 > /dev/null
|
||||||
cat >> ~/.ssh/config <<EOF
|
|
||||||
|
|
||||||
|
if [ 0 -eq $? ]; then
|
||||||
|
echo $HOST is already in .ssh/config
|
||||||
|
else
|
||||||
|
echo Adding server to .ssh/config...
|
||||||
|
cat >> ~/.ssh/config <<END_OF_HOST
|
||||||
Host $HOST
|
Host $HOST
|
||||||
HostName $IP
|
HostName $IP
|
||||||
User $USER
|
User $USER
|
||||||
EOF
|
END_OF_HOST
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo Copying .ssh directory to $USER@$HOST...
|
echo Copying .ssh directory to $USER@$HOST...
|
||||||
scp -qr $HOME/.ssh/ $HOST:
|
scp -qr $HOME/.ssh/ $HOST:
|
||||||
|
Loading…
Reference in New Issue
Block a user