Google Chrome Saved Passwords Lock

Google Chrome very helpfully remembers your passwords for website logins, and for that, I am grateful. I also like the feature in settings (manage saved passwords) where you can view your saved usernames and passwords. I do not like, however, that there is no lock on this utility – as my friends sometimes use my computer, and whilst I tend to lock my computer when leaving it, I wouldn’t if other people were in the room watching something on it. They could very easily view all of my passwords, without having to input any credentials.

I’ve had a quick look at the problem – to see if I could make a little solution. I found the passwords are encrypted and stored in the file “Login Data” under ”C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data\Default”  (Linux:  ~/.config/google-chrome/Default/Login\ Data ).

When in Windows…

Due to gaming demands and overall familiarity, I still use Windows as my main computer. What would have been a simple ‘chmod a-rw’ in Linux, turned out to be a lot more in Windows. Windows does have a permission altering command – icacls – but after spending too long trying to figure it out, I came up with a less elegant solution that works.

Lock the passwords script

Script is fairly self explanitory. Go to the folder (substitute in appropriate username), back up the old Login Data file, make a new one, and make it read only so Chrome doesn’t overwrite it.

cd “C:\Users\MaTT\AppData\Local\Google\Chrome\User Data\Default”

rename “Login Data” “Login Data-old”

echo.>”Login Data”

attrib +R “Login Data”



Unlock the passwords script

Again very simple, change directory, remove the read-only attribute of the placeholder empty file, delete it, and restore the backup.

cd “C:\Users\MaTT\AppData\Local\Google\Chrome\User Data\Default”

attrib -R “Login Data”

DEL /F /S /Q /A “Login Data”

rename “Login Data-old” “Login Data”



Saved these as .bat batch scripts, and they work, as long as Chrome isn’t running! Thats quite enough batch scripting for now..

Not very elegant, but I thought it was worth noting as I didn’t find any other solution out there on the interwebs (other than “don’t use the save password feature”). My idea was to have these both crafted into a little system tray program to toggle the lock on/off, however it is hindered somewhat by the fact Chrome cannot be running when you run either script (as it uses the Login Data file).