Change username on Ubuntu

Asked

Viewed 2,788 times

1

I formatted my Ubuntu and misspelled the name.

I tried to fix by changing the files /etc/hostname and /etc/hosts but still can’t get what I want.

When I open the terminal appears like this:

daneil@daniel:~$

I need:

daniel@daniel:~$

Name (before @) is wrong, how to fix?

  • I don’t know if this is within the scope defined by the community.

  • @Patrick, I don’t think so. Operating systems are not primary tools for programmers. I think it would be too generic to accept that. And it would eventually make this site a mix between [su] and [pt.so].

  • 1

    @Renan The fact of a command as usermod can be used in a script does not make the question about scripts.

  • @bfavaretto ok, I agree. If we change the question to something like "how do I change the name of (user/host)" with shellscript, the question would be more in topic?

  • @Renan, I don’t think so, because the answer doesn’t change much, right? It’s an artificial way to "fit" the question. If you think we should accept questions about using the [su] style command line, do not want to open a discussion on the goal?

  • Done (in a way).

Show 1 more comment

1 answer

4


Try:

usermod -l nomeNovo nomeAntigo
  • Remember that you need to be logged in as another user (preferably root) and that you should also change the user folder to the new name.

  • Thanks, it worked fine, I created another user admin to be able to execute the command, changed and deleted the user again. Thanks. Good evening.

  • Just change the name of the user folder that didn’t work, when I changed it doesn’t enter graphic mode, then I had to go back to the old folder name, which could be?

  • 1

    Solved: mv /home/nameAntigo /home/Seunome usermod --home /home/Seunome Usermod

Browser other questions tagged

You are not signed in. Login or sign up in order to post.