Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

I am trying to set up my config file for ssh. When I work from home I connect to machine located remotely as follows

  1. Tunneling to the machine via local port ssh -N -l poppop -L 2223:my_machine:22 my.domain.com &

  2. Then logging to machine using ssh -p 2223 username@localhost

Please help me setting my config file so that I dont have to tunnel it every time to log in.


share|improve this question

migrated from stackoverflow.com Feb 8 '13 at 2:39

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Ignacio Vazquez-Abrams, Everett, 8088, sudo, Dave M Feb 8 '13 at 14:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You have to tunnel, else you wouldn't be doing this. Do you mean that you want to automate the tunnelling step? How about putting these two lines into a script? –  Paul Feb 8 '13 at 3:59

1 Answer 1

you don't need config file. just run

 ssh-copy-id [-i [identity_file]] [user@]remote-machine

this command will copy your publicKey to remote, then you don't have to give password everytime.

if you don't have ssh-key pair yet, you need to generate a key-pair first.

man ssh-keygen for detail.

share|improve this answer