Pick a suitable UID and GID :
$ sudo dscl . -list /Groups PrimaryGroupID | sort -n -k2
$ sudo dscl . -list /Users UniqueID |sort -n -k2
Add the user :
$ sudo dscl . -create /Users/newuser
$ sudo dscl . -create /Users/newuser UserShell /bin/bash
$ sudo dscl . -create /Users/newuser RealName "New User"
$ sudo dscl . -create /Users/newuser UniqueID "503"
$ sudo dscl . -create /Users/newuser PrimaryGroupID "20"
$ sudo dscl . -create /Users/newuser NFSHomeDirectory /Users/newuser
Create the users home directory :
$ sudo mkdir /Users/newuser
$ sudo chown newuser:staff /Users/newuser
$ sudo chmod 700 /Users/newuser
View the users details :
$ sudo dscl . -read /Users/newuser
Set the users password
$ sudo dscl . -passwd /Users/newuser PASSWORD
Add them to the allowed SSH users list :
$ sudo dseditgroup -o edit -a newuser -t user com.apple.access_ssh
$ sudo dseditgroup com.apple.access_ssh
Ever since OSX ran on X86 hardware, it has been my primary OS – exclusively on MacBook Pro’s – and whilst learning it’s idiosyncrasies didn’t take long, as a heavy user of keyboard shortcuts I’d always been frustrated by dialog box choices.
The Tab key wouldn’t switch between the buttons, holding Alt or Cmd doesn’t hint at any shortcut letters available, but what does work is pressing the first letter of each buttons text whilst holding Cmd.
So in the example dialog box above, Cmd-C would cancel the choice, Cmd-K would keep the file and lastly Cmd-M would move the file to the trash. Simple, but not as obvious as you might think!
This is a handy OSX tip if you’re working away from home and have only SSH access, but would find it useful to open a VNC session through the SSH tunnel.
# Enable Remote Desktop (a.k.a. Screen Sharing, a.k.a. VNC)
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all
# Disable Remote Desktop
$ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off -stop
My changelog in no particular order, for my reference.
Installed Little Snitch
Installed Server Admin Tools
Installed globalSAN iSCSI Version 3.3.0
Edit /etc/sshd_config to have :
$ nvram boot-args="-v arch=x86_64"
$ defaults write /Library/Preferences/SystemConfiguration/com.apple.Boot 'Kernel Flags' '-v arch=x86_64'
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores true
# launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1
Bang the following into “net.inkhorn.noatime.plist” in /Library/LaunchDaemons
<?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.nullvision.noatime</string> <key>ProgramArguments</key> <array> <string>mount</string> <string>-vuwo</string> <string>noatime</string> <string>/</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
Useful commands :
leela:~ tom$ hdiutil pmap -endoffsets /dev/disk0 MEDIA: ""; Size 238 GB (500118192 x 512); Max Transfer Blocks 2048 SCHEME: 1 GPT, "GPT Partition Scheme"  SECTION: 1 Type:'MAP'; Size 238 GB; Offset: 34 - 500118159, (500118125 x 512) ID Type Offset Size End Name (2) -- -------------------- ------------ ------------ ------------ -------------------- -------- 1 EFI 40 409600 409639 EFI System Partition 2 Apple_HFS 409640 499446368 499856007 256GB SSD Free 499856008 262151 500118158
Just a few thoughts …
- We know there was ZFS read and write support planned for Apples’ forthcoming Snow Leopard Server OS release.
- We know there are 64-bit MacBookPro’s out there with Expresscard34 slots.
- We know there are Expresscard34 SolidStateDisks available.
- We know there are large 500GB SATA rotating disk drives available.
So why couldn’t we have had ZFS on the (cheap and large) internal spinning disk and the ability to put an SSD ExpressCard in the slot for use as L2ARC ?
Except, in reality, we got an ExpressCard slot backed off a USB2 controller rather than a PCI-Express lane, ZFS support seems to have dropped off the radar and the new MBP’s dropped ExpressCard support anyway. Pity.
Whilst toying with an HP Thin Client, I took a copy of the internal 1GB flash drive using dd onto a USB flash drive I’d booted (using ubcd 5.0 b12) the device with.
Once you have such a raw dd image of a disk, you have a few ways to convert it into a format usable with VirtualBox, VMware or Parallels.
Firstly, I discovered that Qemu (there’s a nice Mac port here http://www.kju-app.org/) has a utility called qemu-img.
To convert to the VMware format :
$ /Applications/Q.app/Contents/MacOS/qemu-img convert -f raw -O vmdk sda.dump sda.vmdk
To convert to the Parallels format :
$ /Applications/Q.app/Contents/MacOS/qemu-img convert -f raw -O parallels sda.dump sda.hdd
Or use VirtualBox to convert to it’s format :
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage convertfromraw sda.dump sda.vdi --format vdi
Once you have the preferred type of file, it is simple enough to boot a virtual machine from the image, or firstly you’ll probably like to use your VM software to compress the image if at all possible :
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd sda.vdi --compact
NB. The ANSI standardised Open Virtualization Format (OVF) will commonly include disk images in the compressed VMDK format.
NB. Download the VMware Virtual Disk Development Kit, which allows you to mount and tinker with the files in VMDK disk images outside of VMware :
vmware-mount sda.vmdk /mnt/loop/