From: Robert G. Clapp bob.clapp@gmail.com
Date: Feb 16, 2007 10:54 PM
Subject: More ssh fun
To: sep sep@sep.stanford.edu

Brought on by a conversation with Brad I thought I would remind people of a few ssh trick. Save this email for future use:

LOGGING INTO SEP MACHINE WITHOUT A PASSWORDS:

On your local machine:

ssh-keygen -t dsa

Do not enter a paraphrase

cd .ssh cp id_dsa.pub authorized_keys2 (or add it to the end)

Put in your .xinitc file (so it is called only once at login) You could also setup an alias

eval `ssh-agent`; ssh-add

Make sure your home directory's permision is set to 744 Make sure ssh directory permissions are set to 700

Now you should be able to ssh without being asked for a password. This is not IP address dependent (it will work even if your ISP does not give you a permenant IP address.

SSH FROM YOUR LOCAL MACHINE TO A MACHINE ON THE LOCAL NETWORK

ssh -X koko ssh -t -X -t kook

This will give you a direct connection to a macine on the local network.

GETTING REALLY FANCY

The previous example is a specific example to a more a general problem. How to interact from machines not on our local network to machines on our local network. The secret is port forwarding. Basically you can set up a port on your local machine that is directly connected to our local network.

First establish the connection.

ssh -L 7777:kook:22 koko cat -

Now access that port through ssh, sftp, or scp:

ssh -p 7777 localhost scp -p -P 7777 localhost:data/file1.txt . sftp -oPort=7777 localhost

For those of you using bbedit or textwrangler, specify your connection as locahost:7777 to connect to a machine on the local network.

Bob

sep/internal/email.txt · Last modified: 2015/05/27 02:06 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0