/[svn.andrew.net.au]/scripts/interactive_accounts
ViewVC logotype

Diff of /scripts/interactive_accounts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 40 by apollock, Sun Feb 10 18:16:27 2008 UTC revision 42 by apollock, Tue Feb 12 22:41:02 2008 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    #
3    # Script to find users with a valid shell (and if run as root, an unlocked
4    # account). Outputs a colon separated user:shell so it can be further grepped
5    # for shells you don't care about (e.g. scponly)
6    #
7    # Copyright (c) 2008 Andrew Pollock <me@andrew.net.au>
8    #
9    # Copying permitted under the terms of the GNU GPL v2
10    #
11    
12  for entry in $(getent passwd | cut -d: -f1,7 | grep -v -E "^(sash)?root:")  for entry in $(getent passwd | cut -d: -f1,7 | grep -v -E "^(sash)?root:")
13  do  do
14          shell=$(echo $entry | cut -d: -f2)          shell=$(echo $entry | cut -d: -f2)
15            if [ "$shell" == "" ]; then
16                    continue
17            fi
18          if grep -q $shell /etc/shells; then          if grep -q $shell /etc/shells; then
19                  user=$(echo $entry | cut -d: -f1)                  user=$(echo $entry | cut -d: -f1)
20                  if [ $UID -eq 0 ]; then                  if [ $UID -eq 0 ]; then

Legend:
Removed from v.40  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.22