Ssh Clip
Clipboard with SSH cause graphical web interfaces are just too overkill for copying text.
Try it NOW#
To upload content:
SH
| |
To download saved content:
SH
| |
Upload files!
SH
| |
Upload and download directories!
SH
| |
$_ TERMINAL
Here, trash acts as a “clipboard slot” name — you can use any name you like.
first_message is the name of the file you’d like to store.
How it works#
SSH as a protocol#
SSH, is actually a protocol. The ssh and sshd commands are just clients and servers that (unironically) communicate via the ssh protocol.
This means that we can provide a spec-compliant custom implementation for the server, and any ssh client should be able to communicate with the server just fine.
Written in go#
The core of the implementation is a sshd like server program written in go. I chose go here because of two main reasons:
- I know it pretty good.
- It has amazing ssh support built right into the standard library (Batteries included).
I also used github.com/gliderlabs/ssh, mainly because it provides an interface to write ssh handlers just like http hanlders.
Sample SSH handler in go:
GO
| |
Sample HTTP handler in go:
GO
| |
Operations#
For now, ssh-clip supports upload and download of content. Content can be text, binary or even a directory of files (given that you tar or zip it before and after).
Why not SCP?#
scp is a tool built specifically for transfer of files over an ssh connection. Even though it is standard, for my use case of carelessly copying around text, it has a few downsides:
- It requires creating a restricted user account and handling file permissions when deploying it.
- It requires some sort of identity verification - either through passwords or ssh keys.
Security Concerns#
PLEASE DON’T STORE SENSITIVE CREDENTIALS / SECRET KEYS / PASSWORDS with ssh-clip while using the public instance. Everything is stored in plain text in the server’s file system.
If you want a private storage, you can always self-host your own copy of ssh-clip on your own server and not share it’s port to others - it’s as simple as running it yourself. Keep in mind that no verification of usernames is done, so if people have your instance’s IP and PORT, they can access and store files in it.
Source#
Get the source code here: