Skip to content

Commit 431389d

Browse files
committed
Merge pull request apache#1044 from ustcweizhou/keep-sshkey
CLOUDSTACK-5822: keep user-added sshkeys in authorized_keysFor now, if we add the ssh key inside the vm (not on cloudstack UI), the sshkey will be removed if we reset the sshkey on cloudstack UI. After this commit, the sshkey (added by cloudstack) will end with cloudstack@apache.org. We will only control the sshkeys with cloudstack@apache.org. This will be used for multiple sshkey support for vm in the future. * pr/1044: CLOUDSTACK-5822: keep user-added sshkeys in authorized_keys Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2 parents a59cf68 + 64ef4fa commit 431389d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

setup/bindir/cloud-set-guest-sshkey.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ if [ ! -e $authorized ]; then
8181
chmod 600 $authorized
8282
fi
8383

84-
cat $authorized|grep -v "$publickey"|tee $authorized > /dev/null
85-
echo "$publickey" >> $authorized
84+
sed -i "/ cloudstack@apache.org$/d" $authorized
85+
echo "$publickey cloudstack@apache.org" >> $authorized
8686

8787
which restorecon && restorecon -R -v $sshdir
8888

0 commit comments

Comments
 (0)