Skip to content

Instantly share code, notes, and snippets.

View gjpalau's full-sized avatar

Gilbert Palau gjpalau

View GitHub Profile
@gjpalau
gjpalau / ard-pub-cmd.sh
Created January 30, 2015 21:55
ard commands for public setup
dscl . create /Users/Public
dscl . create /Users/Public UserShell /bin/bash
dscl . create /Users/Public RealName "Public User"
dscl . create /Users/Public UniqueID 503
dscl . create /Users/Public PrimaryGroupID 1000
dscl . create /Users/Public NFSHomeDirectory /Users/Public
dscl . passwd /Users/Public Public
@gjpalau
gjpalau / TurnOnSSHAddAdminGroup.sh
Last active June 1, 2016 22:14
Script that activates ARD to use a specific user with specific access, and turns on SSH.
#!/bin/bash
# TurnOnSSHAddAdminGroup.sh
#
# Turn on remote login ## Create the com.apple.access_ssh group ## Add the admin group to com.apple.access_ssh ## unload and load the SSH Service
sudo systemsetup -setremotelogin on && dseditgroup -o create -q com.apple.access_ssh && dseditgroup -o edit -a admin -t group com.apple.access_ssh && sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist && sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -specifiedUsers && sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -users nameofadmin -activate -access -on -privs -all -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw p@55w0rd -quiet
/usr/libexec/PlistBuddy -c ‘Set :com.apple.screensharing:Disabled NO’ /private/var/db/launchd.db/com.apple.launchd/overrides.plist
@gjpalau
gjpalau / steguestlogin.plist
Created January 31, 2015 00:15
LaunchAgent Plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.site.steguestlogin</string>
<key>ProgramArguments</key>
<array>
<string>Users/Shared/Scripts/SteGuestlogin.sh</string>
</array>
#!/bin/bash
AIRPORT="en1"
USER="$USER"
if [ "$USER" = Public ]; then
networksetup -removeallpreferredwirelessnetworks
ifconfig en0 down
networksetup -setairportpower en1 on
echo "Airport is now turned on."
networksetup -addpreferredwirelessnetworkatindex en1 STE-Guest 0 OPEN
echo "You are now connected to the STE-Guest Network."
#!/bin/bash
AIRPORT="en1"
USER="$USER"
if [ "$USER" = Public ]; then
networksetup -removeallpreferredwirelessnetworks
ifconfig en0 up
echo "Ethernet is now turned on"
networksetup -setairportpower en1 off
echo "Airport is now turned off."
exit 0
@gjpalau
gjpalau / nfs-automount.sh
Created February 11, 2015 20:21
nfs mount script
#!/bin/sh
# NFS Auto-Mount for Mavericks/Yosemite
# Scripted by Gilbert Palau
# November 2014 v1.0
#
FILE_DATE=`date +%Y%m%d`
if [ -f /etc/auto_master ]; then
sudo mv /etc/auto_master /etc/auto_master_backup-$FILE_DATE
fi
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@gjpalau
gjpalau / macrename.sh
Created February 11, 2015 21:43
Script for Naming Mac's automatically
#!/bin/bash
# uniMIS renamer script -- use with ComputerName name below
# By Gilbert Palau, Enterprise OS X - www.enterpriseosx.com
#
# this script renames the mac by chassi type + serial number: ??-SERIAL
#
# Legend:
#
laptop="ML-"
workstation="MW-"
@gjpalau
gjpalau / rename-and-bind.sh
Last active May 25, 2020 22:54
mac renamer + AD bind script
#!/bin/bash
# uniMIS renamer script -- use with ComputerName name below
# By Gilbert Palau, Enterprise OS X - www.enterpriseosx.com
#
# this script renames the mac by chassi type + serial number: ??-SERIAL
#
# Legend:
#
laptop="ML-"
workstation="MW-"
@gjpalau
gjpalau / macrenamer.sh
Created February 11, 2015 23:07
Rename your computer depending on your chassis+yourmacserialnumber
#!/bin/bash
# uniMIS renamer script -- use with ComputerName name below
# By Gilbert Palau, Enterprise OS X - www.enterpriseosx.com
#
# this script renames the mac by chassi type + serial number: ??-SERIAL
#
# variables:
laptop="ML-"
workstation="MW-"
server="S-"