[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Checking for Group Membership



Eric Harrison wrote:

On Thu, 30 Jan 2003, Steve Wright wrote:


if (grep $group /etc/group | grep $user) >>/dev/null ; then


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

A more flexible way of writting that line is:

if (groups $user | grep $group) >>/dev/null ; then


These days you can't make the assumption that there is a complete /etc/groups, /etc/passwd, etc ;-)

If you use the "id" command ("groups" is just a wrapper around "id"),
it will work with accounts stored in LDAP, NT domains, etc.


well, live and learn I allus say.. thanks for that.


8-))


/steve







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]