Overview Video
Setup
- On the Mac, go to System Settings > General > Sharing and change the hostname to something unique and short, and turn on Remote Login.
- On an iOS device, open the shortcuts app and select the Shortcuts tab and tap “+”.
- Select Add Action
- Search for “SSH”, and Select “Run Script Over SSH”
- Select Open Settings. If scripting actions are disabled and turn on “Allow Running Scripts”, then return to Shortcuts.
- 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 - Select the Authentication Password and change it to SSH Key. Select the SSH Key ed25519 and Copy Public Key.
- Paste the key and the commands into Notes and airdrop to the host Mac.
Terminal Commands
- On the Mac, open Terminal and run the following commands:
- mkdir ~/.ssh
(This command makes a directory in your home directory named .ssh) - chmod 700 ~/.ssh
(This command changes the permission of the new folder to be only accessible by you) - echo >> ~/.ssh/authorized_keys
(This command puts a blank line in the authorized keys file and creates a file if it doesn’t exist.) - Paste in this command in Terminal but DO NOT RUN:
pbpaste >> ~/.ssh/authorized_keys - Copy the ssh key using command-C and then run the above command in Terminal.
- echo >> ~/.ssh/authorized_keys
- chmod 600 ~/.ssh/authorized_keys
(This changes the permissions on the authorized_keys file, so only you have access.) - 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
- On iOS device, select the Automation tab in Shortcuts and select New Automation
- Search for NFC and select.
- Tap Scan and hold the NFC tag on the back of the phone. Name the tag and select OK.
- Select Run Immediately and turn on Notify when Run.
- 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.