Go Back   The macosxhints Forums > OS X Help Requests > Networking



Reply
 
Thread Tools Rate Thread Display Modes
Old 07-05-2004, 05:34 PM   #1
Daily
Prospect
 
Join Date: Mar 2004
Posts: 39
ssh connection timing out

Hiya Guys and Gals, I hope somebody can help me here.

Configuration
Mac OS 10.3.4 (all updates up to 05/July/04) PB 17in 1.33Ghz Airport Extreme

Apple Wireless Router connected to: Linux Box (RedHat 9) which connects to the internet and runs as a mailserver.

Problem
All I want to do is connect to the Linux box via a ssh session and copy the logs accross to my Powerbook. (I should note that I have limited experience with networking and unix, but am a quick learner) basically I am attempting to achieve my goal like this:


Code:
Last login: Mon Jul  5 22:07:40 on ttyp1
Welcome to Darwin!
mypowerbook:~ daily$ ssh root@192.168.0.2
root@192.168.0.2's password: 
Last login: Mon Jul  5 22:13:18 2004 from 192.168.3.119
[root@linuxbox root]# cd /var/log
[root@linuxbox log]# scp 10.0.1.2:boot.log .
ssh: connect to host 10.0.1.2 port 22: Connection timed out
First thing I did was check that I had enabled "Remote Login" From what I can gather this is what port 22 is used for. It is enabled. It is not blocked in the "Firewall" pref pane. I did notice that the "last login was "from 192.168.3.119" and The IP address that I have been allocated (by the base station I guess) is 10.0.1.2. I checked the network pref pane and it says that people should be able to get me on 10.0.1.2. The next thing I tried was sending the "boot.log" to 192.168.3.119 (thats who/where the linuxbox thinks I am) this time theres no mincing around I just get:

Code:
ssh: connect to host 192.168.3.119 port 22: Connection refused
Now for all I know, I could be doing all this wrong from the start, the reason I am posting here is that I have exhausted areas to research (try googling for "port 22: Connection timed out" USELESS, I've read all the "man" pages for the commands that I am using, and Ive read a huge number of web pages on, networking, unix, ssh etc... .. . I am at a loss! maybe someone here can point me in a new direction, or even suggest a fix? or why it might time out? One thing I did read about was re-mapping port 20 or 22 or something to that effect, in the base station utility, I did look at that but really have no idea what the hell I would be doing with public and private IP's, and I have a feeling this is only if I want to access the machines from outside the network, anyway enough rambling... .. . can anyone help?
__________________
When the going got wierd, I turned pro
Daily is offline   Reply With Quote
Old 07-06-2004, 05:22 AM   #2
stetner
MVP
 
Join Date: Jan 2002
Location: Brisbane, Australia
Posts: 1,108
Two ways around this, the easy way:

From the box you are starting from (assuming the remote box allows scp),

The real way (ie to allow ssh into the box you are starting from), is to determine if the ssh daemon (or xinetd) is listening on port 22:
Code:
$ netstat -na | grep 22
tcp4       0      0  *.22                   *.*                    LISTEN
I don't think you will see a 'LISTEN' there, but show us what you see and we can go from there.
__________________
Douglas G. Stetner
UNIX Live Free Or Die

Last edited by stetner; 07-06-2004 at 05:23 AM. Reason: fix typo
stetner is offline   Reply With Quote
Old 07-06-2004, 06:12 AM   #3
Daily
Prospect
 
Join Date: Mar 2004
Posts: 39
Thankyou for your input, it is very much appreciated, I have to admit im not entirely sure what this output means, I will check the man pages (netstat, grep etc ) and try to hazard a guess, let me know what you think.


Code:
Last login: Tue Jul  6 01:32:32 on console
Welcome to Darwin!
mypowerbook:~ daily$ netstat -na | grep 22
tcp46      0      0  *.22                   *.*                    LISTEN
udp4       0      0  127.0.0.1.49157        127.0.0.1.1022         
udp4       0      0  127.0.0.1.49156        127.0.0.1.1022         
udp4       0      0  127.0.0.1.1022         *.*
__________________
When the going got wierd, I turned pro
Daily is offline   Reply With Quote
Old 07-06-2004, 06:31 AM   #4
stetner
MVP
 
Join Date: Jan 2002
Location: Brisbane, Australia
Posts: 1,108
Well, that shows that you have something listening on port 22 on your machine (the first line).

The next step is to find out why it is not connecting. Is there a router that will not allow an outbound connection from the other machine to yours? (I notice that the remote is 192.x.x.x and you are 10.x.x.x, so I assume there is some routing going on there....

Have you tried the 'scp' from your machine to the remote?
__________________
Douglas G. Stetner
UNIX Live Free Or Die
stetner is offline   Reply With Quote
Old 07-06-2004, 06:57 AM   #5
Daily
Prospect
 
Join Date: Mar 2004
Posts: 39
many thanks stetner you are the don!

I copied your line of code

And it worked perfectly! The only reason I was doing it the other way, is because im not really that confident, when it comes to what files should be where, so I always 'cd' 'ls' I guess where I was going wrong was that when I was trying 'scp' I wasn't specifying the full path, I figured that since I had 'cd' to the directory my file was in then I would only have to type the name of the file, am I correct in thinking this is not the way it works? and from what I can gather from the man pages on 'netstat' and 'grep' all is fine on the 'ssh' front except I get 'tcp46' and your output says 'tcp4' is this normal?

Whilst im here, thought id just ask a couple of quick questions,

'scp' now that I know it works, is that the best way to go about my business? I can't 'ftp' in, and my understanding of 'telnet' is that its kind of old and dead, and not that secure.

What would I need to type if I wanted to copy an entire directory and its contents?

And when I want to read the logs in the terminal instead of copying them accross, I have been using 'cat' or 'more' they both appear to do the same thing but 'more' gives me a little percentage dooby which I like.

Just thought Id ask your opinion on those short points, there are always better ways of doing things.

Thanks for your help.

+daily
__________________
When the going got wierd, I turned pro
Daily is offline   Reply With Quote
Old 07-06-2004, 07:18 AM   #6
Daily
Prospect
 
Join Date: Mar 2004
Posts: 39
Ok, I now know what I was doing wrong, I was sshing in to the remote box, and then when I was 'scp'ing I was specifying my IP address 10.x.x.x because I thought that something somewhere needed to know my address, so that it knew where to send to, what I didn't know, is that this is what the '.' on the end does, thats my "working directory" sorry for being such a lame ass, but until a couple of days ago, I had never really ever used the terminal. My reason for getting stuck in, is that Im a design student, and spend allot of time remotely logging in to various computers and shifting / copying large amounts of files around, I always use the finder, but its so slow and klunky when I remotely log in to other computers, but the terminal feels sharp and responsive, and its the only way I know of communicating with Linux remotely. It may be a bit of a steep learning curve but im sure it will benefit my productivity when I get the hang of things.

+daily
__________________
When the going got wierd, I turned pro
Daily is offline   Reply With Quote
Old 07-07-2004, 08:41 AM   #7
stetner
MVP
 
Join Date: Jan 2002
Location: Brisbane, Australia
Posts: 1,108
Quote:
Originally Posted by Daily
where I was going wrong was that when I was trying 'scp' I wasn't specifying the full path, I figured that since I had 'cd' to the directory my file was in then I would only have to type the name of the file, am I correct in thinking this is not the way it works?

No, if you were able to scp from the remote host to your mac, that would have worked fine, and placed the file in your home dir.

Quote:
I get 'tcp46' and your output says 'tcp4' is this normal?

This is because I have turned off my IPv6 protocol, so mine is listening on IPv4 while yours is listening on IPv4 and IPv6.


Quote:
'scp' now that I know it works, is that the best way to go about my business? I can't 'ftp' in, and my understanding of 'telnet' is that its kind of old and dead, and not that secure.

Yes, if you can use ssh and scp that is better (more secure) than using telnet and ftp. You can get GUI front-ends for scp like Fugu.

Quote:
What would I need to type if I wanted to copy an entire directory and its contents?

I would use tar to create a single file and scp that, or the GUI front ends can do whole directory structures I think...

Quote:
And when I want to read the logs in the terminal instead of copying them accross, I have been using 'cat' or 'more' they both appear to do the same thing but 'more' gives me a little percentage dooby which I like.

Yep, I would use more (or less) or cat if the log is not to big.
__________________
Douglas G. Stetner
UNIX Live Free Or Die
stetner is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 04:27 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.