on ‎2020 Jan 24 4:32 PM
Hi,
How could i lock multiple users in Suse linux using passwd command in suse linux?
Request clarification before answering.
Hi Prashant. You could write a simple BASH shell script to lock the passwords of multiple users. For example, create a new file called lock-users.sh, and add the following content:
#!/usr/bin/env bash
# Loop through usernames in file and lock them
while read user
do
passwd -l "$user"
done < "user-list.txt"
exit 0Save this file, and run chmod u+x lock-users.sh. Create a new text file called user-list.txt in the same directory as the shell script. In this file, enter the usernames that you want to lock line by line. For example:
user1
user2
user3Now, run the script by typing sudo ./lock-users.sh. The users specified in the text file will be locked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.