From e4783dd9468a755f843a9db5235e386446a63e26 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 30 May 2012 17:57:01 +0000 Subject: rtadm: create: remove old entry from known_hosts Remove the entry for the localhost + the port we may connect to when we create a new connection tarball. Only works if known_hosts file is not hashed. git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@10611 283159da-0705-0410-b60c-f2062b4bb6ad --- rtadm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtadm b/rtadm index e161e48..148ad99 100755 --- a/rtadm +++ b/rtadm @@ -42,6 +42,10 @@ create() tarball="$HOME/tar/remote-access-$COMMENT.tar.gz" tar -czf $tarball -C ~/tmp basename host key port tunnelport user --owner root --group root mkdir -m 700 -p ~/.ssh + # Remove conflicting entries fron a non-hashed known_hosts file: + if [ -r $HOME/.ssh/known_hosts ]; then + sed -i -e "/^\[localhost\]:$PORT /d" $HOME/.ssh/known_hosts + fi umask 022 cat ~/tmp/key.pub >> ~/.ssh/authorized_keys -- cgit v1.2.3