SSH

From Torben's Wiki
(Redirected from Ssh)

see [1] [2]

SSH password-free-login

all in 1 go (exceute on ssh client machine)

ssh-copy-id user@remotehost

On the ssh-client machine

Use ssh-keygen to create private and public keys in the folder ~/.ssh/

ssh-keygen -t rsa

or

ssh-keygen -t rsa -C "email@host.com"
# ( or -t dsa )

passphrase can be empty The public key is in the file ~/.ssh/id_rsa.pub

adding or changing passphrase

ssh-keygen -p

storing passphrase of client via ssh-agent (linux)

ssh-agent bash
ssh-add

On the ssh server machine

  • append your public key to ~/.ssh/authorized_keys (you may have to create this file)
  • set that files permissions to 0640
  • set .ssh/ permissions to 0640

Windows Client using Putty and PAgent

  • use PuTTYgen to generate a RSA key
    • set password
    • set comment, for example hostname of client machine
    • store private and public keys
  • edit generated public key
    • remove linebreaks from key
    • prepend ssh-rsa to key followed by a space. So it looks like ssh-rsa AAAAB3Nza...
  • double click on private key to load it into Pageant (key manager)
  • in Putty
    • load your ssh connection
    • put private key to Connection->SSH->Auth
    • save connection
  • on Server
    • place public key without comments in ~/.ssh/authorized_keys, see above

Mount using ssh

apt-get install sshfs

now you can run

/usr/bin/sshfs -o idmap=user server:/home/USER /mount/DIR

The option idmap=user is important to map the servers and clients user id

(this does not work from fstab...)