LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   openssh server not working, cannot ssh from remote pc (https://www.linuxquestions.org/questions/linux-newbie-8/openssh-server-not-working-cannot-ssh-from-remote-pc-4175486407/)

5883 11-30-2013 07:59 PM

openssh server not working, cannot ssh from remote pc
 
this is what i did,
0. my linux pc, local ip 192.168.1.2, external ip 200.1.2.3
1. installed openssh server
2. in the /etc/ssh/sshd_config, i changed port to 2222
3. restart pc
4. in my router, i added a port forwarding for TCP for 192.168.1.2 for dest port 2222

now i go to another pc at home, i can ssh into 192.168.1.2

now if i remote into a remote pc, from there ssh into 200.1.2.3, won't work.

What did i miss here ?
Many thanks !

pingu 12-01-2013 10:58 AM

I believe this is a port misconfiguration.
SSH server runs on pc, listens on 2222. So if you ssh from a pc in LAN, you ssh to 192.168.1.2:2222
If you want to connect to internal ssh-server from internet on port 2222, then you should have a pf-rule 2222 -> 192.168.1.2:2222. Then you can connect to 200.1.2.3:2222

lleb 12-01-2013 11:54 AM

or just use the -p flag.

Code:

ssh -p 2222 remote_user@200.1.2.3
should do the trick.

also read the links in my cig to learn about ssh keys and config files to make your life easier.

5883 12-01-2013 12:54 PM

yes, it's the port forwarding issue, i struggled a little bit with route setting and it's working now.

Quote:

Originally Posted by pingu (Post 5073434)
I believe this is a port misconfiguration.
SSH server runs on pc, listens on 2222. So if you ssh from a pc in LAN, you ssh to 192.168.1.2:2222
If you want to connect to internal ssh-server from internet on port 2222, then you should have a pf-rule 2222 -> 192.168.1.2:2222. Then you can connect to 200.1.2.3:2222



---------- Post added 12-01-13 at 01:54 PM ----------

cool, thanks !

Quote:

Originally Posted by lleb (Post 5073459)
or just use the -p flag.

Code:

ssh -p 2222 remote_user@200.1.2.3
should do the trick.

also read the links in my cig to learn about ssh keys and config files to make your life easier.



All times are GMT -5. The time now is 02:27 PM.