Tuesday, 14 July 2020

Shell script - how to Disable/Lock a list of users in Linux

Shell Script Examples

Linux Users:-  abc,  xyz, sankar, sai

Script:-
root@sankar:~#  for i in abc xyz sankar sai; do echo "Locking user $i" && passwd -l "$i" ; done

Locking user abc
Locking password for user abc.
passwd: Success
Locking user xyz
Locking password for user xyz.
passwd: Success
Locking user sankar
Locking password for user sankar.
passwd: Success
Locking user sai
Locking password for user sai.
passwd: Success

1 comment:

  1. Nice post ! If you want to training for this course pls visit us - www.infosectrain.com

    ReplyDelete