Apple Mac OS X Server System Imaging and Software Update Administration For Version 10.4 or Later Bedienungsanleitung Seite 15

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 27
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 14
R. Saeks July ’06 - 15 -
Login Scripts
The next few pages contain the loginhook and logouthook that runs on the machine. It shows the code and explains
what it does. The best thing to do when setting these up is to code them one command at a time. This will make
troubleshooting easier. Planning a hierarchal setup for scripts makes developing them much easier. The loginhook
should perform actions that all users, regardless of user class, will need applied to them. Doing so lets items, such
as AppleScript applications, apply to only the targeted group, which is more efficient.
The first script that I utilize is below. This is the loginhook that runs after each user authenticates. As before, line
numbers have been added for reference:
1 echo "===== LOGIN: `date` =====" >> /var/log/login.log
2 echo "$1" >> /var/log/login.log
3 if tail -1 /var/log/login.log | grep root
4 then
5 hostname=`hostname -s`
6 network_info=`ifconfig -L en0 | grep broadcast`
7 /usr/sbin/sendmail rsaeks@glenbrook.k12.il.us <<EOF
8 From: root_login@$hostname
9 To: rsaeks@glenbrook.k12.il.us
10 Subject: [Login] Root login detected
11 A root login was performed on $hostname with the following network information
12 $network_info
13 EOF
14 fi
#build new student profile
15 rm -R /Users/studentuser/Library
16 cp -R /Library/Management/profiles/studentuser/Library/ /Users/studentuser/Library
17 rm -R /Users/studentuser/Desktop
18 cp -R /Library/Management/profiles/studentuser/Desktop/ /Users/studentuser/Desktop
19 rm -R /Users/studentuser/Music
20 cp -R /Library/Management/profiles/studentuser/Music/ /Users/studentuser/Music
21 chmod -R 777 /Users/studentuser/Library
22 chmod -R 777 /Users/studentuser/Desktop
23 chmod -R 777 /Users/studentuser/Music
24 exit 0
Line one writes a line to the login.log file that has the login date and time. The following line will write the user ID
to the log file. Lines three though fourteen take the last person who logged in, and if it was the root user, send an
email alert to a specified email address with the name of the machine, as well as the IP address. This can be
modified for any user that you would like by adding additional if statements. This is used because in general, root
will not be logging in, and if they are, one would want to make sure it is authorized.
Seitenansicht 14
1 2 ... 10 11 12 13 14 15 16 17 18 19 20 ... 26 27

Kommentare zu diesen Handbüchern

Keine Kommentare