Saturday, 25 April 2015

How to Lock and Unlock a User in Ubuntu Linux

1)
I have a user named "a1", and i can logging as user a1 using following command:
  
       anusree@anusree-VirtualBox:~$ su a1
      Password: [enter the password]
      a1@anusree-VirtualBox:/home/anusree$



2)
I am going to lock the user "a1".

       anusree@anusree-VirtualBox:~$ sudo passwd -l a1
      [sudo] password for anusree: [enter the password]
      passwd: password expiry information changed.
      anusree@anusree-VirtualBox:~$



3)
After i locked user "a1",  I am trying to login as user "a1" and it should fail.

       anusree@anusree-VirtualBox:~$ su a1
      Password:
      su: Authentication failure
      anusree@anusree-VirtualBox:~$



     
4)
After that i unlocked the user "a1" using following command.

      anusree@anusree-VirtualBox:~$ sudo passwd -u a1
     passwd: password expiry information changed.
     anusree@anusree-VirtualBox:~$ 





5)
After unlock the user "a1" i am going to logging as user "a1" and it should  success.

      anusree@anusree-VirtualBox:~$ su a1
      Password: [enter the password]
      a1@anusree-VirtualBox:/home/anusree$ 





No comments:

Post a Comment