Tag Archive "ssh"

ssh login without a password

Published October 8th, 2009 by Chad

There are a few places that I have to ssh to over and over and over again each day. I have a development and a production server at work (many of each actually) as well as my personal web hosting. I also have a very secure and strong password (if I do say so myself) that I use for many things, but it is also pretty long. I can type it pretty fast now, but it is easy to mess up if I am lot looking at my fingers and that slows me down. The solution to all of this…don’t use my password from my personal and work computers. Simple. :)

Following are the steps that you will need to take to be able to ssh to a system without using your password every time.

  1. Generate your public and private ssh keys on your local machine. ssh-keygen -t rsa NOTE: Just keep hitting enter. The ssh-keygen command will ask for a fire name and a passphrase. Just it enter to use the defaults.
  2. Make sure there is a .ssh directory on the remote machine. ssh remoteuser@remotemachine mkdir -p .ssh NOTE: It should ask for your remote users password for the remote machine.
  3. Copy your public key to the remote machine. cat .ssh/idrsa.pub | ssh remoteuser@remotemachine 'cat >> .ssh/authorizedkeys' NOTE: It should ask for your remote users password for the remote machine. This should be the last time you will have to type your password in while using ssh to that machine.

Once you have done this you should be able to ssh into the remote machine without having to type in your password. And this should work every time when sshing from your local machine to the specific remote machine.

If you want to set up a key between the same local machine and a different remote machine, you don’t have to do step 1 again. Just use the same public key from before, id_rsa.pub.

mounting a remote ssh filesystem

Published December 8th, 2008 by Chad

I ran into a problem yesterday where I wanted to mount a directory from a remote server to my work laptop. I wanted to be able to use applications like eclipse with files that were on other servers.

The solution I found was awesome. With Ubuntu 8.10 I was able to do the following to mount these remote servers and use the filesystem as if it was local.

  1. $ sudo apt-get install sshfs
  2. $ sudo adduser username fuse
  3. $ sudo mkdir /media/remote-server-mount-point
  4. $ sudo chown username /media/remote-server-mount-point
  5. $ sshfs remote-server.com:/desired-mount-directory /media/remote-server-mount-point
That it! Then when you have another server that you want to mount, just repeat steps 3-5 for that server. Pretty cool. You would than access the file on that server from /media/remote-server-mount-point.