OSX make your own peronal screenshot sharing
In this tutorial i will show you how to make your own personal cloud screenshot sharing. We need a hosting or VPS support ssh login, and copy file after we taking a screenshot on mac (Command + Shift +4). Here is example of final http://cloud.tabvn.com/1455983425.png
so i have a domain is cloud.tabvn.com point to our server in /var/www/public_html/ with server IP is: 22.214.171.1249
Follow step by step at the bellow
Generate your SSH key and copy it to your server.
You will need to use the command line to generate ssh key in Mac OS X. Thus, the first thing you’ll need to do is launch the Terminal app from /Applications/Utilities/ to get a prompt.
ssh-keygen -t rsa
Your ssh key has been generated in ~/.ssh/id_rsa.pub Now copy your ssh key
cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Now you can go ahead and log into [email protected] and you will not be prompted for a password. However, if you set a passphrase, you will be asked to enter the passphrase at that time (and whenever else you log in in the future).
Create shortcut alias of SSH config
in command line type
sudo nano ~/.ssh/config
then add with content
Host tabvn User root Port 22 HostName 126.96.36.1999
Now go ahead and type ssh tabvn if you want to login to your server with ssh. instead of ssh [email protected] -p
Change Where Screen Shots Save on Mac
we need change the folder that screenshot file will be saved when we taking a screenshot on Mac, simple type this command
defaults write com.apple.screencapture location ~/Pictures/Screenshots/
Automator is powerful tool on Mac. in this tutorial we will create new automator workfollow and run a shell script with folder action, meaning it will detect a folder ~/Pictures/Screenshot there is new file saved and will copy that file into your own hosting.
open Automator in /Aplications/automator.app , or you can run this command to open Autormator app
sudo open /Applications/Automator.app
From Automator application select File -> New -> Folder action -> Choose
Now on the left sidebar Library select Ulitities-> Run a shell script
On the top of folder action make sure the folder select is ~/Pictures/Screenshots
In run a shell script enter this code:
#!/bin/sh TIMESTAMP=$(date +%s) cd ~/Pictures/Screenshots cp "$(ls -t | head -n1)" ~/Desktop/"$(ls -t | head -n1)" scp "$(ls -t | head -n1)" tabvn:/var/www/public_html/$TIMESTAMP.png echo http://cloud.tabvn.com/$TIMESTAMP.png | pbcopy afplay /System/Library/Sounds/Glass.aiff rm "$(ls -t | head -n1)"
Now need set notification. On left sidebar "Libary" -> Ulitities -> Display a notification
So we are done. Now save Automator workfollow and enjoy! , take a screenshot by press all : Command +Shift + 4