Alterando o nome abreviado do usuário [duplicado]

2
Estou fazendo uma pequena rede Ubuntu, e no cliente 10.04 eu "logado" como o usuário "employee1", e mudei meu nome para "Red Herring", mas eu não posso mudar o nome curto para esta conta. Existem comandos de terminal ou algo que eu preciso usar para fazer isso? Não consigo encontrar nenhuma maneira de fazer interface gráfica.

Obrigado,

Devin

    
por Devin 04.05.2012 / 04:26

1 resposta

2

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 ).

    
por dr jimbob 04.05.2012 / 07:06