In Aix it's
cat /etc/passwd | grep $UserID | cut -d":" -f6
Quote:> Hello, I am trying to write a ksh script to find a users *true* home
> directory with a shell script (i.e. no perl or C on these servers). I
> found a post on google of a shell script/C program combo called rpath
> but google didn't have the entire script (it was pretty long) and
> besides I'd prefer a solution that uses just unix utilities and the
> ksh features (93 or 88).
> Example: adam's home directory per the passwd file is /home/adam
> but /home is actually a link to /fs0/home so adam's true home is
> /fs0/home/adam. How to find this out so I can put it into a script?
> Any unix utils? Currently I am using "df /home/adam" to find the true
> filesystem it is on but it is the directories under that (home in this
> case) that I would have a problem "finding" since df will only report
> the parent filesystem. And then what if /fs0/home links somewhere
> else? So is there some way to stat or view up the true directory
> tree from the known destination ("adam" home in the fs0 filesystem)?
> Why? The app I am rolling out requires that group/other not have the
> write bit on any of the directories of the users home directory
> (security reasons) so I need to run a "chmod g-w xxx" where xxx is
> each directory in turn (i.e. chmod g-w /home then chmod g-w
> /fs0/home and finally chmod g-w /fs0/home/adam). I can't do a
> recursive chmod since other stuff may be in each of those directories.
> If you have some other solution than my attempt to find the "one true
> home directory" then please suggest. Assumption about where home
> should or should not be cannot be made as I will be rolling this out
> to 20 different servers and so far they have a mix of links, true
> homes, etc.
> thanks for any ideas