How to Change Password in Linux
Locally or remotely for extra security
Without a secure password, your data is vulnerable. Easy to guess or previously leaked passwords make a hacker’s job easy—after all, it isn’t hard to breach a user account if “password123” is your password. That’s why it’s important to change your password regularly, even on a more secure operating system like Linux.
Thankfully, it’s an easy process to change your password in Linux. You can change your password (or other user’s passwords) from the terminal locally or remotely, or set expiration dates to force other users to change it themselves when they next sign in. Here’s what you’ll need to do to change a user password in any Linux distribution.
Why You Should Change Your Linux Password Regularly
While a Linux-based operating system offers greater security than a typical Windows installation, that doesn’t mean it’s infallible to hackers. One of the easiest ways for someone to breach your PC is through lax security, with easy-to-crack passwords at the top of the list.
Unfortunately, you should also expect that time is against you. Many of us use the same passwords for multiple accounts. If youremail password is compromised, for instance, and you use the same password to sign into your Linux PC, then you’re putting your PC (and all of your saved data) at risk.
That’s why it’s important to consider changing all your passwords in Linux on a regular basis, including your account passwords on Linux. A good password consists of a number of letters (both upper and lower case), numbers, and special characters. It also requires the password to be of suitable length (at least 8 characters, if not more).
If you’re struggling to come up with a password you can remember, you canuse a password managerto help you generate and remember it. You won’t be able to use this to fill out the login screen, but if you’re using apassword manager like KeePass, you can quickly recall the password using the mobile app.
However, it’s probably best (and easiest) to create a password that you can remember. Dictionary words are off the menu for this one, but where possible, you should attempt to create a memorable password that no-one else could possibly know using the steps we’ve outlined above.
How to Change Your Password in Linux
While you should be able to change passwords using your distro’s desktop environment, those steps will vary significantly. If you’re using a headless version of Linux (without a GUI), you won’t be able to use a GUI to change your password at all.
That’s why the best and fastest way to change your password in Linux is to use the terminal, regardless of theLinux distributionyou’re using.
Changing Other User Account Passwords in Linux
If you have superuser or root access on your Linux PC or server (for instance, if you’re a system administrator), you can change the passwords of other local users. You may want to do this if someone has forgotten their password, for instance.
How to Change the Root Password in Linux using Sudo
To help protect your system, many Linux distributions restrict normal user accounts by hiding certain access behind the root (superuser) account. When you elevate your terminal using commands likesudo suorsuto grant root access, you’ll need to type the correct root password.
Setting a Password Expiry Date in Linux
By setting a built-in expiry date for passwords on your Linux PC, you don’t need to worry about manually running thepasswdcommand on a regular basis. When the password expires, your PC will instruct you to change your password automatically.
Securing a Linux System
Linux is well known as one of the most secure operating systems available, but without a secure password in place, you’re leaving your PC vulnerable to attack. There are other ways you can secure your system further, such asmaintaining a secure local networkandscanning your files for virusesthat could infect other PCs.
You could also think aboutusing a secure web browserto stay safe online, especially if you considerusing a VPNto mask your IP address. Making efforts toprotect your online privacy and securitywon’t stop hacking attempts, but it will add another layer of defense against it.
Ben Stockton is a freelance technology writer based in the United Kingdom. In a past life, Ben was a college lecturer in the UK, training teens and adults. Since leaving the classroom, Ben has taken his teaching experience and applied it to writing tech how-to guides and tutorials, specialising in Linux, Windows, and Android. He has a degree in History and a postgraduate qualification in Computing.Read Ben’s Full Bio
Welcome to Help Desk Geek- a blog full of tech tips from trusted tech experts. We have thousands of articles and guides to help you troubleshoot any issue. Our articles have been read over 150 million times since we launched in 2008.
HomeAbout UsEditorial StandardsContact UsTerms of Use
Copyright © 2008-2024 Help Desk Geek.com, LLC All Rights Reserved