Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jul 1998 21:44:46 -0400 (EDT)
From:      CyberPeasant <djv@bedford.net>
To:        yurtesen@turkey.ispro.net.tr (Evren Yurtesen)
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: UID?
Message-ID:  <199808010144.VAA14959@lucy.bedford.net>
In-Reply-To: <35C258A1.74FB20EC@turkey.ispro.net.tr> from Evren Yurtesen at "Aug 1, 98 02:52:01 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Evren Yurtesen wrote:
[Charset iso-8859-9 unsupported, filtering to ASCII...]
> hello
> maybe this is stupid question but how may I know
> which UID belonging to which user without looking in to
> the password file?
> thanks

Ultimately, you (or a program) will have to look in the passwd database.
In the general case, this is more complicated than just looking in
/etc/passwd.

There's a FreeBSD-specific utility, pw, to do this. (man pw).

	pw usershow NAME | cut -f3 -d:

will display user NAME's uid. 

If you need to do this a lot, and to take actions based on the uid,
or if the user is not found, you may wish to use a C program which
calls the getpwnam(3) library routine.


Dave
-- 
Sancho Panza: `Microsoft Windows NT Server is the most secure network 
	operating system available.'
Don Quixote: `You are mistaken, Sancho.'

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?199808010144.VAA14959>