PEM Key location in Ubuntu Linux


New member
I am trying to set up Teensyduino on Ubuntu Linux 22.04 to program Teensy 4.1 lockable. I have previously generated the PEM key on a windows system and have gone through the steps to lock the Teensy device. I would like to program the lockable Teensy from Ubuntu using the already generated key. Where do I need to put the PEM key in Ubuntu Linux so that the Teensyduino software sees it? Are they any environmental variables that need to be set? I have tried putting it in ~/Arduino ~/.arduino15 and ~/.arduinoIDE but it does not seem to generate EHEX files when I compile.
It depends on contents of the preferences.txt file.

Simplest way is to run Arduino 1.8.19 with Teensyduino 1.58 installed. Then click Tools > Teensy 4 Security. It will show the full pathname where key.pem is expected.
As mentioned in the Code Security page:

Your key.pem file is stored in your "sketchbook" folder, which by default is {Documents}/Arduino. If you change the sketchbook location from File > Preferences, the Arduino IDE may need to be restarted before your key.pem file is used from the new location.

If you start up Arduino on your Ubuntu machine, and then use the file->preferences command,
the resulting dialog will show you your current Sketchbook Location,

Which on my Ubuntu 22,04 machine shows /home/kurte/Arduino
I have tried installing the Arduino IDE from the Ubuntu Snap store and downloading it directly from Arduino website. In both cases the preferences shows the current sketchbook location as /home/my_username/.arduino15 I have tried putting the PEM key there. It will not build ehex. I have installed the Teensyduino through the additional boards URL and then installing the Teensy boards version 1.58.1. I don't see the Teensy 4 security option in the menu however. I have also tried putting the PEM key in the /home/my_username/.arduino and the /home/my_username/Arduino directory to no avail. I can see in the compiler output that when it is compiling it checks for a PEM key and says could not be found. I have tried this for both the Arduino IDE version 1.8.19 and 2.2.1. On top of that, I attempted to install the Teensyduino software install for Linux, but it failed to find a valid Arduino install on my system so I could not proceed.

Do you have any other suggestions?
Download a fresh copy of Arduino IDE 1.8.19 from Arduino's website. Scroll down to "Legacy IDE (1.8.X)"

IMPORTANT - you must download the original from DO NOT use any copy of Arduino from your linux distro. Those copies are modified. Only the original from will work.

Extract the archive. Remember the location of the extracted "arduino-1.8.19" folder.

Download and Run the Teensyduino installer meant to Arduino 1.8.x.

When the installer asks for the copy of Arduino, you must navigate to the location where you extracted the original IDE file. The "Next" button will enable when you have selected a folder containing the IDE. Again, it only works on original copies from It will not work if you use a copy from Debian, Ubuntu, Redhat, etc.

Complete the install, and then run the Arduino 1.8.19 IDE. Click Help > About to check the version. You should see both versions for Arduino and Teensyduino.

You should also have "Teensy 4 Security" in the Tools menu. Click it. The dialog box will show the location where your key.pem file is expected.