How to Change a Linux Password

Techwalla may earn compensation through affiliate links in this story.
Keep your Linux computer secure by occasionally changing the password.

Linux is an operating system known for its stability and security. IT professionals generally consider Linux to be one of the most secure operating systems available today. This security can be weakened, however, if you have a weak password. It is also advisable to change your password from time to time just in case a hacker were to somehow discover your password. Changing a password in Linux is a very straightforward process, and with it you can make your system much more secure.


Changing a Linux password

Step 1

Open a terminal. A terminal is the Linux version of the DOS command prompt in Windows. It takes text commands and produces text output. The process to open a terminal differs between different distributions and desktop environments. In GNOME, you can open a terminal by pressing "Alt+F2" and then typing "xterm" into the prompt that pops up.

Step 2

Become root. This essentially elevates your privilege level to the Linux equivalent of "Administrator" in Windows. This may not be necessary if your user account already has the permissions to change passwords. To become root, type "sudo su" into the terminal and press "Enter." You are prompted to enter the root password. As you type your password, no dots or asterisks appear as they do on most applications, so take care to type it correctly. Once you have successfully done this, the dollar sign at the end of the command prompt will be replaced with a pound sign (#).


Step 3

Change the password by typing "passwd username" (replace username with the user name on the account for which you want to change the password) and pressing "Enter." You are prompted to enter the new password twice. The entry method is the same as when you became root--no asterisks or dots appear as you type. You may also change the root password by just typing "passwd" with no user name and pressing "Enter." You should ideally use a strong password (at least eight characters long, consisting of at least three types of characters, such as lowercase or uppercase letters, numbers, and special characters such as spaces or punctuation). The terminal gives you a success message, and now you have successfully changed your Linux password.


These instructions include executing commands with root privileges. Messing up something while executing with root privileges may make a computer unusable. Make sure you know what you are doing before executing anything.