Friday, March 24, 2006

Linux Password Trick

Here is a linux password trick using a extfs 2 file system. Login as root
Run the following command
# chattr +i /etc/shadow
above command will write protect the /etc/shadow file
Now try to change passwd using
It will work!!!!
Now try to login using new password
It won't work!!!!!
Now try using old password
It works!!!!
This is beacuse of +i attribute to /etc/shadow file
Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
Get the list of Linux second extended file system using the lsatter command
# lsattr /etc/shadow
For changing the password you need to change attributes using
# chattr -i /etc/shadow
# lsattr /etc/shadow
Try this at your own risk!!!

No comments: