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/shadow
Make the file writable
$ chmod 600 /usbkey/shadow
Fire up
vi
to edit the file$ vi /usbkey/shadow
Edit 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/cryptpass
to generate a hash for the password you desire. (Remember to clean the bash history!)Save the file and exit
vi
Make the file readonly again
$ chmod 400 /usbkey/shadow
Double 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.)