AMZ DIGICOM

Digital Communication

AMZ DIGICOM

Digital Communication

passwd command: change passwords

PARTAGEZ

Use the passwd command to set passwords for yourself or others. Various options allow you to make further settings and even deactivate inactive accounts.

What is Linux passwd?

The Linux passwd command is particularly important for the data security of your system. In fact, it allows you, under Linux, to change passwords for a group or user. Modify and block intervals can also be set using the passwd command. This tool allows you to block unauthorized access and better manage the different roles. This is true at least provided you choose secure passwords.

Linux passwd is part of all standard Linux distributions, like Debian or Ubuntu, so there is no need to install it.

How does the passwd command work?

The way passwd works is very simple. If you want to change your own password, only enter the command in the command line. If a password already exists, enter it again, then insert your new password. If you want to change another user’s password, you need administrator rights. If you have them, you can create or modify other people’s access data using the sudo command in Linux. The next time they log in, the corresponding person must enter the new password.

What is the syntax of Linux passwd?

The syntax of the simple passwd command is as follows:

$ passwd [Options] [Utilisateur]

bash

If you forgo the settings “ [Options] ” And ” [Utilisateur] “, you only change your own password.

What are the passwd command options?

The passwd command in Linux has many options. Here are the main ones:

  • -a or –all : Combined with -s, this option ensures that you receive information about all users.
  • -d or –delete : with this option you can deactivate a password.
  • -e or –exhale : with this option, you let a password expire. At the next connection, you will need to define a new password using the passwd command.
  • -i or –inactive [Jours] : With this option you determine when an account should be deleted. This time occurs after the specified number of days a user has been inactive after their password expired.
  • -k or –keep-tokens : this option limits the possibilities for modifying already expired passwords.
  • -l or –lock : With this option, you lock a user’s password.
  • -n or –mindays [Jours] : With this option you determine the number of days since the last change after which a password can be changed again.
  • -S or –status : This option indicates a user’s current values.
  • -u or –unlock : This option overrides the -l or –lock option.
  • -w or –warndays [Jours] : with this option, you warn a user before their password expires. The parameter “ [Jours] » determines the length of the delay before sending the warning.
  • -x or –maxdays [Jours] : this option determines after how many days a password must be renewed.

Examples of using the passwd command

Using a few simple examples, we explain how the passwd command actually works in Linux.

You change your own password. If you do not have administrator rights, you will be asked for your old password. If you enter this correctly, you are authorized to create a new password. You must confirm this again.

You can assign a new password to the user named Peter.

$ sudo passwd -x 100 -n 5 -w 7 -i 10 Peter

bash

With this command you determine that the user Peter must set a new password after 100 days. If he wishes to change his password before this deadline, he can do so no earlier than five days after the last change. He will be informed one week before his password expires. If he does not set a new password within ten days of expiration, his account will be deactivated.

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact