home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Linux / Ubuntu_64-bit / ubuntu-11.04-desktop-amd64.iso / casper / filesystem.squashfs / sbin / shadowconfig < prev    next >
Text File  |  2011-02-20  |  879b  |  50 lines

  1. #!/bin/sh
  2. # turn shadow passwords on or off on a Debian system
  3.  
  4. set -e
  5.  
  6. shadowon () {
  7.     set -e
  8.     pwck -q
  9.     grpck -p
  10.     pwconv
  11.     grpconv
  12.     chown root:root /etc/passwd /etc/group
  13.     chmod 644 /etc/passwd /etc/group
  14.     chown root:shadow /etc/shadow /etc/gshadow
  15.     chmod 640 /etc/shadow /etc/gshadow
  16. }
  17.  
  18. shadowoff () {
  19.     set -e
  20.     pwck -q
  21.     grpck -p
  22.     pwunconv
  23.     grpunconv
  24.     # sometimes the passwd perms get munged
  25.     chown root:root /etc/passwd /etc/group
  26.     chmod 644 /etc/passwd /etc/group
  27. }
  28.  
  29. case "$1" in
  30.     "on")
  31.     if shadowon ; then
  32.         echo Shadow passwords are now on.
  33.     else
  34.         echo Please correct the error and rerun \`$0 on\'
  35.         exit 1
  36.     fi
  37.     ;;
  38.     "off")
  39.     if shadowoff ; then
  40.         echo Shadow passwords are now off.
  41.     else
  42.         echo Please correct the error and rerun \`$0 off\'
  43.         exit 1
  44.     fi
  45.     ;;
  46.      *)
  47.     echo Usage: $0 on \| off
  48.     ;;
  49. esac
  50.