Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RENAMING : USER ACCOUNT / USER DIRECTORY / UID / HOSTNAME
- To avoid process-conflict when modifying a user, be sure that you're
- signed out of the account you're intending to modify.
- ---[ step #1 ]-----------------------------------------------------
- To create a new user:
- sudo adduser <username>
- *** enter a password when prompted ***
- Make the account a super-user:
- sudo usermod -aG sudo <username>
- ---[ step #2 ]-----------------------------------------------------
- Now login to the dummy account! When you get in, open up a terminal.
- Rename the user account you want to change:
- sudo usermod -l <new_username> <username>
- ---[ step #3 ]-----------------------------------------------------
- At this point, the user director (ex: /home/<username>) will also need
- to be renamed to match the new username you've selected, else there will
- be issues and all sorts of minor hang-ups.
- You will want to copy the contents from the old user directory (including
- desktop contents, documents, etc) over to the new one. To do this:
- sudo usermod -d /home/<new_username> -m <old_username>
- sudo ln -s /home/<new_username> /home/<old_username>
- ---[ step #4 ]-----------------------------------------------------
- You finally need to shift the user-group from the old username to the
- new one. You can do this by:
- sudo groupmod -n <new_username> <old_username>
- ---[ step #5 ]-----------------------------------------------------
- You may also want to set a new user-ID for the new username.
- Do this by doing:
- sudo usermod -u <uid> <new_username>
- ---[ step #6 ]-----------------------------------------------------
- If you want to change the hostname (computer name) of the machine.
- Enter in this statement to see the current hostname:
- cat /etc/hostname
- To change it:
- hostnamectl set-hostname <new_hostname>
- You will also want to check the hosts file:
- cat /etc/hosts
- Modify the line "127.0.1.1 <old_hostname>" and change that too:
- sudo mousepad /etc/hosts
- *** change the hostname manually***
- ---[ step #7 ]-----------------------------------------------------
- Finally, you may choose to get rid of the dummy user you've used
- to make changes to the original user account:
- sudo userdel <username>
- References:
- https://www.youtube.com/watch?v=-nHmA75AcTM
- https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-rename-linux-users-and-their-home-directory/
- https://www.youtube.com/watch?v=-nHmA75AcTM
- Note: Nautilus file explorer may not want to re-pin directories such as Documents, Music, and Videos
- on the left-hand side. To re-pin, manually navigate to the desired directory and hit CTRL + D to
- pin.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement