I used to have a rooted Android device about 3-4 years ago. I recently found it and I dont know the password. This android device was trusted on my computer but now it is showing unauthorized under adb devices. I also have the files called adbkey and an excel file. Do these keys expire after a certain time or am i doing something wrong? Thanks in advance.
The authorization depends on a key stored on your key. You can find it in the file
~/.android/adbkey. If this key has been modified, replaced or recreated the authorization is lost.
So you should make sure you are still using the same key.
However even if you have the same key you might not get an adb connection because of Android security (in detail the device encryption).
On modern Android device (e.g. Android 9+) adb is only fully working after the user has entered the lock password/pin/pattern for the first time.
Before this first user authentication has been passed adb is not or not fully available. For examle
adb shell may work but access to
/sdcard and other encrypted sections is not possible (Android 9 with FBE).
However on older Android versions (or if the manufacturer has changed the user authentication) this behavior may be different so that you see the device on ADB but the authentication fails as you have encountered it.
Edit: Starting with Android 11 there seems to be a new feature called adb authorization timeout. By default this is set to 7 days. I have to had the chance to test this in reality but this looks like Android 11 device automatically "forget" the adb authorization(s) after a certain period of time. There is an option in developer options to permanently disable this functionality.