2

Someone ran "chown -R username /usr" and now I have no way of logging into the box to change it back. SSH has been disabled, X Server won't start so I have no graphical GUI, and the console login keeps saying "Login Incorrect" when I try to login. I don't have the exact message next to me, but it says some files within the /usr directory are not owned by root, which leads me to believe the chown was the problem that caused this.

I can change the ownership back if I can just get into the command prompt somehow. Does anyone have any ideas how I could get a command prompt from this?

The box is a Dell T310 server running Solaris 10 (10/09 version).

smpappas
  • 33
  • 2
  • If it's x86 hardware, maybe you can use a Linux boot CD and mount the disk. –  Apr 20 '11 at 17:42
  • Or use the Solaris boot CD for that matter. Sparc or intel. Linux won't work if it's a zfs root. – JOTN Apr 20 '11 at 22:19

4 Answers4

4

Once you boot off the CD and mount the disk's / and (and /var and /usr if separate partitions) you can try using pkgchk to fix the permissions rather than a blind chown. For example, if you mounted / under /var/tmp/root:

pkgchk -a -f -v -p /usr -R /var/tmp/root

(Disclaimer: I have not tested this.)

Mark Wagner
  • 17,764
  • 2
  • 30
  • 47
  • Thanks, I booted from the CD, ran the single user shell and mounted the disk, then actually ran both the chown and the pkgchk line you gave me. Rebooted and everything is fine again. Thanks to both! – smpappas Apr 20 '11 at 19:47
2

Restart the system and at the grub screen select Solaris failsafe. This will boot into the miniroot which should detect and mount your current filesstem on /a. You can then fix /a/usr.

user9517
  • 114,104
  • 20
  • 206
  • 289
1

Boot from a rescue CD and mount the drive, then you can run your chown. I can't think of a way to do this without a reboot.

toppledwagon
  • 4,215
  • 24
  • 15
0

At the console, boot in single user mode, chown the directory back.

Single User Mode has no login, and does not honor most file system permissions, so it should have no problems overriding the settings.

Chris S
  • 77,337
  • 11
  • 120
  • 212
  • 1
    This is incorrect. Going to runlevel S on a solaris system will in fact ask for the root password. – Grahamux Apr 20 '11 at 21:25
  • @Grahamux, only if the console is marked as insecure in the tty settings. Perhaps that is the default now, I haven't kept up. – Chris S Apr 20 '11 at 21:45