Neat trick: Changing the permissions of an underlying mount point

A colleague of mine showed me a neat little trick in Solaris (I would guess sol 10 but perhaps earlier versions too) that I'd not seen before and thought I'd share here in case it's new for someone else also.

As most of you know, Solaris has the annoying habit of producing error messages when non-root users try to perform operations on filesystems mounted on a directory with less than 0555 permissions.
The only fix for this that I knew of (after hassling the engineer that got it wrong in the first place) was to stop everything that was using the filesystem, unmount it, change the perms, then remount again - yuck.

But this alternate way my colleague showed me appears to work without having to touch the filesystem mounted on our broken directory at all (obviously you should test this someplace safe before trying it in the wild though!):

Create some new mount point someplace:

mkdir /somedir

Loopback mount the underlying filesystem:

mount -F lofs -o nosub / /somedir

Fix the permissions on your mountpoint:

chmod 0555 /somedir/your/mount/point

Unmount:

umount /somedir

And you're done!

So, the file system "does not care", but chmod is doing some kind of check to prevent working directly on a mountpoint. Does this work for all filesystems? You see can why I ask - who would bother to code chmod to "care" otherwise. There must be a gotcha somewhere.

Really interesting.

I suspect I am misunderstanding your question but in case I do have you right, the chmod isn't really caring or not caring - it's just working on what it sees, as the second mount of the same filesystem wouldn't have anything mounted on top of any mount points underneath it.
So that allows one to 'see' the directory that would normally be obscured by the root of the mounted FS.

Doesn't work in Solaris 9.

this undermines my authority as root, I do not agree

I don't follow, what's getting undermined?

I have to wonder here too.