StackScripts icon indicating copy to clipboard operation
StackScripts copied to clipboard

can only ssh into instance once or in first few minutes after boot

Open robert-osborne opened this issue 13 years ago • 3 comments

I'm having this weird problem were I get locked out of the instance after a few minutes with:

Permission denied (publickey).

This happens with either password or keys configured. This looks like exactly the setup I need but ssh going away is a deal breaker :-)

robert-osborne avatar Jan 15 '13 21:01 robert-osborne

This is strange. Do you receive any monit alerts or email messages with logcheck error reports (scan is performed every full hour)?

You should be able to obtain emergency access to the instance using Remote Access/Ajax Console from the Linode admin panel. Are there any entries in the following locations that may indicate a problem?

  • /var/log/auth.log
  • /var/log/fail2ban.log
  • /root/stackscript.log

nigma avatar Jan 15 '13 21:01 nigma

I agree, very strange. Once I'm locked out I can't get in via the console either.

I checked your code; clean and nothing odd that I can see. I can give it one more shot and see if I can stay logged in and see what to those files.

robert-osborne avatar Jan 15 '13 21:01 robert-osborne

Ok. I think I see what is happening. The user ssh registration stuff is happening 10 or more minutes after the boot "finishes" according to Linode. If I wait until that time (ie. until I get the event notification) then sshd gets restarted and I can login with my ssh key. What might be happening is that logging in via password or lish console before that time frame can cause "bad things" to happen.

Is it possible to run the ssh configuration first thing in the process? This might reduce the race condition.

robert-osborne avatar Jan 15 '13 22:01 robert-osborne