From owner-freebsd-questions Wed Nov 21 22:48:18 2001 Delivered-To: freebsd-questions@freebsd.org Received: from guru.mired.org (okc-65-31-203-60.mmcable.com [65.31.203.60]) by hub.freebsd.org (Postfix) with SMTP id 2FC9637B41A for ; Wed, 21 Nov 2001 22:48:14 -0800 (PST) Received: (qmail 4205 invoked by uid 100); 22 Nov 2001 06:48:13 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15356.40877.440544.248845@guru.mired.org> Date: Thu, 22 Nov 2001 00:48:13 -0600 To: "Dave VanAuken" Cc: questions@freebsd.org Subject: Re: determine user home directory from non-priv user In-Reply-To: <127236121@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dave VanAuken 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). 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