Change password in linux system

How to change a Linux password

To best manage your own user account or the accounts of other users, it is helpful to know the most important utilities of Linux. This includes passwd, which you can use to change your Linux password, among other things. You can learn the individual steps here.

The passwd command in Ubuntu

The passwd program package, which allows you to easily change your own password or the passwords of an entire group, as well as set other commands, is included in most Linux installations. Our guide refers to the Ubuntu installations — Ubuntu is one of the most versatile, free distributions of Linux with long-term support and biannual updates.

If you are not sure which Linux distribution or version you are using, see our article on how to display your Linux version.

Change your own Linux password

If you want to change your own Linux password, this is a relatively straightforward process.

  1. Open the Linux terminal. This is where you normally enter commands.
  2. Now type the command “passwd”. This is how you tell the system that you want to change your Linux password.
  3. Depending on the version, you may be prompted to enter your old password. In response, simply enter your new password and confirm it again.
  4. If you now try to log into the system, the new password will be valid.
$ passwd Enter a new UNIX password: Re-enter the new UNIX password: passwd: Password successfully changed $

Change your own Linux password

Changing passwords regularly was once one of the top recommendations for keeping safe online. However, this long-standing advice has been withdrawn, as changing passwords frequently can weaken security. Therefore, it is advisable to only change a password if the password is considered “compromised” or too weak.

Change a Linux password for one user

If you want to change the password of another user, then you need the root privileges. This means that you are the only user of the computer who has unlimited rights to all system files and resources. Keep your password ready for this reason.

  1. To change a user password, access the terminal and type “sudo passwd ”.
  2. Follow the steps in the previous example: enter new password and confirm by typing it again.
  3. If the password is set, the respective user must use the new password at the next login.
$ sudo passwd username Enter a new UNIX password: Re-enter the new UNIX password: passwd: Password successfully changed $

Force Linux password change at next log in

Sometimes a system administrator needs a user to change their password immediately. This can be for various reasons. There may be a user change for an account, or a password may have fallen into the wrong hands. In this case, enter the following syntax as an administrator: “-e passwd ”. Here, “-e” stands for “expire” and causes the respective password to expire immediately, so that the affected user must set up a new password the next time they log in.

Читайте также:  Linux server security check

We have collected the most important Linux commands for you in our article.

All important Linux commands

All important Linux commands

Under Linux, all actions that you can carry out with the mouse and window system via the graphical user interface can also be performed using program calls in the terminal – provided you know the appropriate command and how to use it according to the correct syntax. To make working in the terminal easier, we provide you with an overview of basic Linux commands with detailed descriptions and…

How to get your Linux IP address in different ways

How to get your Linux IP address in different ways

If you want to check your IP address in Linux, you have a couple of options. In addition to the graphical route via the settings, you can also use commands to get the information you’re looking for. Here, we’ll introduce you to some of these commands, like “ifconfig”, the equivalent of the “ipconfig” Windows command in Linux.

The best Linux Server distributions in an overview

The best Linux Server distributions in an overview

There are several Linux distributions available for a variety of needs thanks to the open source feature and the dedicated communities. In our overview, we’ll highlight the best providers, explain their advantages and disadvantages, and outline which operating systems are best suited for servers, desktops, or other uses.

The best Linux distributions (operating systems)

The best Linux distributions (operating systems)

It can be difficult to keep track of all the Linux distributions available. Whether you are looking to switch your business to Linux or are simply curious about Linux and in the market for a new operating system, our article shows you the top distributions and discusses their different purposes. Read on to find out more.

Источник

How to Change User Password in Linux

In this guide we’ll explain how to change a user password in Linux. We will also show you how to force users to change their password the next time they log in.

The instructions should work on any Linux distribution, including Ubuntu, Debian, and CentOS.

Introduction #

In Linux, you can change the password of a user account with the passwd utility.

The encrypted users’ passwords, as well as other passwords related information, are stored in the /etc/shadow file.

As a regular user, you can only change your own password. The root user and users with sudo privileges can change another user’s passwords and define how the password can be used or changed.

When changing the password, make sure you’re using a strong and unique password.

Читайте также:  Linux ide code blocks

Having a strong password is the most important thing you can do to secure your account. Often a strong password has at least 16 characters and contains at least one uppercase letter, one lowercase letter, one number, and one special character.

For security reasons, it is recommended to update your password on a regular basis and use a unique password for each account.

Change Your User Password #

To change your own user’s account password, run the passwd command without any arguments:

You will be prompted to enter your current password. If the password is correct, the command will ask you to enter and confirm the new password.

Passwords are not shown on the screen when you enter them.

The next time you log in to your system, use the new password.

Change Another User’s Password #

As we mentioned in the introduction, only the root user and users with sudo access can change the password of another user account.

The following example assumes that you are logged in as a user with sudo privileges.

To change the password of another user account, run the passwd command, followed by the username. For example, to change the password of a user named linuxize , run the following command:

You will be prompted to enter and confirm the new password:

Enter new UNIX password: Retype new UNIX password: 

On success, the command will print something like this:

passwd: password updated successfully 

Force User to Change Password at Next Login #

By default, passwords are set to never expire. To force a user to change their password the next time they log in, use the passwd command with —expire option followed by the username of the user:

sudo passwd --expire linuxize

The command above will immediately expire the user password.

The next time the user tries to login with the old password, they will be shown a message forcing them to change the password:

WARNING: Your password has expired. You must change your password now and login again! Changing password for linuxize. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Connection to 192.168.121.209 closed. 

Once the user sets a new password, the connection will be closed.

Conclusion #

In this tutorial, you have learned how to change user’s passwords and how to set password expiry.

You can find more information about the passwd command, by typing man passwd in your terminal or visiting the Linux passwd man page.

If you have any questions or feedback, feel free to leave a comment.

Источник

How to Change Your Password in Linux Using Terminal

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 11 people, some anonymous, worked to edit and improve it over time.

The wikiHow Tech Team also followed the article’s instructions and verified that they work.

This article has been viewed 125,650 times.

Changing a password on Linux can be confusing for those who are unfamiliar with it. This guide will show you how to change your account’s password for most Linux systems.

Читайте также:  Линукс при закрытии крышки ноутбука

Open a terminal window.

Image titled Change Your Password in Linux Step 1

Open the Terminal if using a desktop environment. The keyboard shortcut to do this is Ctrl + Alt + T .

Type «passwd» at the prompt and press «Enter.»

Image titled Change Your Password in Linux Step 2

The passwd command will prompt you to enter your old password. You’ll you’re your old password to create a new one.

Enter your old password and press «Enter.»

Image titled Change Your Password in Linux Step 3

If your password is correct, you’ll be able to create a new one. The password characters will not be displayed on the screen while you type so onlookers will not be able to guess at the length of the password.

Enter and confirm a new password.

Image titled Change Your Password in Linux Step 4

Type the new password and press ↵ Enter . You’ll need to confirm by typing it one more time and pressing Enter again. You have now reset your password using the terminal.

Community Q&A

To change the root password, you will need to log in as root. Depending on your Linux distribution, you can do this a variety of ways. Most common distributions require you to become root using the command «sudo -i», «sudo su -«, or «su root». You may then change the root password by executing the «passwd» command.

Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow

The password you type becomes invisible, but it’s still there. Just be careful not to make a mistake in the password.

Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow

Refer to our article How to Reset Forgotten Password in Linux for help resetting your login password.

Thanks! We’re glad this was helpful.
Thank you for your feedback.
As a small thank you, we’d like to offer you a $30 gift card (valid at GoNift.com). Use it to try out great new products and services nationwide without paying full price—wine, food delivery, clothing and more. Enjoy! Claim Your Gift If wikiHow has helped you, please consider a small contribution to support us in helping more readers like you. We’re committed to providing the world with free how-to resources, and even $1 helps us in our mission. Support wikiHow

Источник

Оцените статью
Adblock
detector