Category Archives: ssh

mount remote file systems over ssh (sshfs)

Mount remote file systems over ssh with three steps:

1. install sshfs

witr@witr-pc:~$ sudo apt-get install sshfs

2. create directory where you willi mount your remote file sustem

witr@witr-pc:~$ sudo mkdir /mnt/witrRemote

3. finally, mount the remote file system

witr@witr-pc:~$ sudo sshfs /mnt/witrRemote/

Assumes myRemoteFolder is on witr serve home directory. See warning bellow.
warn : ~ is expanded by the shell. Paths are relative on sshfs. that means : “sshfs …” will fail with No such file or directory error.

guess ssh key passphrase

You have probably forgotten your ssh key passphrase. But you have a hunch what it might be. The simple way to check it, is to use ssh-keygen with -y argument which read private key file and print public key :

witr@witr-pc:~$ ssh-keygen -y
Enter file in which the key is (/home/witr/.ssh/id_rsa): /tmp/my_private_ssh_key
Enter passphrase:

If you input the correct passphrase, it will show you the associated public key. Otherwise, it will display

load failed

when ssh connection refused with “Too many authentication failures for x”

If you are here you have probably got following message when trying to connect with ssh:
“Received disconnect from 2: Too many authentication failures for x”

In fact, when trying to connect, ssh send all locally registred keys to the server trying them one by one. The server will reject any key after too many keys have been rejected.

If you are using key to connect try :

ssh -i your_key -o ‘IdentitiesOnly yes’ user@server:/path/

If you are connecting without keys (login and password only) try

ssh -o ‘IdentitiesOnly yes’ user@server:/path/

Secure Shell Client under Windows7 crashes when adding tunnel

With the gui of Secure Shell client under windows7, when you try to add outgoing tunnel it crashes and windows tell you that program will be ended.

Solution :
1. create an incoming tunnel with your ssh profile :
    Menu profiles –> edit profiles
    Then choose “Tunneling” tab and finally choose “Incoming” tab
2. go to C:UserswitrApplication DataSSH and edit your profile XXX.ssh2 with simple text editor
you must find your declared incoming tunnel like so :

3. move declared incoming tunnel to outgoing tunnels section and save
4. reconnect with Secure Shell Client and now must be go.

connect with ssh from windows SSH Secure Shell to ubuntu sshd

March 20, 2013

first of all install sshd : “sudo apt-get install openssh-server”
then start sshd : “sudo /etc/init.d/ssh start” and try to connect from SSH Secure Shell with username/password

If it works, we have to know that username/password authentication is not secure!
So we will disable authentication with username/password and allow only keys authentication.
We have to edit sshd config file: sudo vi /etc/ssh/ssh_config
ensure that lines bellow are not commented and have such values:
– RSAAuthentication yes
– PubkeyAuthentication yes
– AuthorizedKeysFile      %h/.ssh/authorized_keys
and disable username/password auth:
– PasswordAuthentication no
save sshd_config and restart sshd : sudo /etc/init.d/ssh restart

now if you try to connect from SSH Secure Shell with username/password you will be refused. you must generate and put public and private keys.

> ssh-keygen -t dsa mykey.ossh
will create private and public keys

> cat >> ~/.ssh/authorized_keys
will authorize person having keys to login

if you will connect from open ssh client you just have to copy keys in your .ssh home directory
if you will connect from SSH Secure Shell you must before that convert open ssh keys to ssh2
> ssh-keygen -e -f mykey.ossh > mykey
> ssh-keygen -e -f >
then use mykey and from SSH SecureShell

connect with specified private key
> ssh -i path/to/your/private_key user@server.domain_or_ip
transfer myfile to server
> scp -i path/to/your/private_key myfile user@server.domain_or_ip:/path_in_server/