8
6
Is there any way I can connect home computers (Linux) from office computer (windows) using putty. If yes, please tell me the step to make the connection.
8
6
Is there any way I can connect home computers (Linux) from office computer (windows) using putty. If yes, please tell me the step to make the connection.
8
An easier way to set your home router to allow incoming connection to your Home PC (running Linux) is to set DMZ to your PC.
So as some people has mentioned (also to recap):
A few possible issues:
Pretty sure other people can point out some more possible issues, but give it a try for now and see how you go.
Hope this helps.
1I personally prefer port forwarding to DMZ as it's safer to expose specific ports on your computer to the internet rather than all of them.I would also advise you not to use port 22 for your SSH server as you will most probably start receiving dictionary attacks as your public IP starts refusing random SSH connections from the web. – danielcraigie – 2013-06-05T16:14:25.457
@danielcraigie when connecting through external IP I get error msg ssh: connect to host 117.xxx.xxx.xx port 22: Connection refused. how to resolve this. I am sure port forwarding on router is done correctly. – shakthydoss – 2013-06-09T10:52:20.700
I'm assuming your trying to connect from the internet, this kind of message indicates that the ssh requests are being denied by the computer. A number of routine checks include: testing that the ssh server is running-> ps aux | grep [s]shd
- you should see something similar to /usr/sbin/sshd on a line; check that sshd is listening to it's port-> netstat -l
- (lists listening sockets) check that the sshd port is listed; then check your firewall config - sudo iptables -L
- (lists all rules and chains) if your firewall is active make sure that the input chain has a rule for ssh connections. – danielcraigie – 2013-06-09T12:10:58.290
2
There are three options I am aware of
You can set up port forwarding for each device you want to be be able to connect to externally.
For each device you could assign an arbitrary external port that forwards to that device on port 22. (Or you can do this for one device, and then connect to the others through it)
Were you to make a VPN with your local network, and then connect to said VPN, it would give you access to everything on on the network.
With reverse SSH you make use of an external server, and set up a listening ssh session. Then, on the external server you can connect to the device behind the router without being bothered by firewalls/port forwarding/etc... This is what I prefer (as I haven't set up a VPN yet), but I have access to an external server.
You could do this with:
Device on home network ssh -f -N -R 1234:localhost:22 remote_user@remote.server.example
1234
is the port that remote would use forward to the deviceremote.server.example
is the remote's addressThen, on the remote server ssh -p 1234 -t device_user@localhost
Any example of doing reverse ssh. If I create a droplet in digital ocean, can I use the reverse ssh to get in to my lan? – Mian Asbat Ahmad – 2018-03-20T10:56:34.657
2
Please do be careful about doing this from your work. IT security may not like it. Be very careful that it is within the company policy.
To quote Page 83 of Michael Lucas's SSH Mastery, https://www.tiltedwindmillpress.com/ $9.99
Suppose my desktop is inside a high-security network, however. The firewall tightly restricts Web browsing and blocks all file transfers. If I can use SSH to connect to a server outside the network, I could forward my desktop's traffic to that outside server to get unrestricted access to the Internet. I could upload confidential documents over SSH, and the firewall logs would show only that I made an SSH connection.
Tunnels versus Security Policy
If you're an organization's security officer, port forwarding might make you consider entirely blocking SSH. I understand. I've had your job. You should also know that a recalcitrant user can tunnel SSH inside DNS, HTTP, or almost any other service or protocol. The only way to absolutely block SSH is to deny all TCP or UDP connections from the inside of your network to the outside world, use a Web proxy that intelligently inspects traffic, and not allow your clients access to public DNS even through a proxy.
What you are trying is probably possible. Most company firewalls leave port 80 open as well as other ports. At the command prompt in Windows do netstat -n
and you'll get a list of internal addresses with open ports e.g.
Active Connections
Proto Local Address Foreign Address State
TCP 10.96.144.75:49242 10.96.144.4:445 ESTABLISHED
:
:
You'll need a router that supports
port forwarding
and a way to know your home IP (various services exist like dynamic DNS ). All you need to do is have your SSH server running on your home system, forward port22
to the hostname/ IP of the home machine and you should be set. – nerdwaller – 2013-06-05T01:00:03.583@nerdwaller : That means installing openssl-server and #service ssh start will be enough. And then I can connect to home pc using putty with my linux ip address at port number 22. Please confirm. – shakthydoss – 2013-06-05T01:15:37.423
1No, you need to port forward port 22 on your router to the Linux box's IP. Then connect to port 22 on your home's IP address. – nerdwaller – 2013-06-05T01:20:55.000
@nerdwaller I have successfully done the Port Forwarding Configuration in router to my internal IP with port number 22. I am able to connect remote machine in LAN but i am not able to connect in the same way outside of my network. – shakthydoss – 2013-06-09T09:57:48.740
Some service providers block some of the standard ports incoming. I would try a port scanner to verify the from the outside, the port is open. I'm pretty sure there are websites that can check which ports are open, though I am not sure of any specifically to give you. – nerdwaller – 2013-06-09T14:34:40.787