Veja man usermod
:
SYNOPSIS
usermod [options] LOGIN
-d, --home HOME_DIR
The user's new login directory.
If the -m option is given, the contents of the current home
directory will be moved to the new home directory, which is
created if it does not already exist.
-m, --move-home
Move the content of the user's home directory to the new location.
This option is only valid in combination with the -d (or --home)
option.
usermod will try to adapt the ownership of the files and to copy
the modes, ACL and extended attributes, but manual changes might
be needed afterwards.
-l, --login NEW_LOGIN
The name of the user will be changed from LOGIN to NEW_LOGIN.
Nothing else is changed. In particular, the user's home directory
name should probably be changed manually to reflect the new login
name.
Então você quer
sudo usermod -m -d /home/new_login_name old_login_name
sudo usermod -l new_login_name old_login_name
O primeiro comando irá mover seu diretório de login; o segundo comando editará os arquivos relevantes que fazem referência ao seu nome ( /etc/passwd
, /etc/shadow
, /etc/groups
) de old_login_name
a new_login_name
. Você não perguntou, mas também pode querer alterar o nome do seu grupo como groupmod
de maneira análoga ( sudo groupmod -n new_group_name old_group_name
).