Changing root password in global zone
SmartOS mounts /etc/shadow from /usbkey/shadow so we can change the root password for the global zone after install. Here’s how:
Fire up a console or ssh session as root in the global zone
Check the existing permissions on the file
$ ls -l /usbkey/shadow -r-------- 1 root root 560 Oct 19 16:45 /usbkey/shadowMake the file writable
$ chmod 600 /usbkey/shadowFire up
vito edit the file$ vi /usbkey/shadowEdit the line containing root to change the crypted password. See
shadow(4)if you need help with the format of/etc/shadow& use/usr/lib/cryptpassto generate a hash for the password you desire. (Remember to clean the bash history!)Save the file and exit
viMake the file readonly again
$ chmod 400 /usbkey/shadowDouble check permissions are correct on the file again
$ ls -l /usbkey/shadow -r-------- 1 root root 560 Oct 19 16:49 /usbkey/shadow
Job done. Verify by logging in as root (invoking /usr/bin/login from an ssh session makes this easy to verify.)