Wietse Venema via Postfix-devel <postfix-devel@postfix.org> wrote:
> What about using the the super-user's name in the pasword file?
> 
>     root=`awk -F: '$3 == 0 { print $1; exit }'  /etc/passwd` || exit 1
> 
>     find ... -user $root ...
> 
> I think that we can still count on /etc/passwd to exist.
> 

That was my first instinct too, but I couldn't find "/etc/passwd" mentioned
anywhere in POSIX, I was worried if $3 will be always the uid. Since the only
POSIX-like systems I have experience other than Linux is FreeBSD and OpenBSD I
didn't assumed that would be true to all other systems, specially the more
unusual ones like HP-UX and AIX that are mentioned in Postfix homepage as
supported, if you know that it works on all supported systems, that sounds a
better approach for me too.

Viktor Dukhovni via Postfix-devel <postfix-devel@postfix.org> wrote:
> Or, if, as I believe, it is sufficiently portable:
> 
>     root=$(id -nu 0) || exit 1
> 
> >     find ... -user "$root" ...
> 
> (quotes added).

I tested this too before that ls hack, this doesn't work when there's a user
named "0" in the system, at least in my system id it reports the name for the
user "0" not root (id (GNU coreutils) 9.5).

BR.

-w
_______________________________________________
Postfix-devel mailing list -- postfix-devel@postfix.org
To unsubscribe send an email to postfix-devel-le...@postfix.org

Reply via email to