home directory to user mapping

randy orrison randy at halcdc.UUCP
Tue Nov 15 06:26:50 AEST 1988


Is there an easy way to reverse the user to home directory mapping of
/etc/passwd?  That is, given an absolute pathname, tell me whose home
directory it's in?  In a simple, pre-nfs and symbolic links,
filesystem, this isn't too bad, but in the worst case it can get
complicated.  e.g.
	my home directory is /u/randy
	/u/randy -> /n/halcdc/usr1/randy
	/n/halcdc is an nfs mount of halcdc:/usr1/randy
I want a function that (run on halcdc) given '/usr/randy/junk/file'
will tell me that it's in randy's home directory.

Any ideas on how to do this?

	Thanks in advance!
		-randy



More information about the Comp.unix.wizards mailing list