Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I successfully used

ssh -q -i pubkey root@192.168.200.122 'halt'

for years now to halt a FreeBSD system (FreeNAS) from a linux box.

Suddenly, from out of nothing this stopped working: ssh hangs forever with this command. Since this is used in a backup script this is a desaster.

What could have happened that this suddenly happens? Is the problem more likely on the server side (FreeBSD) or client (Linux). How can I fix it (on the client side)?

share|improve this question
    
What has changes on the server / client side when it stopped working? –  mpy Jul 2 at 16:25
    
Nothing that I know ;-) Otherwise I would have reverted it and tried ... –  divB Jul 2 at 17:40
    
Try running ssh without the -q flag. –  Roland Smith Jul 6 at 13:00

2 Answers 2

up vote 0 down vote accepted

Check your SSH client config. TCPKeepAlive should not be set to no for the client.

share|improve this answer

Have you tried to ssh in manually?

ssh -i pubkey root@192.168.200.122

My only guess is for whatever reason the client's known_hosts got changed, deleted, etc. Or the entry in it doesn't match anymore which is possible. If openssl got changed (upgraded?) on the server side, then the known_hosts entry won't match.

And so when you ssh, even with a pubkey, you will get this if the known_hosts doesn't exist:

The authenticity of host '192.168.200.122 (192.168.200.122)' can't be established. RSA key fingerprint is fa:7c:54:45:70:c2:70:f9:f2:3c:c9:75:4d:83:10:5b. Are you sure you want to continue connecting (yes/no)?

And so it is waiting for you to accept

Or you will get this if it doesn't match

test:~/.ssh # ssh 192.168.200.122 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is fa:7c:54:45:70:c2:70:f9:f2:3c:c9:75:4d:83:10:5b. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending key in /root/.ssh/known_hosts:1 RSA host key for 192.168.200.122 has changed and you have requested strict checking. Host key verification failed. test:~/.ssh #

So try it manually. If it doesn't exist, you will need to accept it and then the known_hosts entry will be created and then the next time you ssh it should be fine

If it doesn't match, then edit your ~/.ssh/known_hosts and delete the entry for that host. Then when you ssh in again manually, accept it and recreate the known_hosts entry.

Only thing I can think of off the top of my head. Hope that's it!

share|improve this answer
    
Unfortunately not. It also happens when I do it manually. I even can't kill the SSH session then with CTRL+C. I can only use CTRL+K in my screen session to kill the complete window. And login etc. is definitely successful. I can successfully issue the 'halt' command. So it seems the machine is indeed halted (I can't really verify because it's a remote box) but there is no timeout for SSH or so... –  divB Jul 2 at 21:50
    
So the machine is halting but you want your ssh session to exit? That's interesting. I would think that all along it might do this. Are you okay with running halt in the background? Maybe I misunderstand the issue. So the command you run is 'halt &' ? –  ben Jul 2 at 22:23
    
I just want to halt the system via SSH, yes. (and it always worked so far). Sure, running in background would be find but '&' doesn't help I think because it receives a HUP anyway. –  divB Jul 3 at 1:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.