The other day I went to reboot the system and found out I no longer had root access. I was very confused since I could not even su. It kept telling me 'Roles can only be assumed by authorized users'. I eventually figured out where I thought the problem was, but unfortunately didn't have permissions to fix it. In fact, no users on the system were authorized to fix it. I ended up
posting a question on the OpenSolaris Forums asking for help.
When I was at work today, I printed out a response so that I could try it when I got home. Unfortunately, the reply is no longer there for some reason, I can't give credit to whomever it was. Roumen provided this
link to fix the problem. For those of you having this problem, here's what I did to cause it and to resolve it.
The Cause
When I was playing around with the Users and Groups, I went ahead and checked every single box. I mean, why not, I want full access, right? Nevermind that looking back I realize that some specifically say not to add them to users.
The Symptoms
I had basic user rights, but no root rights. I could not login as root, su to root, pfexec as root, save files owned by root, reboot the system, anything.
The Clue
Looking at /etc/user_attr, I noticed that while I did have the role=root attached to my name, there was a lot of garbage (read: all those checkmarks listed as profiles) before it. Maybe 256 characters, maybe 512, I didn't honestly count.
I logged into the 2008.05 livecd and saw that jack only had Primary Administrator. Ok, I'll duplicate that. Unfortunately, I couldn't find the real /etc directory in order to just rewrite it as jack.
Since I didn't have root access, I couldn't change the file.
The Solution
- Reboot
- At the GRUB prompt, hit e for edit
- Arrow down to the kernel$ line
- Hit e to edit
- Append -s to the end of the line and hit enter
- Hit b to start booting
- When prompted, type in the root password
- vi /etc/user_attr and remove all profiles except Primary Administrator from my account
- save the file, exit to the prompt, hit ctrl-D to exit single-user mode
You now have your root access back.