This procedure currently supports clients on Mac OS/X and Linux on x86 processors
Please note: we've heard there are issues with OS/X El Capitan (newest Mac OS).
You can use this script to make direct SSH connections from a command line terminal on your Mac OS/X or Linux x86 computer to an SSH host (ex. Raspberry Pi). This eliminates the need to manually login at www.weaved.com to generate a hostname and port to use with your ssh client. No more copy/paste and copy/paste!
This is an update to the script described here. It is offered primarily to show the use of API calls and the client mode of the daemon. The latest update to the script no longer saves credentials as clear text. The security key is stored as an "Auth Hash".
If you prefer not to cache this, just change the following line:
Then you will need to enter your Weaved username and password each time you run the script.
1) Caches your auth hash instead of username and password
2) Caches the port assignment for each device -as a result, multiple simultaneous connections are possible without overlapping ports
3) Caches the Device List for your account
4) Uses the device name instead of UID
5) Allows display of your device list including current status for each connection
Initially, the script may take longer to connect to your device as it is logging into Weaved's servers to get the device list. When you connect to a new device, you may get warnings from the SSH client. Follow the instructions shown in the warning message to run ssh-keygen for each new connection to add it to the known_hosts file. Run the script again and you will be able to log in to your SSH server. Subsequent logins will go faster.
Download the Weaved daemon
Get weavedConnectd.macosx for Mac OS/X (Intel) here:
Get weavedConnectd.linux for x86 Linux (tested with Ubuntu 14.04) here:
Copy this file from the download location to /usr/bin and name it weavedConnectd, e.g.
sudo cp weavedConnectd.macosx /usr/bin/weavedConnectd
Make it executable:
sudo chmod +x /usr/bin/weavedConnectd
If sudo asks for your password, give it your Mac or Linux account login password, not your Weaved password.
Download launcher scripts
Now go to this folder at Github:
and download the lib.sh and sshw.sh scripts to your computer.
Make them executable using:
chmod +x lib.sh sshw.sh
Example: Start a direct ssh connection from a client (Linux x86 or Mac OS/X)
- Your Weaved account username and password.
- The Weaved Device Name
- Your ssh login name and password
Debugging your connection
Verbose output (which can be useful for debugging any issues you may encounter) can be enabled by adding 1 or two "-v" right after the script name on the command line:
./sshw.sh -v pi@Raspberry-Pi-ssh
./sshw.sh -v -v pi@Raspberry-Pi-ssh
(better for debugging login issues).
Get a full description of command line options and how the script works:
./sshw.sh -m | less
1) Some combinations of client and server router equipment may prevent a direct connection using this approach. Proxy-type connections (through the web portal) should work.