I originally wrote a short entry with links in the site blog. I've done quite a bit of
experimenting with SSH and Samba since in order to see how to tighten things
down on my LAN. My OpenBSD boxes have Samba shares on them available for
the one Windows box I have and both require a password. I don't like cleartext
passwords even on my local area network, so I wanted to learn how I could get
around that. Samba over SSH seemed like a good solution. I found the article
that helped me the most at:
Samba over SSH -- Opening Windows to UNIX safely and reliablyI've tried to shorten things a bit from the original windows loopback adapter
[client ~]# ssh-keygen -t rsaHere's the link the example is taken from for you to refer to:
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Ehter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e8:0e:e7:2b:06:e7:9c:2a:1c:f2:91:86:ae:d8:0d:20 root@client
[client ~]# _
How to Setup Password-less SSH Using Public - Private KeysIf you choose to create passwordless keys, remember to protect them. One good way is:
$ chmod 0600 id_rsa (or id_dsa - whichever type of key you need to use)Remember that the keys need to be created on both ends of the connection, and the
$ cd .ssh/ $ scp id_rsa.pub billybob@somebox:/myother_id_rsa.pubI have Cygwin installed on my windows box and it has served me well. There are other
$ ssh billybob@somebox (You'll have to type your password in at this point.
Repeat keygen process)
$ mv myother_id_rsa.pub .ssh/ && cd .ssh/
$ cat myother_id_rsa.pub >> authorized_keys
$ scp id_rsa.pub billybob@homebox:.ssh/remote_id_rsa.pub
$ exit
$ cat remote_id_rsa.pub >> authorized_keys (Now go ahead and try to ssh back to
the remote account. You should get in without a password)
$ ssh billybob@somebox (If problems. recheck your authorized_keys files)
$ ssh -f -N -L xxx.xxx.x.xxx:139:localhost:139 username@xxx.xxx.x.xxx sleep 60hit enter, and the connection is established. The 'sleep 60' gives me time, from the
@echo offThere's a good explanation of all these commands at:
ipconfig /renew (you don't need this if you have a static IP like me)
arp -d *
nbtstat -R
pconfig /flushdns
nbtstat -RR
ipconfig /registerdns
No affiliation between this site and the OpenBSD project exists or is implied.