Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created January 18, 2013 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/4566986 to your computer and use it in GitHub Desktop.
Save rtrouton/4566986 to your computer and use it in GitHub Desktop.
#!/bin/tcsh -f
##
############################ login.sh ###########################
# Mike Bombich | mike@bombich.com
# Copyright 2002 Mike Bombich.
# With the appropriate modification to /etc/ttys, this script will
# execute each time a user logs in.
##################################################################
# This script takes the username as an argument, then removes any
# old default home directory, restores a fresh copy of the default
# home directory, then chowns it to logging in user.
##
## Properties
set defGrp = staff
# This part is for debugging/testing purposes only
if ( $#argv < 1 ) then
echo "No user specified!"
exit 1
endif
# If this is the default user, replace the default home directory
# with a copy of the user template
if ( $1 == "visitor" ) then
rm -rf /Users/$1
/usr/bin/ditto -rsrcFork "/System/Library/User Template/English.lproj" /Users/$1
/usr/sbin/chown -R ${1}:${defGrp} /Users/$1
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment