Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Nov 2001 00:48:13 -0600
From:      Mike Meyer <mwm@mired.org>
To:        "Dave VanAuken" <dave@hawk-systems.com>
Cc:        questions@freebsd.org
Subject:   Re: determine user home directory from non-priv user
Message-ID:  <15356.40877.440544.248845@guru.mired.org>
In-Reply-To: <127236121@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Dave VanAuken <dave@hawk-systems.com> types:
> from a non-priv account we need to determine the home directory of a user...
> used for interaction with web server.
> For example,  need to find out what user "Joe"'s home dir is... we would execute
> our program ("finduserdir" in this example) in the following manner to get the
> desired results:
> 	server# finduserdir Joe
> 	/usr/home/Joe
> 	server#


Let the shell do it for you....

bash-2.05$ ./finduser mwm
/home/mwm
bash-2.05$ ./finduser qmail
Unknown user: qmail.
bash-2.05$ ./finduser qmailq
/var/qmail
bash-2.05$ cat ./finduser
#!/bin/csh
echo ~$1
bash-2.05$ 

It even sets the exit status to 0 (user exists) or 1 (use doesn't exist).

	<mike
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Q: How do you make the gods laugh?		A: Tell them your plans.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15356.40877.440544.248845>