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

Re: Default valid shells and home dir permissions



Davit Avsharyan <avsharyan@gmail.com> wrote:
> 1/  I'm wondering why most of the system users have valid shells by 
> default ?
> /cat /etc/passwd | grep -E '(sh|bash)' | wc -l
> *21*/

That's not necessarily sufficient to determine valid shells: the absence
of a shell definition implies the use of /bin/sh, so you need to check
that, too.

Something like this should probably give you a definitive list -

    SS=$(grep '^/' /etc/shells | xargs)
    for S in $SS ''; do
        getent passwd | awk -F: -v S="$S" '{if ($7 == S) print $1, $7}'
    done

Chris


Reply to: