If you’ve been tinkering around with your Apple TV 4 jailbroken on tvOS 10 with liberTV, you may have noticed that its built-in SSH client, Dropbear, has a tendency to be purged every so often, requiring it be re-spawned and set up again. This is due to the developer’s (admirable) desire to retain all jailbreak-related files in temporary folders on the filesystem, reducing the risk of bricking your device while fiddling with it to near-zero. If you are confident enough to move a few files out of their temporary folder however, you can easily get your SSH client up and running persistently, avoiding those tedious reconfigurations which otherwise occur.

Before beginning, read through the guide so you understand what we’re doing, including my concluding remarks beneath Step 17. Whilst this process should be very safe, exercise caution and common sense, and do not overwrite any pre-existing files which you obviously did not put there yourself.

How to make Dropbear persistent

1) Ensure that your Apple TV 4 is in a jailbroken state via liberTV. My guide will show you how to do this.

2) Connect to your Apple TV via SSH, and make sure you have changed your default passwords. My guide will show you how to do this.

3) Open up an SSH session to your Apple TV as detailed in the guide linked in Step 2, and issue the following command:

export PATH=/tmp/bin:/tmp/usr/bin:/tmp/usr/local/bin:/tmp/sbin

4) Now type the following commands one at a time (each line is a command to be entered separately):

cd /

5) We have moved to the root of the file system and listed the folders there. Check that you have a folder called tmp; this is where our Dropbear files are. Now enter the following:

cd tmp

6) Look for a folder entitled etc, and if present, cd into it:

cd etc

7) Now look for a folder in etc entitled dropbear. If present, cd into it:

cd dropbear

We should see the Dropbear files we are interested in listed here. In my case there was only one, dropbear_ecdsa_host_key, though you may have others. Verify that you can see them in this folder, which is /tmp/etc/dropbear/. If you can’t, make sure you are in the correct folder. You can return to the root at any time and start again with cd /, followed by ls, if necessary. If you can’t find them or are in the wrong directory the process won’t work, which is why we need to visually verify them before we continue.

If they’re there, we can now proceed to make a new home for them on the permanent filesystem, and copy them out of the precarious temporary folder they began in.

Do this at your own risk! Whilst this should be perfectly safe, I will not be held responsible for human error. If you overwrite any existing system binaries, you will be forced to restore your Apple TV, so copy only the items listed here, and ensure they do not already exist at their destination first.

8) Type the following to move away from our verified Dropbear files in tmp, and move to the location we want to copy them to:

cd /etc

You should now see the contents of the system’s etc folder.

9) We want to make a folder here in etc called dropbear, which we do with the following command:

mkdir ./dropbear

Type ls again afterwards, and verify that the contents of etc are as before, except for the addition of the new dropbear folder we just created.

10) If all the contents are still there, plus our new dropbear folder, issue the following command to copy our Dropbear files from /tmp/etc/dropbear to their new location at /etc/dropbear:

mv /tmp/etc/dropbear/* ... /etc/dropbear/

My system reported a “No such file or directory” error here, but worked regardless.

11) Check the copy has been successful by typing cd dropbear, followed by ls, and making sure our file(s) (dropbear_ecdsa_host_key and any others you saw in Step 7), are present.

We have now successfully moved the contents of /tmp/etc/dropbear to /etc/dropbear, where they will not be removed by the system.

We must now move a second group of files in the same way, from /tmp/usr/local/bin to /usr/local/bin.

12) Type the following to move to /tmp/usr/local/bin, and check its contents are there, ready for copying:

cd /tmp/usr/local/bin

You should see a collection of Dropbear-related files, I had eight in total. If they’re not there, ensure you are in the right directory. If you cannot find them in the correct directory then the process will not work.

13) Once you’ve verified the files we want are there, let’s move to where we want to move them to, by typing:

cd /usr

Check the list of contents and ensure that there isn’t already a folder there called local. If there is, don’t overwrite it. In my case (and yours too), there shouldn’t be a local folder there initially.

14) Let’s create a local folder in usr:

mkdir ./local

Verify that the contents of usr are as before, except for the addition of the new local folder we just created.

15) If local has been successfully created, cd into it and create a folder inside it called bin, like so:

cd local
mkdir ./bin

Check that our bin folder is now listed under the ls command we just sent.

16) If bin is listed, then we’ve successfully created the folder structure /usr/local/bin, and are ready to copy our files into it from /tmp/usr/local/bin. We can do it with the following command:

mv /tmp/usr/local/bin/* ... /usr/local/bin/

As in Step 10, my system reported a “No such file or directory” error here, but worked regardless.

17) To check the copy has been successful, type cd bin, followed by ls, and make sure our files (dropbearconvert, dropbearkey, and all the others you saw in Step 12, of which I had eight), are present.

If they are, then we’re all done! We’ve moved all the Dropbear-related files from /tmp, where they are periodically wiped, onto the filesystem, where they’ll be persistent. Specifically, we moved the contents of /tmp/etc/dropbear to /etc/dropbear, and the contents of /tmp/usr/local/bin to /usr/local/bin.

You can now invoke SSH via Dropbear any time your Apple TV 4 is in a jailbroken state with liberTV, without worrying about SSH having been wiped and requiring another setup. Remember, to use any of the commands you’re used to, such as cdpasswd, or ls, you’ll need to issue the command below once per Terminal SSH session first, or they won’t be available:

export PATH=/tmp/bin:/tmp/usr/bin:/tmp/usr/local/bin:/tmp/sbin

Good luck!

Do not overwrite ANY system binaries. If at any point in this guide you find an already existing version of a file on the Apple TV filesystem, do NOT overwrite it with the version from /tmp. 

This should not happen, but double-check the contents of directories before copying into them, and always be sure where you currently are in the filesystem before issuing any commands from/to/in it.

Need any more help with this guide? Pleased to have a persistent SSH setup on your Apple TV 4 at last? Let me know your thoughts in the comments section…

  • Chris Mn
    • Joaquim Barbosa

      Think it’s a typo: try “mkdir ./dropbear” instead…

  • Tim White

    This worked for me, thanks! My ATV4 is using the libertv JB and each time it reboots, it needs to go through the JB again. Each time that happened, I would get error messages about it not being safe to connect via SSH because of known host issues… basically i’d need to delete the list of known hosts on my computer each time to fix the problem which got annoying because i’d need to make invisible files visible and then switch it back when i was done…. this fixed it great!

    It is annoying that the JB needs to be re-activated each time the ATV4 reboots… I wonder if this same concept could be applied to the JB so that it stays permanent (and doesn’t disappear on reboot)?

    I also have Kodi sideloaded on there which will apparently need to be reinstalled in 1 week after Apple revokes the certificate…. again, I wonder if this same concept could be applied so that these installs/modifications remain permanently…?

  • Tim White

    export PATH=/tmp/bin:/tmp/usr/bin:/tmp/usr/local/bin:/tmp/sbin

    that command is a neat little trick (for someone who knows nothing about what these commands are actually doing it just seems like kind of magic when they work all of a sudden…

    I’m trying to figure out how to add Kodi to my ATV4 without sideloading it via impactor and this command made it so i could use wget. now i need to find out how to extract and install the things i downlod (like the kodi .deb file) … the commands that most sites instruct you to use don’t work on my ATV4 and i can’t figure out how to “install” those either….