I have installed OS 11 x64 on a pc to evaluate if this could be my new system for a home storage array of 48TB. I have a very basic problem: I somehow cannot access root with the admin password created at the install. I am currently logged in as admin@solaris but in order to configure zfs, etc, I need root access. How can reset the root passwd or simply remove it temporarily? Thanks, Dan
2 Answers
You can no more log in as root with Solaris 11 as, by default, root is not an account but a role. Just use sudo from your initial user login account if your need root privileges, eg
$ sudo -i
Should you want to revert root to its traditional (but less secure) non role setting, you can run:
# rolemod -K type=normal root
-
It also depends on how you installed S11. The graphical installer configures root as a role with an expired password but the text installer configures a valid root password at install (and I think leaves root as a normal user). You can convert root back to being a user rather than a role by editing /etc/user_attr. Feb 16, 2012 at 13:30
-
Actually, the text installer leaves the choice to either create a regular user account with a password, in which case root is still a role, or not create an initial user account in which case root is indeed not a role. I'm not advising to revert root back to a user for security reasons.– jlliagreFeb 16, 2012 at 16:08
-
Ah, maybe that changed since S11X? I don't quite remember it working that way but my memory may be faulty. I'm also not advising to change root from being a role, just saying that it can be done (enough people moaned about this on openindiana-discuss...) Feb 16, 2012 at 17:44
-
That was already the case with S11X, see step 8 in docs.oracle.com/cd/E19963-01/html/820-7799/sliminstall.html– jlliagreFeb 16, 2012 at 23:27
Here is another way to do it:
1) Boot from the text install DVD (or ISO file if your Solaris 11 installation is in a VM)
2) Make sure you boot into single user mode: at the initial GRUB screen, press Esc, then press 'e' to edit the Grub command line, add the switch '-s' for single-user boot
3) After booting into single-user mode, log in as 'root', the password is 'solaris'
4) Mount the ZFS root pool. Most HOWTOs recommend creating only the directory /a
, this is not enough, you need two directories, we use /a/b
in the following example. Also the -f
flag (force) is important in the zpool import
command.
mkdir -p /a/b
zpool import -f -R /a rpool
zfs set mountpoint=/b rpool/ROOT/solaris
zfs mount rpool/ROOT/solaris
5) Edit the file /a/b/etc/shadow
, you may need to make it writable first. Find the row with root's entry, it is usually the first. Delete the password hash between the first and second colons, so the line now looks like root::12345::::::
(your number may be different).
6) Edit /a/b/etc/user_attr
by commenting out the line root::::type=role
. This makes root a "normal user" which is not recommended BTW.
7) Edit /a/b/etc/default/login
by commenting out the line PASSREQ=YES
. This will ensure that no password is required when logging in as root.
8) Reset the root mountpoint by issuing the commands
zfs set mountpoint=/ rpool/ROOT/solaris
zpool export rpool
The first command will complain about being unable to mount 'a' because the directory is not empty, cannot remount etc. Ignore this and reboot. You should be able to log in as root without a password.