How To Change or Rename Username and User ID In Linux?

The problem is we want to change the allready created user name or user id. As we know there is a lot of configuration those rely on the user id like permissions. We will use usermod command to make this change. Keep in mind this changes will effects system wide.

List User Info

Before starting to big changes we will list users detailed info with following command

1

2

$cat/etc/passwd|grep test

test:x:1001:27::/home/test:/bin/bash

test is our user name for this operation

1001 is the current id of our test user.

Change User Name

We will change username with the following command by providing new username.