How to Change Password in Ubuntu | Complete Guide for GUI and Command Line

1. Introduction

Importance of Changing Your Password in Ubuntu

Ubuntu is an open-source Linux distribution used by millions of users worldwide. Its user-friendly interface and robust security features make it popular among individuals, businesses, and developers. However, as part of security best practices, it is crucial to change passwords regularly. Using the same password for an extended period increases security risks, so it’s essential to be cautious.

Passwords play a critical role in controlling access to your system. If you want to prevent unauthorized access, strengthening your password and updating it regularly is essential. Additionally, password management becomes even more crucial if you share your device with family, friends, or colleagues or if you work in a remote environment.

Who Is This Guide For?

This guide is primarily written for beginner Ubuntu users and those who use Ubuntu regularly but are concerned about security. It also provides valuable insights for IT personnel and system administrators, offering step-by-step instructions to minimize security risks. Even beginners can follow along with command-line examples and GUI-based methods explained in detail.

2. Basic Methods to Change Password in Ubuntu

In Ubuntu, changing your password using the Command Line Interface (CLI) is a common practice. This method is highly efficient and straightforward, even for beginners. Below, we will introduce the basic steps for changing your password.

2.1 How to Change Your Own Password

The most basic way to change your password is by using the passwd command. This command allows you to update the password for your own account.

Steps:

  1. Open the Terminal
    Launch the terminal in Ubuntu. You can easily do this by pressing Ctrl + Alt + T.
  2. Run the passwd command
    Enter the following command:
   passwd

This command is used to change the password of the currently logged-in user.

  1. Enter your current password
    The system will prompt you to enter your current password. Type it correctly and press Enter.
  2. Set a new password
    You will be asked to enter a new password twice. First, type your new password, then re-enter it to confirm. Your password will now be updated.

Password Change Success Message

Once the password has been successfully changed, you will see the following message:

passwd: password updated successfully

Your password has now been updated.

2.2 How to Change Another User’s Password

If you are a system administrator and need to change another user’s password, you can use the sudo command. This method requires administrator privileges.

Steps:

  1. Run the sudo passwd [username] command
    To change another user’s password as an administrator, use the following command:
   sudo passwd [username]

For example, if you want to change the password for a user named john, enter:

   sudo passwd john
  1. Enter the administrator password
    The system will prompt you to enter your administrator password. Type it correctly and press Enter.
  2. Set a new password
    Enter the new password for the target user and confirm it by entering it again. The user’s password will now be updated.

This method allows administrators to reset passwords when a user is unable to change their own.

侍エンジニア塾

3. Changing Password Using GUI

In Ubuntu, you can change your password using the Graphical User Interface (GUI) instead of the command line. This is a convenient method for users who are not familiar with CLI commands. Below are the steps to change your password using the GUI.

3.1 Opening the Settings Panel

  1. Access the “Settings” menu
    First, open the “Activities” screen in Ubuntu. Click the “Activities” button in the top left corner and type “Users” in the search bar. Click on the “Users” option that appears in the search results to open the settings panel.
  2. Open the “Users” settings panel
    Once inside the “Users” panel, you will see information about your current user account. Use this panel to update your password.

3.2 Steps to Change Your Password

  1. Select the “Password” field
    Click on the hidden password field (e.g., ●●●●●) to change your password. If you want to change another user’s password, click the “Unlock” button first to enable administrator access.
  2. Enter your current password
    Before changing the password, you need to enter your current password. Type it correctly and click “Confirm.”
  3. Enter a new password
    A new password input screen will appear. Enter your new password, then re-enter it to confirm. It is recommended to use a strong password.
  4. Complete the password change
    After entering the new password, click the “Change” button to update it. Your new password is now set and will be used for your next login.

3.3 Changing Another User’s Password

If you are an administrator and need to change another user’s password, first enable administrator access in the “Users” settings panel. Click the “Unlock” button and enter your administrator password. Then, access the password field for the target user and follow the same steps to set a new password.

3.4 Advantages and Considerations of Using GUI

Changing passwords via GUI is very convenient for users unfamiliar with the command line. Since it provides a visual interface, the risk of errors is lower, and the process is more intuitive. Additionally, there is no need to type complex commands, making it more accessible for beginners. However, since administrators can change other users’ passwords, proper security measures should be in place.

4. What to Do If You Forget Your Password

If you forget your password in Ubuntu, you will not be able to log in using the standard method. However, you can reset your password using the GRUB menu or Recovery Mode. This section explains how to reset your password in case you forget it.

4. What to Do If You Forget Your Password

If you forget your password in Ubuntu, you will not be able to log in using the standard method. However, you can reset your password using the GRUB menu or Recovery Mode. This section explains how to reset your password in case you forget it.

4.1 Resetting Password via Recovery Mode

  1. Restart your computer
    If you cannot log in, restart your computer.
  2. Access the GRUB menu
    When the system boots up, hold down the Shift key (for BIOS systems) or press Esc repeatedly (for UEFI systems) to open the GRUB menu.
  3. Select Recovery Mode
    In the GRUB menu, select the option labeled Advanced options for Ubuntu, then choose Recovery mode.
  4. Enter root mode
    Once in the recovery menu, select root to open a root shell prompt.
  5. Remount the filesystem
    The root filesystem is mounted as read-only by default. To modify files, remount it as read-write by entering:
mount -o remount,rw /
  1. Reset your password
    Use the following command to reset your password:
passwd [your-username]

Replace [your-username] with your actual username. If you don’t remember your username, use:

ls /home
  1. Enter a new password
    You will be prompted to enter a new password twice.
  2. Reboot the system
    After successfully changing your password, restart your computer by typing:
reboot

You should now be able to log in with the new password.

5. Best Practices for Password Security

To enhance your security, consider the following password management best practices:

  • Use a strong password containing at least 12 characters, including uppercase and lowercase letters, numbers, and special characters.
  • Never use the same password for multiple accounts.
  • Change your password regularly to minimize security risks.
  • Consider using a password manager to securely store your credentials.
  • Enable two-factor authentication (2FA) when possible.

6. Conclusion

Changing your password in Ubuntu is a simple but crucial step to maintaining security. Whether using the command line or GUI, it is essential to update your password regularly and follow best security practices. If you forget your password, you can reset it via Recovery Mode or the GRUB menu.

By implementing strong password policies and regularly updating credentials, you can significantly improve your system’s security.

年収訴求