How to change name in Parrot Linux

Posted on

Problem :

So, I recently set up a new copy of Parrot Security OS on my computer and messed up my name. Is there any way to change my name? I have googled it but it just says “How to change hostname” and “How to change username”. So is there any way to do this? I also know quite a bit about Linux and I think I will understand anything that has to be done.

Solution :

To change the “full name” use chfn.

chin -f "Fred Foobar"

To change the account name use usermod. That user needs to be fully logged out (it technically doesn’t but you’ll usually want to relocate the home directory to match).

usermod -l fred -d /home/fred -m ferd
groupmod -n fred ferd

Your name is stored in the /etc/passwd file, so if you edit that file and update the appropriate field on the relevant line this will work.

The “correct” way to do this is using vipw (ie “sudo vipw”). If you don’t have vipw installed, you can just edit the file /etc/passwd as root – and in practice this will be OK on a single user system (vipw locks the password file to prevent multiple things trying to modify it simultaneously)

The /etc/passwd file format is as follows:

1 line per user.
Fields are separated by “:” character.
First field is the user name, then a password place holder, then user id, group id, users name, home directory and preferred shell.

(In case you are wondering, the password is not typically stored in /etc/passwd, its stored in /etc/shadow – this is a legacy thing – 25 years ago when I started with Unix encrypted passwords WERE kept in /etc/passwd, but as its world readable, its not a great idea.

There is some risk involved in this, so I would suggest backing up the passwd file before editing it, then, IN ANOTHER WINDOW/TERMINAL AND WHILE STILL LOGGED IN AS ROOT make sure you can log in after the changes. If not, revert to the old file and try again.

Leave a Reply

Your email address will not be published. Required fields are marked *