Addressng chsh fail due to /etc/passwd permissions
Since maas containers are running as non-privileged, the maas root user might not be able to get lock on the host's /etc/paasword to change shell for the maas user. Added retry/sleep to eventually get the lock and make the shell update for the user. Also, using usermod instead of chsh. Change-Id: Iaba6276bd6d54b22980aef8c6f7c5c113d0f2fff
This commit is contained in:
parent
290bbf1adc
commit
d11fa44221
@ -36,6 +36,21 @@ then
|
||||
chmod 600 ~maas/.ssh/*
|
||||
fi
|
||||
|
||||
chsh -s /bin/bash maas
|
||||
|
||||
set +e
|
||||
sh_set=false
|
||||
for (( c=0; c<=10; c++ )); do
|
||||
if chsh -s /bin/bash maas; then
|
||||
sh_set=true
|
||||
break
|
||||
elif usermod -s /bin/bash maas; then
|
||||
sh_set=true
|
||||
break
|
||||
else
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
if [[ $sh_set = false ]]; then
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
exec /sbin/init --log-target=console 3>&1
|
||||
|
Loading…
x
Reference in New Issue
Block a user