Updates

Shortcuts for MacAdmins

Overview Video

Setup

  1. On the Mac, go to System Settings > General > Sharing and change the hostname to something unique and short, and turn on Remote Login.
  2. On an iOS device, open the shortcuts app and select the Shortcuts tab and tap “+”. 
  3. Select Add Action
  4. Search for “SSH”, and Select “Run Script Over SSH”
  5. Select Open Settings. If scripting actions are disabled and turn on “Allow Running Scripts”, then return to Shortcuts.



  6. Complete the following under Run script over SSH
    Script: say “hello”
    Hostname: Enter the unique and short hostname from above under
    User: Enter the username of the host machine
  7. Select the Authentication Password and change it to SSH Key. Select the SSH Key ed25519 and Copy Public Key.
  8. Paste the key and the commands into Notes and airdrop to the host Mac.

Terminal Commands

  1. On the Mac, open Terminal and run the following commands:
  2. mkdir ~/.ssh
    (This command makes a directory in your home directory named .ssh)
  3. chmod 700 ~/.ssh
    (This command changes the permission of the new folder to be only accessible by you)
  4. echo >> ~/.ssh/authorized_keys
    (This command puts a blank line in the authorized keys file and creates a file if it doesn’t exist.)
  5. Paste in this command in Terminal but DO NOT RUN:
    pbpaste >> ~/.ssh/authorized_keys
  6. Copy the ssh key using command-C and then run the above command in Terminal.
  7. echo >> ~/.ssh/authorized_keys
  8. chmod 600 ~/.ssh/authorized_keys
    (This changes the permissions on the authorized_keys file, so only you have access.)
  9. cat ~/.ssh/authorized_keys
    (This command shows the contents of the file in use.)

Run Script

On the iOS device, Open shortcuts and Run script over SSH. You will be prompted to verify the host fingerprint. Tap accept. The Mac should then say “hello”.

Trigger with RFID

  1. On iOS device, select the Automation tab in Shortcuts and select New Automation
  2. Search for NFC and select.
  3. Tap Scan and hold the NFC tag on the back of the phone. Name the tag and select OK.
  4. Select Run Immediately and turn on Notify when Run.
  5. In the upper right corner select Next and then select Run Script over SSH.

Tap the tag on the top back of the phone and the host Mac should say hello.

Tags: