Logo

dev-resources.site

for different kinds of informations.

How to Change Linux Password Quickly and Easily

Published at
5/27/2023
Categories
webdev
kalilinux
tutorial
devops
Author
hackreveal
Categories
4 categories in total
webdev
open
kalilinux
open
tutorial
open
devops
open
Author
10 person written this
hackreveal
open
How to Change Linux Password Quickly and Easily

Changing passwords in Linux is an easy process that may be completed in a few steps. It is essential to change your password on a frequent basis to ensure the security of your system. This article will show you how to Change password in Linux, as well as some recommendations and recommended practises for creating strong passwords. By following these procedures, you can keep your PC secure and protect yourself from dangerous threats.

Change the Password for a Single User in Linux

To change a password in Linux, you can follow these steps:

  • Open a terminal: You can open a terminal by pressing Ctrl + Alt + T or by searching for “Terminal” in the applications menu.

  • Type the following command and press Enter to change the password for your own user account:

passwd

If you have administrative privileges and want to change the password for another user, you can run the following command instead (replace with the actual username):

sudo passwd <username>

You’ll be prompted to enter your current password (or the root password if using sudo) for authentication.

After successful authentication, you’ll be prompted to enter a new password. Type the new password and press Enter.

Note that the password will not be displayed on the screen while typing. You’ll be prompted to re-enter the new password for confirmation.

Type the password again and press Enter.

If the new password meets the system’s requirements, it will be successfully changed, and you should see a confirmation message.
Change Your Linux Password

That’s it! The password for the specified user will be updated. Make sure to remember your new password, or store it securely.

Change Linux Password for Multiple Users

To change passwords for multiple users in Linux, you can use a script or command to automate the process. Here’s an example of how you can achieve this using a shell script:

Open a text editor, such as Nano or Vim, to create a new shell script file. For example, you can use the following command to create a file called changepasswords.sh:

   nano changepasswords.sh

Enter fullscreen mode Exit fullscreen mode

In the text editor, add the following content to the file:

#!/bin/bash

   # List of usernames to change passwords for
   users=("user1" "user2" "user3")

   # Loop through the list of users and change passwords
   for user in "${users[@]}"
   do
       echo "Changing password for user: $user"
       sudo passwd $user
   done
Enter fullscreen mode Exit fullscreen mode

In the users array, replace "user1", "user2", "user3", etc., with the actual usernames for which you want to change passwords. You can add as many usernames as needed.

Save the file and exit the text editor.
Make the script file executable by running the following command:

`   chmod +x changepasswords.sh

Enter fullscreen mode Exit fullscreen mode

`Execute the script by running the following command:

`
./changepasswords.sh

`
You’ll be prompted to enter the root password (or use sudo if required) to run the script with administrative privileges.

The script will loop through the list of users and prompt you to enter new passwords for each user. Follow the prompts and enter the desired passwords. The script will change the passwords for all the specified users.

By using this script, you can easily change passwords for multiple users in one go. Remember to use it responsibly and protect the script file with appropriate permissions, as it has administrative privileges.

Source

kalilinux Article's
30 articles in total
Favicon
Comprehensive Guide: Setting Up Gestures on Linux (Debian-Based Distributions)
Favicon
Master Password Attacks in Minutes! Ethical Hacking Guide 🔓
Favicon
How Hackers Use SS7
Favicon
Endpoint Security Bypass EXPOSED! Hackers Don't Want You to Know This!
Favicon
How to Set Up an Access Point with a Fake Captive Portal
Favicon
Kali Linux Basics: Your Gateway to Ethical Hacking
Favicon
Instalar BeEF en Kali Linux 2024
Favicon
Happy birthday #linux
Favicon
Linux OS & Basic Commands
Favicon
Getting Started with Kali Linux A Beginners Guide
Favicon
Kali Linux For Beginner
Favicon
Is Your PC Safe? How to Block Password Unlockers Like Chntpw in 2024💻🔐
Favicon
Automatically Change IP Address تغير اي بي بشكل تلقائي كالي لينكس
Favicon
Manage Those Users
Favicon
What is File Manipulation?
Favicon
Installing Essential Software on Kali Linux: Browsers, Office Suite, Code Editors, and More
Favicon
How to Change Linux Password Quickly and Easily
Favicon
Advance Free Debugger
Favicon
Hack WiFi using Kali Linux
Favicon
[Help me] Linux in the Virtual Machine
Favicon
Web simulation of Kali Linux
Favicon
Is hacking only done in Linux?
Favicon
Install Kali Linux 2022.2 On Your Android Device
Favicon
How to Install VirtualBox on Kali OS(2022)
Favicon
KALI LINUX: Common Commands that you should know : PART ONE
Favicon
Setting up and Using BloodHound in Kali Linux
Favicon
Configuring AWS EFS to work with Kali Linux running on AWS EC2
Favicon
Black-Tool
Favicon
How to vs code in Kali linux
Favicon
How to install nuclei in any linux ☠️

Featured ones: