Gaining root access

First a word of caution: The default admin name/password of “ubuntu”/“ubuntu” is known to the whole world. Anyone booting a Jetson which is not protected from behind a router or firewall will get hacked quite fast (port scanning will find the system and attempt brute force password logins to ubuntu anywhere from seconds or minutes to a few hours from startup…I’d be surprised to see such a system last 8 hours). If you know the password was intentionally changed by you and you just forgot the password steps can be done to try and keep the existing installation and go back to the default. If the password has worked in the past but suddenly stops, then you need to wipe the whole system and clean install…the best you could do is clone the partition first for forensics. The case of a fresh install not working from the start is usually because of misuse of permissions during the flash process.

For the case of a new flash not liking sudo, pay attention during flash to needing to preserve permissions during unpack of the sample rootfs and the apply_binaries.sh step…and flash again. Note that unless the sample rootfs was unpacked on a Linux native partition type permissions and ownership are incapable of being preserved (e.g., NTFS or VFAT do not understand Linux).

For the case of a suspected hack, flash again. Don’t waste your time trying to save it. Any ssh keys or credentials on such a machine should also be thrown out.

For the case of knowing you just forgot the password, decide if you have time to deal with this. Fixing this is a modification of installing from scratch, but it takes more time and preserves the existing install.

For this latter case of forgetting the password you can clone the root partition, mount it on loopback on your host, and then edit the password and group files back to the original install version (e.g., copy from sample rootfs using sudo)…which is then re-flashed to the Jetson using the “-r” option to reuse the cloned image. The relevant files would be “passwd”, “passwd-”, “group”, and “group-”.