PDA

View Full Version : [all variants] cannot ssh into my home computer



raac
September 12th, 2010, 02:00 AM
Hi guys, I would like to get help. I'm able to do
ssh localhost

and works

but if I try to access from somewhere else it does not work?

after the ssh command
it would say Connection time out, and it would not let me ssh

I'd appreciate suggestions and by the way I'm new with linux

Thanks

v1ad
September 12th, 2010, 02:06 AM
it would be your router.
ifconfig, and look at your ip. if it starts with 192.168.0.*

then your gateway will be: 192.168.0.1

if its 192.168.1.*

then your default gateway is 192.168.1.1

open a web browser and type in your default gateway.
log into your router, depends on router login varies,
and forward port 22 to your ip address.

raac
September 12th, 2010, 02:34 AM
Ok my IP address is
if its 192.168.1.*
then I typed 192.168.1.* into the web browser

Firefox can't establish a connection to the server at 192.168.1.*

I'm not sure how to do the next thing you said

" depends on router login varies,
and forward port 22 to your ip address."

Thanks for helping, I would appreciate a little bit more details

v1ad
September 12th, 2010, 03:03 AM
your default gateway would be 192.168.1.1 thats what you type into the web browser. once you log in you will have a control panel, it varies on the kind of router you have.

raac
September 12th, 2010, 03:11 AM
I tried that

Unable to connect







Firefox can't establish a connection to the server at 192.168.1.1.





* The site could be temporarily unavailable or too busy. Try again in a few
moments.

* If you are unable to load any pages, check your computer's network
connection.

* If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.

You want me to do that in the server or client computer?? I did that on both and got the same message from firefox..The thing is that one computer (server) has the ethernet cable and the client (laptop) has wireless connection from the same router

v1ad
September 12th, 2010, 03:13 AM
try 192.168.0.1

and if your ip starts with 192.168 you can go ahead and post it, its a local area network ip address, and we all have a similar one.

also go from the server, sometimes routers won't allow a wireless connection to log in.

v1ad
September 12th, 2010, 03:15 AM
ifconfig in the server. and use the servers ip when you are forwarding the port.

raac
September 12th, 2010, 03:29 AM
What exactly do u mean by "forwading the port" sorry if it's a silly question.

I did ifconfig in the server, and i'm using the displayed ip address as my host, E.G.

ifconfig
inet addr:ipAddress

so i'd say in my laptop(client)

ssh username@ipAddress

and that when it stands there doing nothing and then I get a connection timeout

v1ad
September 12th, 2010, 03:45 AM
well if you have a router on the server, the router has a firewall. and it blocks all those ports. ssh uses port 22, on the local area network it will work, on the web it won't. firewall blocks incoming connections.

you can login to the router through a web browser by typing in your default gateway. (server side not client). and through that way you connect to the routers control panel. in there you open port 22 for the servers ip address. if the servers ip address does not start with 192. then there is another issue. you do not type in the servers ip address but the routers.

v1ad
September 12th, 2010, 03:47 AM
the reason the router blocks ports is because it does not know to what computer to direct it to. also if from the web you would not type ssh username@192.168.*.* but go to ipchicken.com, get the ip address that is supplied to your router and use that.

v1ad
September 12th, 2010, 03:50 AM
your internet service provider provider gives you 1 IP, your Router uses it, then gives your computers in the house their own local IP address.

in the router control panel you tell it to send any information on port 22 to the servers local ip address.

to access it you ssh to the router and it forwards the information on that port to the server. thats why its called port forwarding.

raac
September 12th, 2010, 04:08 AM
ok, I got to the point where I have the router setting on the browser, but I don't know where to go to open the port, there are a lot of stuff that i don't know about this web page, but all I care about is opening port 22. I went to setting and firewall but is not there. Under settings, there is broadband, LAN firewall, logs. The thing is I don't want to change something that I'm not suppose to change and screw up the internet

Thanks

v1ad
September 12th, 2010, 04:17 AM
just find administration and port forwarding or anything about ports.

also what kind of router do you have. maybe ill find a tutorial.

raac
September 12th, 2010, 04:19 AM
it's a 2wire

v1ad
September 12th, 2010, 04:28 AM
http://www.cctvcamerapros.com/2-Wire-Port-Forwarding-Setup-s/221.htm
http://www.youtube.com/watch?v=KV0SBuc2sYw
http://www.dslreports.com/faq/14305

pick any1 .

CharlesA
September 12th, 2010, 04:31 AM
portforward.com

raac
September 12th, 2010, 04:46 AM
should i select tcp or udp if i plan to ssh ?

and for the port range, would it be from 22 to 22??

v1ad
September 12th, 2010, 05:10 AM
use both. and yes port range 22-22

raac
September 12th, 2010, 05:24 AM
Well they are radio buttons (either or), i can only select one

v1ad
September 12th, 2010, 05:25 AM
set up two. 1 udp, 1 tcp.

raac
September 12th, 2010, 05:48 AM
Oh man, it still would not let me ssh, it came out the same thing

ssh username@ipadress
ssh: connect to host ipaddress port22: connection time out

All this work for nothing, lol

v1ad
September 12th, 2010, 05:57 AM
ssh username@externalipaddress

specifying port not needed. the ipaddress is the 1 u get from ipchicken.

the local ip will never work.

http://www.ipchicken.com/

username@thatipaddress

also in the router i hope u specified the servers ip address not your own.

raac
September 12th, 2010, 06:08 AM
ssh username@externalipaddress

specifying port not needed. the ipaddress is the 1 u get from ipchicken.

the local ip will never work.

http://www.ipchicken.com/

username@thatipaddress

also in the router i hope u specified the servers ip address not your own.

I tried that (ip chicken), same problem, and yes i did specified the servers ip address when i open the ports. (which is also a computer)

Could there be other problem?

v1ad
September 12th, 2010, 06:18 AM
90% of the problems resolve in the router. question is, is from where are sshing from 2 your server. and the ipchicken is accessed from the servers local area network hopefully. what i do to test is ssh outside the network and then ssh back to the server from there. if you got noway to do that i can setup a temp username and password for you to do that off my server.

also another way is putting your server on DMZ what that does is bypasses all router firewalls. but its not recommended because it opens up your server to possible external attacks.

raac
September 12th, 2010, 06:37 AM
ok. i'll try that...thanks for your help though i learned a great deal of networking


thanks a lot

v1ad
September 12th, 2010, 08:44 AM
giving my best to help, Good luck.

Lateralis
September 12th, 2010, 10:41 AM
You may need to install an ssh server on your home computer in order to connect to it, if you do not have it installed already. Certainly, that's what I've had to do in every distribution of Ubuntu before I could ssh in.



sudo aptitude install openssh-server


There are then some optional configuration setps that you might (should) want to go through. The configuration file is /etc/ssh/sshd_config. First, make a copy of the file in case it all goes wrong:



sudo cp /etc/ssh/sshd_config ~/sshd_config.bak


Then you need to edit the file:



sudo gedit /etc/ssh/sshd_config


You will want to change the yes next to PermitRootLogin to a no. And then at the bottom of the file add "AllowUsers <your login name>". Save the file then restart the ssh server:



sudo /etc/init.d/ssh restart


You should now be able to ssh into your home computer, so long as your router now forwards connection requests sent over port 22 to your home computer.

v1ad
September 12th, 2010, 04:53 PM
technically you can get away by just doing:


sudo apt-get install ssh

but i'm pretty sure you already did that. since you can connect locally.

Lateralis
September 12th, 2010, 07:08 PM
A good point, I managed to conveniently miss. :P

Never mind then! *runs away*

rodgull
September 14th, 2010, 05:43 PM
Lateralis,

Part of your suggestion fixed my issue. Everything was going ok, then i installed some php extensions and ssh was broken. I set PermitRootLogin to no and added an AllowUsers directive and bingo it works!

Thanks heaps.

Rod

rodgull
September 14th, 2010, 05:45 PM
Actually wish I could vote for a post, as yours is really clear and helpful.

Rod

Lateralis
September 14th, 2010, 05:52 PM
Ah, excellent! Glad I was of some use (in a round about way!).