Changing the default username on Jetson TX2

Hi everyone,

I am currently using a Jetson TX2 module on a project. I want to change the default “nvidia” username to “Selim”.
After doing a research, I have learned that there is a method described on the link below that uses usermodtool. It allows changing the username and home folder name.

How do I change my username?

But as stated in the top voted answer, some files still reference the old username.

My questions are:

  • Do you recommend changing my username? Or does it have to stay as “nvidia”?

  • Is the method described on the above link safe? Can it cause problems?

  • If it is not safe, can you recommend another method?

It probably doesn’t matter, but which L4T release are you using? See “head -n 1 /etc/nv_tegra_release”.

For safety, you could clone first. Regardless, you would want to have a couple of different logins running as root while doing this in case of some issue (use “sudo -s” or “sudo su -”).

Some information related to this, not in any particular order, but useful to know follows. A lot of people have needed information similar to this, and so the explanation is a bit longer than needed. Near the end where I mention “adduser” and “addgroup” is the simple way of adding someone new, and “usermod” would be the simple way to modify a user.

When you see a file or directory and the name it is owned by, this is not actually directly wired to that name. Every user and group has a numeric ID, and the file “/etc/passwd” maps a user name to visible name for that numeric user ID, while the “/etc/group” file maps the group name to that numeric group ID. There are some other files which have duplicates of those name as well, and all of those files must match in the name versus numeric ID.

Files with a name in it which would require changing if using ordinary editing, all in “/etc”:


If you have the name “nvidia” in those files, and edit the name to instead be “selim” (I’m not sure if capital letters matter…I’d very strongly recommend sticking to lower case if editing manually), then the numeric ID will stay the same, and files previously owned by “nvidia” will now be owned by “selim”. For example, after a rename to “selim”, the home directory will not be renamed, but “ls -ld /home/nvidia” will show this is owned by “selim”.

Note that ownership is really what matters. If you go through all files listed before this, and edit the “/home/nvidia” (last token on the line) to instead be “/home/selim”, and then actually “mv /home/nvidia /home/selim”, the transition would be complete.

There are a lot of things which could go wrong, and people do not normally edit those files directly, so although I personally do this sort of thing I would not recommend it if you have anything at risk. The beauty of a clone is that you can restore from that.

Something else to consider is that you could add a new user with admin privileges, and this could be name “selim”. You could just leave the “nvidia” account as is. Note that a new user gets a new numeric user and group ID, and so this may not actually be as simple…however, this would serve as a safety during edits. If making a second admin account for safety purposes, then name it something other than “nvidia” or “selim”, stay logged in as that user, verify you can “sudo -s”, and then enjoy manual edit knowing you have a backup account. After it works you could use regular tools to remove the backup account.

There is also the “usermod” command option “--login NEWNAME” which does the same thing, but does not rename directories (you’d still have to rename your home directory, but the numeric ID would remain constant…similar to direct file edit of name only). This is probably preferable to directly editing files, but once more, I will suggest first creating a backup admin account.

There is also an internal mail system directory (which you probably have not used unless your Jetson is set up as a mail server) somewhere under “/var/spool/” which you would need to rename if your user has an internal email setup.

FYI, the “adduser” command is how you would create a new user from scratch, and “addgroup” is how you would add a new group (these would have new numeric IDs). You would typically first “addgroup” using the name of the new user, and then “adduser” while naming a group which is the same as the newly added name from “addgroup”.

Note: Lots of examples on the internet about adding users and renaming them. This Ubuntu is no different than a PC for such purposes. If you have an alternate account added already which works with “sudo”, then you should be free to experiment a bit.