hang up logging via ssh on computer that never sleeps

I am using ssh to connect my PBG4 at home with my iMac at work.
I have set the iMac so that it NEVER SLEEPS. after i have used the iMac
I am able to ssh into i when i return home. However, after some (?) length
of time, i no longer am able to log in. ssh never request password. Instead
it gets hung up, then times out.

why is this happening, if the iMac never sleeps. how can i prevent this from happening, or else enable login remotely?

thanks

stefanos

Posted on Oct 16, 2005 11:21 AM

Reply
10 replies

Oct 16, 2005 2:46 PM in response to Stefanos Folias

Hi Stefanos,
There is no way to diagnose a problem with no information but there is nothing of which I'm aware within the system that would cause secure shell login to quit. In fact it is never started until someone logs in. It's started by launchd and there's no chance that that quit.

Thus, it's my guess that the IP address of the PowerBook changes when the DHCP lease is renewed. Check the IP addresses before and after one of these events. You can do that from the command line with ifconfig or you can look in the network pane of System Preferences.
--
Gary
~~~~
A woman's place is in the house... and in the Senate.

Oct 16, 2005 3:20 PM in response to Gary Kerbaugh

Hi, okay maybe i didn't make it clear what the problem is.

first of all, i am only talking about logging in not ssh quitting.
basic information is that (1) if i have recently been using the computer,
while i am at work, say, then when i return home (to the power book)
and log in to the iMac at work, i have no problems. (2) say i log out of iMac at
work for a considerable amount of time. Then when i try to log into the iMac, in this case it does not prompt for password; instead it hangs, ultimately timing out.

now, initially i suspected that the problem was that it was due to the iMac sleeping. since, i have set it so that the computer NEVER sleeps, which has NOT resolved the problem.

thus i am curious what would prevent logging in if it is not that the computer is sleeping.

I hope this provides enough information, so begin to diagnose the problem.
thanks,

stefanos

Oct 16, 2005 4:18 PM in response to Stefanos Folias

Stefanos,
To diagnose if ssh is at fault do the following:
in Terminal:
cd /etc
sudo vi sshd_config

Then add the following lines to the sshd_config:
Syslogfacility LOCAL3
LogLevel DEBUG

then <ESC>:wq<ENTER>

Next

sudo vi /etc/syslog.conf

Then add the following line to syslog.conf
local3.* /var/log/sshd.log

then <ESC>:wq<ENTER>

Next:
sudo touch /var/log/sshd.log

Now reboot

IF you encouter the problem, look at the /var/log/sshd.log for info at the relevant time

ON questions, mail here

Oct 16, 2005 5:18 PM in response to Stefanos Folias

Hi Stefanos,
I appear to have mistaken the PowerBook for the iMac but it's still possible that the diagnosis applies to the iMac. Anyway, along the lines of what Jasper suggests, next time you can't login via ssh, try "ssh -vvv" and post the results. Also, try to ping the machine.
--
Gary
~~~~
..you could spend *all day* customizing the title bar.
Believe me. I speak from experience."
(By Matt Welsh)

Oct 16, 2005 6:10 PM in response to Gary Kerbaugh

okay, here are the results:

just for privacy reasons i will write HOST for the host name and IP for the ip address

ssh -vvv

OpenSSH_3.8.1p1, OpenSSL 0.9.7d 17 Mar 2004
debug1: Reading configuration data /Users/stefanosfolias/.ssh/config
debug2: ssh_connect: needpriv 0
debug1: Connecting to HOST [IP] port 22.
debug1: connect to address 1IP port 22: Operation timed out
ssh: connect to host HOST port 22: Operation timed out

two results for ping

ping from PB at home:
266 packets transmitted, 0 packets received, 100% packet loss

ping from another computer at school :
no answer from HOST

Oct 16, 2005 6:32 PM in response to Stefanos Folias

I have seen networks that 'forget' a machine that is inactive for a period of time.
Then when you go to work and use it the network 'remembers' it. The workaround I used in a similar case was to have the machine(e.g. iMac) periodically ping out (every 15 minutes?) to keep the connection active as far as the network was concerned. You can do this on a mac with the cron facility. Add a ping command to cron with the crontab -e command in a Terminal.
add a line such as:
0,15,30,45 * * * * /sbin/ping -c 10 www.apple.com >/dev/null 2>&1

Oct 16, 2005 7:24 PM in response to Stefanos Folias

Hi Stefanos,
Aha! I was basically right; the, ... uh, ... iMac (is it?) isn't there. It isn't responding to anything, even pings. Thus, the issue is with the network, not the computer itself. You haven't told us anything about the network but I would check the IP addresses.

I haven't encountered the kind of network to which Marcia refers but she certainly nailed the symptoms so I would naturally give her advice a try. Instead of pinging, you could simply leave your e-mail client running and set it to check e-mail every fifteen minutes.
--
Gary
~~~~
This is a test of the Emergency Broadcast System. If this
had been an actual emergency, do you really think we'd
stick around to tell you?

Oct 16, 2005 7:55 PM in response to Gary Kerbaugh

okay, thanks. i will talk to the network administrator about this some more.
but i do know that the iMac has a fixed IP address that will never change.
I use mac's Mail program to access my mail on the server at work. i leave it
running at all times and it checks mail every minute. this also doesn't resolve
the problem. i iwill give Marcia's advice a try as well.

just trying to nail this one down.

thanks!

stefanos

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

hang up logging via ssh on computer that never sleeps

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.