1 Answer
Unfortunately This can't be Done in the above way.
But There is nothing known as "Cant" in linux You Just need a Custom Script With a userlist in sepearte File to change the password. Once you run the Script you can just enter password manually once by one. Most fastest Way posisble.
The below command will list the users who’s having /home directory and redirect the output to userlist.txt file.
# cat /etc/passwd | grep "/home" | cut -d":" -f1 > user-list.txt
List out the users using cat command. Remove the username Which you don't wish to change the password.
Create a following shell script to achieve this.
#vi passwordchange.sh
#!/bin/sh
for user in `more userlist.txt`
do
echo "$user@123" | passwd --stdin "$user"
chage -d 0 $user
done
Set an executable permission to passwordchange.sh file.
Finally run the script to achieve this.
Your Answer
x