0

This question already has an answer here:

I've encountered a weird problem imo, and none of my co-workers have no idea why this keeps happening.

First of, I've built a little server machine for beta testing of my upcoming software & website. I installed Ubuntu Server 13.10 on the machine and openssh-server on it. The machine has only ethernet cable plugged in, no monitors or keyboards. My router uses a dhcp server but I have setuped a static ip for Server. I can remotely access it from public easily. I forwarded ssh port from my router. I did some changes to my website files and then I decided for some odd reason to reboot the server. After rebooting it, I cannot access it from public anymore. The server is currently at home and I'm away. But I managed to get physically to the server today. I plugged in a monitor to inspect in which state the server is. The server was on logon state. I checked is router working fine by connecting into wlan with my phone, and went to whatsmyipaddress.com. IP hadn't changed and connection was working. I didn't have keyboard nor my laptop with me to inspect it further. I assumed it was working because it had rebooted and internet connection was fine. When I finally made it to my laptop and tried to connect with putty it said "Network error: Connection refused". My lucky guess is that after every reboot I need to login physically on the server before ssh connections will work.

I googled and found about of autologin. Wouldn't that then be a security issue? I mean you could just make a ssh connection from every single machine with internet connection if you just happen to know the IP address, and then you could just mess everything up, am I right?

I need some suggestions what to do for this. I get to the server machine again tomorrow morning with laptop and keyboard this time so I can inspect it further. I hope you guys make up some suggestions what I should do about it. I must be able to reboot the server remotely, and then get back on it after reboot.

The best regards, Roope

marked as duplicate by user68186, BuZZ-dEE, Amith KK, belacqua, user117103 Mar 1 '14 at 19:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • My router uses a dhcp server setuped by myself. But I've setup a static ip for my Ubuntu Server ofcourse. That was the very first thing I did when the installation was done :-) Thanks for trying though! – Rob Feb 26 '14 at 21:37
  • OK. Please edit the original question with new information to keep the comments minimum for clarification. You shouldn't need to log in locally before using ssh. Another possibility is that when the server reboots it fails to connect to the router/Internet. When you get a chance, try to ssh from your laptop from within home network using the local IP of the server. If you can install an ssh software in your phone, try connecting when your phone is on home WiFi. Then turn off WiFi in phone and try connecting using phone's data. – user68186 Feb 26 '14 at 21:46
  • 1
    Thank you for your answer. I will try this tomorrow morning either with my phone or laptop. I also updated the original question with more information! – Rob Feb 26 '14 at 22:23
  • See another question about similar problem: askubuntu.com/questions/30080/… – user68186 Feb 26 '14 at 22:36
  • Good morning. I managed physically to get to server and noticed it still was in the same logon state. BUT! I read the log above and noticed it had just logout my user, and got stuck into root. Therefore ssh connection was not available. I used 'sudo reboot now' for rebooting. It said it failed restarting at some point but unfortunately I don't remember it. Although I have ssh connection now working fine. I restarted the machine then correctly and when it had fully rebooted and asked for my user's credentials, I was able to connect via ssh from public, without logging in physically. – Rob Feb 27 '14 at 7:34
1

Okay. First of I want to thank all who tried to help me. I post everything what I did here.

"I managed physically to get to the server this morning and noticed that it's still in the same state as yesterday. BUT! I read the log above and noticed it had just logout my user, and got stuck into root (aka single-user mode). Therefore ssh connection was not available. I used 'sudo reboot now' command for rebooting. It said it failed restarting at some point but unfortunately I don't remember which point it was. Although I have ssh connection now working fine. I restarted the machine then correctly and when it had fully rebooted and asked for my user's credentials, I was able to connect via ssh from public, without logging in physically.

TL;DR - The rebooting of server failed, and only logged my user out. Then server was on root mode (aka single-user mode) and had never actually rebooted. Although, when I pressed the power button and it rebooted, I was able to create a ssh session."

Now, I got again physically to the server and tried to reboot it via ssh first. I noticed it fails when it tries to kill all remaining processes. I said this to my friend and he suggested me to do only "sudo reboot", without the now-attribute. Well, this command rebooted server successfully and I was able to make ssh connection when it had rebooted. My friend was thinking that the now-attribute is not a real attribute for reboot command but he was wondering why it's not shown as invalid attribute then. Anyhow, a normal "sudo reboot" rebooted the server just fine. I'd like once again thank you all for helping me out. Cheers!

  • 2
    Indeed, now is not a valid argument for reboot. It seemed to be dropping you at run level 3. I noticed the shutdown now command does this as well. – Seth Feb 28 '14 at 4:37

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