I tried to leave a comment, but twas asking complicated things about registering.
$ ssh-copy-id ‘-p xx -i ~/.ssh/id_rsa.pub firstname.lastname@example.org’
SPICE also keeps coming up as a possible solution to the lack of built-in network translucency in Wayland, the technology many would like to see replace X down the road.
Especially with NoMachine's NX 4 going closed source (previous versions were partially open, allowing others to replace the closed parts and produce a fully open stack), I'm looking to SPICE as a replacement.
On the remote machine which will export the application(s):
xpra start :100
On your local machine, you would use something like:
xpra attach ssh:serverhostname:100
You can even detach the windows(s) from one computer and reattach from another, like GNU Screen.
One problem is that NX 3 doesn't support newer X extensions like COMPOSITE and DAMAGE, though. NX 4 does, but is no longer open. So the future viability is kind of starting to break down already, if you ask me.
Enter the ControlMaster mechanism (see man ssh_config):
ControlMaster's biggest advantage is using a single encryption channel for multiple connections. Especially handy if you need to jumphost through a vpn machine.
When I want to work with a server, I very often use "sshfs <servername>:<remote_dir> <local_path>" to mount it to my local drive. (By default <remote_dir> is your remote home directory, so you can omit it if that's what you want).
Then you avoid all that mucking around with ssh while working. Probably a bit more inefficient, but you can use rsync if you're pushing a lot of data around.
Available on homebrew as "brew install sshfs".
There is a downside to sshfs, though, and it's related to the classic Joel on Software post, "The Law of Leaky Abstractions" (http://www.joelonsoftware.com/articles/LeakyAbstractions.htm...). A relevant quote from that article is:
Abstractions fail. Sometimes a little, sometimes a lot. There's leakage. Things go wrong. It happens all over the place when you have abstractions.
It sucks to be using your editor of choice to modify a file mounted on an sshfs filesystem and have something not quite work right. Something as simple as having the latency be higher than the local filesystem can make saves (and even autosaves) ruin the user experience. And you're pretty well hosed when the connection drops; you're almost guaranteed to lose at least some work.
That is why these days I tend to avoid sshfs and simply SSH+screen to a remote machine, where I can then run vim using a .vimrc file that matches the one on my home machine. I get exactly the same editing system no matter where I'm logged in, and instead of hiding connection problems somewhere that you can't control, it's very clear what will happen when a disconnection occurs.
Of course, if it's across a local or very reliable network, all of my arguments disappear and sshfs is an excellent tool.
(I don't want to clutter my laptop with various versions of PHP, Apache, etc. that I need for work, so I run a VM - as of late, I've been using ~/projects/workProject1 as my working folder, mounting it via VirtualBox's shared folders, but the read/write speed on the VM is pretty atrocious. Which is sometimes great for testing, but not so great when I accidentally type "git status" in the VM instead of the host machine, and wait a full minute before realizing my mistake.)
I just followed the homebrew directions, I don't remember doing anything funky to get it installed.
I have written thousands of lines of code with NX, Eclipse and latencies of ~100ms! There is no way to do something similar with VNC or anything else.
http://freenx.berlios.de/ FreeNX is a great service. Also NoMachine NX Client is a great client. If you use them once, you can't even hear about VNC and other remote control services.
I wish there was NX for mac, since I try my best in life not to use ms technology.
ssh -D1080 email@example.com
It is really useful if you want to access virtual named hosts behind remote servers or just want to specify the uri instead of fiddling around with ports.
> cd && tar czv src | ssh example.com 'tar xz'
Why would you not want to use scp?
scp -r src/ example.com:~/target/
1. The scp command is not quite the same because it's not maintaining all the file metadata the way that tar is.
2. The examples were mostly intended to be illustrative, showing that you can do things like cd around on the remote machine before receiving/sending the data across the SSH pipe.
My VNC server example near the bottom of the post was a more useful example of the type of thing you can do with SSH that doesn't have another easy solution.
and voila! You can resume big file transfers now.
ssh -R8080:localhost:80 remote.host
This is really useful for some firewall punching (if you can access the ssh server or have at least a http proxy which supports CONNECT) and exposing private services remotely.
It would also get you fired from most places I've worked.
For example, I have a remote proxy server, a different remote web server, github and so on, all with different user names and ports. I can alias each with their own setup, including adding an entry for a tunnel.
ssh -C -f -L 5901:localhost:5900 example.com sleep 10; open vnc://localhost:5901;
One line. Add is as an alias, configure ssh keys and you can connect to your home machine from anywhere securely.
For example, I route http://blah.example.com to my home server, then use VirtualHost to route blah.example.come to port 8080
# run under screen if we are connected via ssh
if [ "$SSH_CONNECTION" ] ; then
rm -f .ssh/auth-sock
if [ -e "$SSH_AUTH_SOCK" ] ; then
ln -s "$SSH_AUTH_SOCK" .ssh/auth-sock
screen -d -R