Have you ever found yourself wishing you could change your Linux username after the initial setup? It’s a common desire, whether for personal preference or simply to delve deeper into the intricacies of Linux user management. This guide will walk you through the process of renaming your user on Fedora Workstation 42, along with troubleshooting common issues like broken file manager bookmarks.

Renaming Your User on Fedora Workstation 42

It’s crucial to understand that you cannot rename a user while they are logged in. This is because various system processes are actively running under that user’s identity. To successfully change your username, follow these steps:

  1. Log Out Completely: Navigate to the top-right corner of your desktop, click the power icon, and select ‘Log Out’.
  2. Switch to TTY: From the login screen, press Ctrl+Alt+F3 to access a text-based terminal (TTY).
  3. Log in as Root: You’ll need root privileges for this operation. If root login is not enabled, you might need to set a password for the root user first. You can check the root status with sudo passwd -S root. If it shows root L ..., it’s locked. Unlock it by setting a new password using sudo passwd root. After setting or verifying, log in as root.
  4. Verify No Processes Running: Before proceeding, ensure no processes are still active under the old username. Use the command:
    ps -u old_username
    Replace old_username with the username you intend to change.
  5. Rename the User: Execute the following command to rename your user account:
    usermod -l new_username old_username
    Here, new_username is your desired new username, and old_username is the current one.
  6. Verify the Change: Confirm that the username has been updated in the system’s password file:
    cat /etc/passwd | grep new_username
  7. Update Home Directory Path: It’s essential to also update the path to your home directory to match the new username.
    usermod -d /home/new_username -m new_username
    This command changes the home directory and moves its contents.
  8. Return to GUI: Once complete, press Ctrl+Alt+F1 or Ctrl+Alt+F2 to return to your graphical login screen.

Resolving File Manager Bookmarks After Username Change

After successfully changing your username, you might notice that bookmarks in file managers like Nautilus are broken. This is because their paths still point to the old home directory. Here’s how to fix them:

  1. Locate Bookmarks File: First, find the configuration file where your bookmarks are stored:
    find ~/.config -name "*bookmarks*" -type f 2>/dev/null
    This command will likely point you to ~/.config/gtk-3.0/bookmarks.
  2. Edit the Bookmarks File: Open the identified bookmarks file using a text editor, for example:
    nano ~/.config/gtk-3.0/bookmarks
  3. Update All Paths: Within the file, meticulously update all instances of /home/old_username to /home/new_username. Save the changes and exit the editor.

Key Takeaways

  • Holistic User Management: Renaming a user in Linux involves more than just changing a name; it requires updating multiple system files and directory paths.
  • Personalized Terminal Experience: A username you genuinely like can significantly enhance your comfort and overall experience when working in the Linux terminal.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed