Apple Notes

Downloads for Apple Developers

https://developer.apple.com/download/more/

Keyboard Shortcuts

Put mac to sleep

Option–Command–Power

Put display to sleep

Control–Shift–Power

Resources: https://support.apple.com/en-us/HT201236

OSX Terminal Stuff

SSH

Check ssh service status

sudo systemsetup -getremotelogin

Enable SSH

sudo systemsetup -setremotelogin on

Disable SSH

sudo systemsetup -setremotelogin off

Resource: http://osxdaily.com/2016/08/16/enable-ssh-mac-command-line/

Disable screensharing

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist

Create account

sudo dscl . -create /Users/niceuser
sudo dscl . -create /Users/niceuser UserShell /bin/bash
sudo dscl . -create /Users/niceuser RealName "Super Nice Guy"   
sudo dscl . -create /Users/niceuser UniqueID *unique id*
sudo dscl . -create /Users/niceuser PrimaryGroupID 80 # Make user part of Admin group
sudo dscl . -passwd /Users/niceuser
sudo dscl . -append /Groups/admin GroupMembership niceuser

You can create a home directory for the user if you'd like as well:
sudo mkdir /Users/niceuser

Resources:
https://smallbusiness.chron.com/add-user-terminal-mac-os-x-screen-sharing-31846.html
https://discussions.apple.com/thread/8248721

Remove account

sudo dscl . -delete /Users/niceuser

Delete the home directory if you created it:
sudo rm -rf /Users/niceuser

Resource: https://apple.stackexchange.com/questions/310308/delete-a-standard-user-from-mac-os

List users

sudo dscl . list /Users | grep -v "^_"

Screen sharing via finder

  1. Open Finder
  2. Ctrl-k
  3. vnc://target_ip

Resource: http://hints.macworld.com/article.php?story=20100927085636535

Get version of OSX Running

sw_vers -productVersion

Resource: https://www.tecmint.com/send-a-message-to-logged-users-in-linux-terminal/

Mount NFS share

sudo mkdir /mnt/name_of_system_folder
sudo mount -t nfs -o rsize=65536,wsize=65536,intr,hard,tcp,locallocks,rdirplus,readahead=128 system.com:<path to volume mount> /mnt/name_of_system_folder

Resources:
https://care.qumulo.com/hc/en-us/articles/115008111268-Recommended-NFS-Mount-Options
https://willhaley.com/blog/mount-nfs-share-on-a-mac/

Unmount NFS share

sudo umount -Af -t nfs,smbfs

Resources:
https://askubuntu.com/questions/292043/how-to-unmount-nfs-when-server-is-gone
https://superuser.com/questions/249611/how-to-forceably-unmount-stuck-network-share-in-mac-os-x

Automount an NFS share in /Volumes

https://gist.github.com/L422Y/8697518

SSHFS

Install:

brew cask install osxfuse
brew install sshfs

Mount remote system:

mkdir /mnt/remote_system 
cd /mnt/remote_system
sudo sshfs -o allow_other,defer_permissions user@remote_system.com:/ /mnt/remote_system

Resources:
https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh
https://howchoo.com/g/ymmxmzlmndb/how-to-install-sshfs