Post

Linux - Change Username and UID

Change Username and UID

  1. list user
1
2
3
cat /etc/passwd
grep -w '^username' /etc/passwd
grep -w '^jerry' /etc/passwd
  1. check user
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
id tom

// login info
grep '^tom:' /etc/passwd

// group info
grep 'tom' /etc/group
groups tom

// Find home directory permissions
ls -ld /home/tom/

// see all Linux process owned by user and group named tom using the ps command:
ps aux | grep tom

  1. rename
  • id tom
  • usermod -l jerry tom
  • kill pid_number
  • groupmod -n jerry tom
  • usermod -d /home/jerry -m jerry
  • id jerry
  1. change user tom UID from 5001 to 10000 Type the usermod command as follows:
  • id tom
  • usermod -u 10000 tom
  • id tom

.

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.