## add user 'james' for test root@pts/0 $ useradd james ## check original id root@pts/0 $ id james uid=1007(james) gid=1008(james) 组=1008(james) ## check HOME directory root@pts/0 $ ls -ld /home/james/ drwx------ 2 james james 4096 12月 23 11:46 /home/james/ ## try to change or rename and verify root@pts/0 $ usermod -l newjames james
root@pts/0 $ id james id: james: no such user
root@pts/0 $ id newjames uid=1007(newjames) gid=1008(james) 组=1008(james) ## check HOME folder root@pts/0 $ ls -ld /home/james/ drwx------ 2 newjames james 4096 12月 23 11:46 /home/james/
root@pts/0 $ groupmod -n newjamesgroup james ## find that group was renamed root@pts/0 $ id newjames uid=2007(newjames) gid=1008(newjamesgroup) 组=1008(newjamesgroup) ## try to change GID root@pts/0 $ groupmod -g 2007 james
root@pts/0 $ id newjames uid=2007(newjames) gid= 2007(newjamesgroup) 组= 2007(newjamesgroup)