RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Keep SSH enabled at EVERY boot

    Scheduled Pinned Locked Moved Help and Support
    ssh
    19 Posts 7 Posters 4.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      creativename
      last edited by

      Hello helpful people. I am enjoying my retropie very much in the last few weeks, but one thing I am NOT enjoying is walking up and downstairs everytime I want to remotely control and transfer files (retropie connected to TV downstairs, but usually when I'm wanting to transfer roms I'm upstairs on the computer). Laziness is a badge of honor to me, so mock away.

      Reading online I learned that, since 4.2, SSH is disabled by default. I know how to enable it via raspi-config, no trouble there.

      I also read that I could create a blank file "ssh" in /boot/ that would enable SSH on first boot. That worked fine and dandy....ONCE

      I was confused, because it seemed like things worked fine until I rebooted. Once again, no SSH, had to reenable via raspi-config. Added the "ssh" blank file to /boot/ and restarted, worked perfect. Move some ROMs, play a while, go to sleep.

      Next time I boot up, no SSH. I'm thinking what gives!. Lo and behold, after some more googling, I read this over at raspberrypi.org

      1. Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)
        For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter; it could contain text, or nothing at all.

      That "and the file is deleted" bit is what must be giving me trouble, right? I've googled to no avail in search of a solution to have SSH enabled at EVERY boot. I realize this change was made to enhance security. However, I've changed my SSH password from "raspberry" to something else. I'm on a personal network that is password protected and has MAC-address access control. I am reasonably confident that this is a safe thing to do.

      Now, does anyone know how to do it?

      Much obliged to ya!

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @creativename
        last edited by

        @creativename Enabling SSH should only be done once and it should stay enabled, no matter what method you use (raspi-config or adding the ssh file in /boot). If it doesn't stay enabled, then you have a problem with the OS. How did you installt he system ? Are you using the RetroPie provided image or did you install over Raspbian, or .. ?
        Check if the SSH is enabled, after you boot, with systemctl status ssh, it should say enabled.

        C 1 Reply Last reply Reply Quote 0
        • C
          creativename @mitu
          last edited by

          @mitu I downloaded the image from https://retropie.org.uk/download/ and copied it to a blank sd card via windiskimager

          ....

          i guess i'm glad to know that my experience is not the intended behavior...I for the life of me couldn't understand why a system would be designed in such a way...obvoiusly if i go through the trouble of adding a particularly named file to the /boot partition, I want it to stay there. i still do wonder...if RaspbianOS (which is the underlying os for retropie) is setup to delete that file everytime, then isn't THAT the problem? since I need that file there in order for SSH to be enabled at boot??....

          tia

          1 Reply Last reply Reply Quote 0
          • dankcushionsD
            dankcushions Global Moderator
            last edited by

            the deletion of the file is correct. it uses it to set SSH on and that setting should maintain between boots whether the file is there or not. something else going on here...

            C 2 Replies Last reply Reply Quote 0
            • C
              creativename @dankcushions
              last edited by

              @dankcushions said in Keep SSH enabled at EVERY boot:

              the deletion of the file is correct. it uses it to set SSH on and that setting should maintain between boots whether the file is there or not. something else going on here...

              ahh okay, gotcha...i was assuming that the "ssh" file was needed by Retropie but Raspbian kept deleting it...essentially an issue of conflicting goals of the two software sets... but your saying that Retropie/raspbian somehow "remembers" that the "ssh" file was once put there, and forever again keeps SSH server enabled?

              1 Reply Last reply Reply Quote 0
              • C
                creativename
                last edited by

                potentially dumb question incoming...

                would the fact that I typically shutdown the raspberry via EmulationStation and then unplug it and box it up have any impact here? is the problem the unplugging ie the loss of power to the board?

                i only ask because my (not scientific data-informed) memory has me thinking that sometimes SSH is still enabled after reboot, but most times its not. i shall do some testing and report back...

                BobHarrisB 1 Reply Last reply Reply Quote 0
                • BobHarrisB
                  BobHarris @creativename
                  last edited by

                  @creativename No you can unplug the Pi..it won't affect ssh settings.

                  Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

                  C 1 Reply Last reply Reply Quote 0
                  • C
                    creativename @BobHarris
                    last edited by

                    @bobharris dern, well thanks for the info...other suggestions?

                    BobHarrisB 1 Reply Last reply Reply Quote 0
                    • BobHarrisB
                      BobHarris @creativename
                      last edited by

                      @creativename said in Keep SSH enabled at EVERY boot:

                      Reading online I learned that, since 4.2, SSH is disabled by default. I know how to enable it via raspi-config, no trouble there.

                      I also read that I could create a blank file "ssh" in /boot/ that would enable SSH on first boot. That worked fine and dandy....ONCE

                      All I ever did was enable SSH in raspi-config and then it was enabled for as long as I didn't change this setting. Why did you create the blank file? Maybe that's where things went wrong for you?

                      Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

                      C ClydeC 2 Replies Last reply Reply Quote 0
                      • C
                        creativename @BobHarris
                        last edited by

                        @bobharris said in Keep SSH enabled at EVERY boot:

                        All I ever did was enable SSH in raspi-config and then it was enabled for as long as I didn't change this setting. Why did you create the blank file? Maybe that's where things went wrong for you?

                        Yes, I tried just changing the setting in raspi-config at first. That didn't seem to make the SSH server "stick" at each boot and reboot. That's when i went for the creating the ssh file approach

                        1 Reply Last reply Reply Quote 0
                        • ClydeC
                          Clyde @BobHarris
                          last edited by

                          @bobharris said in Keep SSH enabled at EVERY boot:

                          All I ever did was enable SSH in raspi-config and then it was enabled for as long as I didn't change this setting. Why did you create the blank file? Maybe that's where things went wrong for you?

                          It's one of the official ways to enable ssh in Retropie (and Raspbian), so it shouldn't cause this behaviour.

                          1 Reply Last reply Reply Quote 1
                          • C
                            creativename @dankcushions
                            last edited by

                            @dankcushions said in Keep SSH enabled at EVERY boot:

                            the deletion of the file is correct. it uses it to set SSH on and that setting should maintain between boots whether the file is there or not. something else going on here...

                            i think you must be right! i have the pi setup as 10.0.0.3 on dhcp reservations, and the Pi tells me it's IP is that one...i just tried to ping the address via windows10 machine, but get "destination host unreachable"

                            this, even thought the Pi is definitely connected to the network and it can, for example, download updates and ES themes

                            hmmmmmmmmmmmmmmmmm

                            1 Reply Last reply Reply Quote 0
                            • C
                              creativename
                              last edited by

                              update...unticked a "WMM" wifi multimedia setting and rebooted...now i am connected, can ping, can SSH

                              I do experience a 25% packet loss when pinging from my windows machine. idk if its odd or normal, but its always the 3rd ping that is dropped

                              1 Reply Last reply Reply Quote 0
                              • SanoS
                                Sano
                                last edited by

                                Firstof all, it seems more like a network issue than SSH disabled. You may verify SSH daemon status by systemctl status ssh.service, ps -ef | grep sshd or whatever method you prefer.
                                Second, a A class private network is quite overkill :)
                                Packet drops on a wired local network without routing should be extremely rare (at most).
                                Some points you may check :

                                • duplicate IP (would be a shame to choose same through 16 777 216 possibilities ;)
                                • more than one IP in the same subnet on the RPi (could your Wifi and your wired network be both configured ?)

                                Anyway, an ifconfig -aon the RPi and ipconfig /afrom your workstation could also help could help.

                                C 1 Reply Last reply Reply Quote 1
                                • C
                                  creativename @Sano
                                  last edited by

                                  @sano said in Keep SSH enabled at EVERY boot:

                                  Anyway, an ifconfig -aon the RPi and ipconfig /afrom your workstation could also help could help.

                                  ifconfig -a on the RPi gave me ...

                                  pi@retropie:~ $ ifconfig -a
                                  eth0 Link encap:Ethernet HWaddr b8:27:eb:22:98:a5
                                  inet6 addr: fe80::8c55:ae5a:faae:5db6/64 Scope:Link
                                  UP BROADCAST MULTICAST MTU:1500 Metric:1
                                  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                                  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                                  collisions:0 txqueuelen:1000
                                  RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

                                  lo Link encap:Local Loopback
                                  inet addr:127.0.0.1 Mask:255.0.0.0
                                  inet6 addr: ::1/128 Scope:Host
                                  UP LOOPBACK RUNNING MTU:65536 Metric:1
                                  RX packets:56 errors:0 dropped:0 overruns:0 frame:0
                                  TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
                                  collisions:0 txqueuelen:1
                                  RX bytes:3860 (3.7 KiB) TX bytes:3860 (3.7 KiB)

                                  wlan0 Link encap:Ethernet HWaddr b8:27:eb:77:cd:f0
                                  inet addr:10.0.0.3 Bcast:10.0.0.255 Mask:255.255.255.0
                                  inet6 addr: fe80::7de7:9a5d:d32c:a5b0/64 Scope:Link
                                  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
                                  RX packets:389706 errors:0 dropped:2 overruns:0 frame:0
                                  TX packets:282892 errors:0 dropped:0 overruns:0 carrier:0
                                  collisions:0 txqueuelen:1000
                                  RX bytes:563264644 (537.1 MiB) TX bytes:25512614 (24.3 MiB)

                                  ipconfig on the Win10 machine gave me...

                                  C:\Users****>ipconfig

                                  Windows IP Configuration

                                  Ethernet adapter Ethernet:

                                  Media State . . . . . . . . . . . : Media disconnected
                                  Connection-specific DNS Suffix . :

                                  Tunnel adapter Local Area Connection:

                                  Connection-specific DNS Suffix . :
                                  IPv6 Address. . . . . . . . . . . : fd2a:4e7f:9415:3a5a:4e96:1179:48a:4db2
                                  Link-local IPv6 Address . . . . . : fe80::7548:d707:e15d:4124%14
                                  Autoconfiguration IPv4 Address. . : 169.254.65.36
                                  Subnet Mask . . . . . . . . . . . : 255.255.0.0
                                  Default Gateway . . . . . . . . . :

                                  Wireless LAN adapter Wi-Fi:

                                  Connection-specific DNS Suffix . :
                                  Link-local IPv6 Address . . . . . : fe80::c877:9c5d:ed33:4f4%8
                                  IPv4 Address. . . . . . . . . . . : 10.0.0.2
                                  Subnet Mask . . . . . . . . . . . : 255.255.255.0
                                  Default Gateway . . . . . . . . . : 10.0.0.1

                                  Tunnel adapter iphttpsinterface:

                                  Connection-specific DNS Suffix . :
                                  IPv6 Address. . . . . . . . . . . : fd01:3ec5:6397:1000:51d:9bf5:5fbd:42d6
                                  Temporary IPv6 Address. . . . . . : fd01:3ec5:6397:1000:8862:8e26:e39f:cc0c
                                  Link-local IPv6 Address . . . . . : fe80::51d:9bf5:5fbd:42d6%10
                                  Default Gateway . . . . . . . . . :

                                  Tunnel adapter Local Area Connection* 3:

                                  Media State . . . . . . . . . . . : Media disconnected
                                  Connection-specific DNS Suffix . :

                                  i think you may be right about it being an issue with my network as opposed to it being a problem with the RPi...for example, I'm SSHing into right now. But i'm still experiencing some network connection issues with the RPi that i do not experience with other machines on my network...including SSH connectivity but also accessing samba shares

                                  SanoS 1 Reply Last reply Reply Quote 0
                                  • SanoS
                                    Sano @creativename
                                    last edited by

                                    @creativename
                                    Let's start by unplugging the ethernet cable fro the pi if you don't use it.
                                    Everything seems ok besides this.

                                    Don't rely on ssh or cifs to check network. Nothing says "it's good" as a ping without packet loss :)

                                    Regarding your samba issue, IIRC it's a recent windows restriction that doesn't allow anonymous SMB access. So not the same issue (and not retropie fault IMHO).

                                    C 1 Reply Last reply Reply Quote 0
                                    • C
                                      creativename @Sano
                                      last edited by

                                      @sano no ethernet plugged in

                                      1 Reply Last reply Reply Quote 0
                                      • C
                                        creativename
                                        last edited by

                                        FYI for future seekers...

                                        I disabled "WMM" wifi media mode and rebooted. i am getting better overall connectivity with all my devices (previously i could connect to them but didn't always see the IP listed in router configs "attached devices" even though they had IPs), and this also seems to have stopped me from the frequent issue of not getting SSH access

                                        why did it work? not sure. but it works! maybe it was something else, but i would suggest giving it a try to people with similar probs. i don't know that WMM does much, since i haven't noticed any problems with other services since turning it off, such as netflix or streaming from my plex server

                                        1 Reply Last reply Reply Quote 0
                                        • G
                                          grant2258 Banned
                                          last edited by

                                          might not be related but when i shutdown and physically take the power off overnight. My wifi stops working i have to remove the usb dongal and put it in again for the system to work again. It doesnt do this everytime just most times it does. The thing is i have to shut my pie down because its in a bartop and there is no support to turn the monitor off just a screensaver that leaves the backlight on

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post

                                          Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                          Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.