CLOUDSTACK-10067: Fix a case where a user 'ro' or 'roo' exists on the system, or other variants. (#2252)

If one sets user=roo, this will return two directories and then it will fail.
This commit is contained in:
Lars Tobias Skjong-Børsting 2017-09-18 08:45:36 +02:00 committed by Rohit Yadav
parent 2bad9a6c11
commit a4036f7083
2 changed files with 3 additions and 3 deletions

View File

@ -84,7 +84,7 @@ else
exit 1 exit 1
fi fi
homedir=$(grep ^$user /etc/passwd|awk -F ":" '{print $6}') homedir=$(getent passwd $user|awk -F ":" '{print $6}')
sshdir=$homedir/.ssh sshdir=$homedir/.ssh
authorized=$sshdir/authorized_keys authorized=$sshdir/authorized_keys

View File

@ -67,7 +67,7 @@ if [ -z "$publickey" ]; then
exit 1 exit 1
fi fi
homedir=$(grep ^$user /etc/passwd|awk -F ":" '{print $6}') homedir=$(getent passwd $user|awk -F ":" '{print $6}')
sshdir=$homedir/.ssh sshdir=$homedir/.ssh
authorized=$sshdir/authorized_keys authorized=$sshdir/authorized_keys