Getting the webserver, remote login to START when my computer restarts....

Posted:
in macOS edited January 2014
I have a login screen where you have to enter your password before logging on.



The problem is when the power goes out and my computer boots back up, I can't access it via ssh/sftp/html.



Without having the login screen disabled, my sis-in-law lives with me and she would reek havoc on a metal block, I don't want to chance her screwing something up so how can I have my services start up and be protected immediately upon rebooting?



Make sense?



Eric

Comments

  • Reply 1 of 18
    xoolxool Posts: 2,460member
    If services are checked in the Sharing Preference Pane, they should automatically turn on when the system reboots. This is true if you stop at the login screen or have auto-login setup.



    Am I missing something?
  • Reply 2 of 18
    They should all be there. That's what all the things that go quickly in the startup screen are doing. I can't think of any reason why you won't be able to access them when the system is waiting for login.
  • Reply 3 of 18
    aplnubaplnub Posts: 2,605member
    This morning I could not get my webpage to come up and I could not log in via SSH.



    I am going to give it another shot right now since I am not at home and see if I can get in. If not, I will be back and post an update.



    PS once I log in to my account, everything works perfect. Go figure.



    Eric





    UPDATE: I can't reach my web server or use SFTP or ssh in. I called home and my computer is at the log in screen.



    Update 2: I called back home and the second my wife logged on to my account my webpage came up and my sftp connection fired up perfectly.



    Any thoughts?



    Thanks!!



    Eric
  • Reply 4 of 18
    aplnubaplnub Posts: 2,605member
    I am back home and the same thing still happens. Unless I log into my account on my iMac, my website won't load and SFTP is not availible via my ibook.







    However, if I log out of my account, everything continues to work just fine even though it is at the login screen and I am totally logged out.



    Am I missing a setting?



    Eric
  • Reply 5 of 18
    Open up your /etc/hostconfig file, the webserver line should say "WEBSERVER=-YES-". If it says no, make a backup of the file and try changing it to yes and reboot. Though that only controls the webserver.



    I did some looking around and it seems that the ftp and ssh files in /etc/xinetd.d/ might control ftp and ssh, I tried turning on and off ftp and ssh in System Prefs, and in each file it should say "disable = no" if a particular service is on. Maybe someone who knows more about this can elaborate if killing and restarting xinetd is a safe idea.
  • Reply 6 of 18
    aplnubaplnub Posts: 2,605member
    Thanks. I will wait for another opinion like you suggested since I am new to Apple and don't know about deleteing important sounding stuff.



    I appreciate your response and willingness to help me out.



    Anyone ever seen this before or is this common on the Mac for the services not to start until you log in?



    Maybe this needs to be moved to the genius bar?



    eric
  • Reply 7 of 18
    Forgive me here because I think I know what I am talking about, but I am not sure. I think the reason is because on OS X client these services aren't set to run as daemons? On OS X Server, these services start automatically on power up.
  • Reply 8 of 18
    Those services definitely startup correctly on the client version. They start up during the 'Welcome to Macintosh' progress bar screen, when it quickly flashed "Starting Apache WebServer" and whatever other services you have running.



    aplnub: Did you check the hostconfig file? Even if you don't feel comfortable making changes to it, still check it out and see what it says.
  • Reply 9 of 18
    aplnubaplnub Posts: 2,605member
    Sorry, I have been looking for it but I can't find it or the folder. Is it hidden?



    Update: Thanks to the terminal...



    ##

    # /etc/hostconfig

    ##

    # This file is maintained by the system control panels

    ##



    # Network configuration

    HOSTNAME=-AUTOMATIC-

    ROUTER=-AUTOMATIC-



    # Services

    AFPSERVER=-YES-

    AUTHSERVER=-NO-

    AUTOMOUNT=-YES-

    CUPS=-YES-

    IPFORWARDING=-NO-

    IPV6=-YES-

    MAILSERVER=-YES-

    NETINFOSERVER=-AUTOMATIC-

    NFSLOCKS=-AUTOMATIC-

    NISDOMAIN=-NO-

    RPCSERVER=-AUTOMATIC-

    TIMESYNC=-YES-

    QTSSERVER=-NO-

    WEBSERVER=-YES-

    SMBSERVER=-NO-

    DNSSERVER=-NO-

    COREDUMPS=-NO-

    VPNSERVER=-NO-











    Eric
  • Reply 10 of 18
    aslan^aslan^ Posts: 599member
    I encountered the same issue the other day... I suspect it has to do with OS X not starting any particular service until a user logs in that has that service enabled. After that if I log out, ssh works when the computer shows a log in screen... so the service is still running.



    I personally overcame this by just enabling automatic login of my account. You specified you didnt want to do this... you could create a pretty restrictive user account and set it to automatic login, just for the purpose of getting ssh started. This would be a temporary solution until you can figure out if its possible to get sshd started without logging in.
  • Reply 11 of 18
    Quote:

    Originally posted by AsLan^

    I encountered the same issue the other day... I suspect it has to do with OS X not starting any particular service until a user logs in that has that service enabled.



    This is probably a security feature.
  • Reply 12 of 18
    aslan^aslan^ Posts: 599member
    Okay heres something interesting... do you connect to your home network with airport or ethernet ?



    When I disabled airport and connected via ethernet, set the startup option to default to a log in screen (as opposed to the auto login) and restarted the computer... I was able to ssh and vnc in to the computer (sorry I forgot to check httpd but I assume it would have worked).



    Then I unplugged ethernet and reconnected with airport and reset. After it came up to the login screen I couldnt even ping it... it hadnt yet connected to the network. After logging in it immediately connected to the network and I was able to access the services.
  • Reply 13 of 18
    aplnubaplnub Posts: 2,605member
    I connect via Airport to my network. Now that is weird! I will do the same test on mine when I get back today and see if the cable makes a difference. I have a outlet next to my computer and I guess I will plug it in for the time being. I was just trying to get away from one more cable (the iMac is most impressive with as few cables as possible ).



    Anyone want to guess why it won't with airport but will with a cable?



    Also, yes, I have thought about making a totally restricted account to auto log in until I get this figured out. Thanks for the advice.

    Thank you!!!



    Update: Using the ethernet cable works at the login screen. Why won't Airport? Do you think Tiger will be any different?



    Eric
  • Reply 14 of 18
    aslan^aslan^ Posts: 599member
    Yeah I couldnt figure it out... I had a poke around to see if there were any startup scripts that indicated that en0 should be started automatically and en1 (airport) not to be. To tell you the truth Im not familiar with the inner workings of OS X so I came up empty.



    If anyone else who knows a bit more about the startup process involved with OS X, I would be interested to know if we could automatically start the airport without logging in.
  • Reply 15 of 18
    rraburrabu Posts: 264member
    It doesn't work with Airport because it can't connect to the wireless network until somebody logs in. Wireless networks often require passwords to connect while ethernet doesn't.



    You see, when you log in, the computer automatically connects to the latest/preferred wireless network and fetches the password used from your keychain. Before you log in (providing a password to unlock your keychain), the keychain is locked and the wireless password can not be retrieved.



    To test this, you could open up the keychain application (in the utilities folder) and change your keychain to not automatically unlock. Then when you log in, the system should ask you for a password to unlock your keychain before connecting to the network.



    Similarly, other users must have the password to the wireless netword stored in their keychains as well. Try creating a new user, restarting the computer, then logging in as the new user. I suspect, there would be no network unless you punch in the password or first log in with a user that can connect.



    One solution may be to store the password to the wireless network in the Network preference pane. You can choose to always join a specific network and I believe you can set the password there. Then, I would hope it would connect. However, I haven't tested this out myself.
  • Reply 16 of 18
    aplnubaplnub Posts: 2,605member
    I have no passwords on my wireless network. I filter out by Mac addresses only.



    Eric
  • Reply 17 of 18
    aslan^aslan^ Posts: 599member
    Yeah, I dont use passwords on my network either... any other thoughts ?
  • Reply 18 of 18
    aplnubaplnub Posts: 2,605member
    I changed my location from Automatic to "Home" and set everything up. This did NOT work.



    It appears the wireless network will not start until someone logs on. Bummer.



    The wire is in the computer since this feature is a must for me.



    Eric
Sign In or Register to comment.