1

I am not of the IS field so sorry if anything I write here seems pathetic.

Background for this question:

I login to my server with the following command. The second -L porition is to encrypt data transition through my PC's port 2222, into port-80 dependent software in the server (for example, CMSs like Drupal or DBMSs like PHPmyadmin).

ssh user@1.1.1.1 -L 22:localhost:22 -L 2222:localhost:80 -i ~/.ssh/key

My question:

How could I make sure beyond any doubt, that the second tunneling (i.e of port 80), also takes place and is successful?

  • 1
    give a shot to "lsof -i -n -P | grep ^ssh " , it will list port number instead of names – amarnath chatterjee Dec 29 '16 at 10:21
3

To ensure that a tunnel is created successfully you can run

lsof -i tcp | grep ^ssh

In the output look for your foreign address 1.1.1.1 , look at the chain formed there should be two linking entries

  • lsof -i -n -P | grep ^ssh shows only port 22. Port 80 doesn't appear. It seems the port 80 tunneling doesn't take place. – JohnDoea Dec 29 '16 at 11:15
  • @Benia While you might be correct (I have no idea), please do not make edits that change the meaning of answers unless the OP agrees with you. So either get the OP to do the edit by themself, or ask if it would be an OK edit in comments. – Anders Dec 29 '16 at 14:18
  • Hi, you can see above in the question comment that amarnath later added this phrasing lsof -i -n -P | grep ^ssh. It's best to use that one. I hope amarnath will agree. – JohnDoea Dec 29 '16 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.