Modify root password on SmartOS global zone

A normal job is to modify the root password for any security reason. The /etc/shadow file contains the password but is mounted read only from /usbkey/shadow:

# ls -la /etc/shadow 
-r--------   1 root     root         560 Oct  9  2013 /etc/shadow

# mount | grep /etc/shadow
/etc/shadow on /usbkey/shadow read/write/setuid/devices/dev=169001b on Thu May 29 13:55:55 2014

Because of that you will be not able to modify the password by passwd. So you need to modify the /usbkey/shadow to setup a new password. You could easily use the cryptpass to create the hash that is required:

# /usr/lib/cryptpass <password>

You need to replace the old hash in /usbkey/shadow with the output of the cryptpass script. Be sure you clean the bash history! Remount the /etc/shadow to activate the root password without an reboot:

# umount /etc/shadow
# mount -F lofs /usbkey/shadow /etc/shadow

Again, make sure you cleanup the bash history if you don't reboot the machine:

# history -c

Posted

June 11, 2014, 9:31 pm

Tags

, , , ,

More

Permalink

Comments

Send your comment by mail.