From 199eac4c4269b8d2c934cd72a73d792758782070 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Sun, 19 Jun 2022 09:14:44 +0800 Subject: [PATCH] u --- home-config.sh | 6 ++---- ssh-pubkey-to-remote.sh | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/home-config.sh b/home-config.sh index 136fe23..5a54281 100755 --- a/home-config.sh +++ b/home-config.sh @@ -43,8 +43,7 @@ then read -p ">>> " CopyOrLinkScripts for homescript in $homescriptlist do - rm -fr $homescript.backup - mv $homescript $homescript.backup + mv $homescript $homescript.backup-[$(date +%Y%m%d-%H%M%S)] if [ $CopyOrLinkScripts = 'l' ] then echo "--- Linking $SourcePath/$homescript to $HomePath/$homescript ..." @@ -62,8 +61,7 @@ then echo "--- Linking $SourcePath/authorized_keys to $HomePath/.ssh/authorized_keys ..." mkdir -p $HomePath/.ssh chmod 700 $HomePath/.ssh - rm -fr $HomePath/.ssh/authorized_keys.backup - mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup + mv $HomePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys.backup-[$(date +%Y%m%d-%H%M%S)] ln -s $SourcePath/.ssh/authorized_keys $HomePath/.ssh/authorized_keys elif [ $CopyOrLinkOrOmitAuthorizedKeys = 'a' ] then diff --git a/ssh-pubkey-to-remote.sh b/ssh-pubkey-to-remote.sh index 6312010..c78daa3 100755 --- a/ssh-pubkey-to-remote.sh +++ b/ssh-pubkey-to-remote.sh @@ -14,4 +14,4 @@ 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 \ No newline at end of file +echo "~/.ssh/id_rsa.pub is appended to $REMOTEHOST:~/.ssh/authorized_keys" \ No newline at end of file