Merge pull request #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>
This commit is contained in:
Rohit Yadav 2016-01-27 16:12:06 +01:00
commit 431389da9d

View File

@ -81,8 +81,8 @@ if [ ! -e $authorized ]; then
chmod 600 $authorized chmod 600 $authorized
fi fi
cat $authorized|grep -v "$publickey"|tee $authorized > /dev/null sed -i "/ cloudstack@apache.org$/d" $authorized
echo "$publickey" >> $authorized echo "$publickey cloudstack@apache.org" >> $authorized
which restorecon && restorecon -R -v $sshdir which restorecon && restorecon -R -v $sshdir