Back in 2012 Jonathan Perkin wrote a little bit about SmartOS and the global zone, why and what in SmartOS is mounted read-only.
/etc/shadow, the file containing the root password, was mounted with write permissions.
It is not anymore:
# ls -l /etc/shadow -r-------- 1 root root 560 May 12 19:51 /etc/shadow
passwd will fail when trying to change the password.
But it’s easy to circumvent this. It’s actually a lofs-mount as can be seen:
# mount | grep shadow /etc/shadow on /usbkey/shadow read/write/setuid/devices/dev=1690008 on Mon May 12 20:05:36 2014
So to change your password use the following:
/usr/lib/cryptpass your-fancy-password # replace crypt string in /usbkey/shadow umount /etc/shadow mount -F lofs /usbkey/shadow /etc/shadow
- will create the crypt string of your password. Make sure to remove it from your bash history afterwards
- place this string in
/usbkey/shadow(it’s the long string between the first two
- unmount the file in place
- remount the right file back in place
And that’s it, the new root password is set.