Password Protected WD External Drive Hard Disk: How to unlock on Linux?
I know it sometimes pains to see things working fine and easy in windows OS but not in Linux. One of the things was using my age-old WD hard drive, but password-protected kept hidden in caves due to password-protected I finally managed to access it easily.
Below is the command list run one by one without stoping or read to get the idea what each commands does.
**Updated : For ubunut 20.04 & python3 I was facing issue. So Steps mentioned at the end helped
Command list
sudo apt-get install python3-pip python-dev lsscsi
sudo pip install py_sg
cd ~; wget https://raw.githubusercontent.com/evox95/wdpassport-utils/master/wdpassport-utils.py
sudo python3 ~/wdpassport-utils.py -u
lsblk // to know name of mounted name ( ie MOUNTED_NAME)
sudo python3 ~/wdpassport-utils.py -u -m -d MOUNTED_NAME
//(in my case it was => [sdb 8:16 0 1.8T 0 disk ]
// comand would be : sudo python3 ~/wdpassport-utils.py -u -m -d /dev/sdb
To remove password (Not recommended): sudo python ~/wdpassport-utils.py -c
Step 1 : Install the packages required
sudo apt-get install python3-pip python-dev lsscsi
Step2: Install library “py_sg” [driver to interact SCSI devices]
sudo pip install py_sg
Step3 : Install WD Utilities
cd ~; wget https://raw.githubusercontent.com/evox95/wdpassport-utils/master/wdpassport-utils.py
Step 4: Tada ! . Open Your drive and check your stuff !!
sudo python3 ~/wdpassport-utils.py -u
Not Recommended but if you wish to remove the password run the below command .
sudo python ~/wdpassport-utils.py -c
Enjoy exploring your drive.
Thanks You !!!!
SKIP FROM HERE TILL ………
**Issue faced in ubuntu20.04 & python3 & solution
After succesfully following the above commands was getting below error
Traceback (most recent call last): File "/home/bitsofjarvis/wdpassport-utils.py", line 11, in <module> import pyudev ImportError: No module named pyudev
Multiple python version were installed, so this particular missing module “pyudev” needs to be installed
[email protected]:~$ pip install pyudev output: DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: pyudev in ./.local/lib/python2.7/site-packages (0.23.2) Requirement already satisfied: six in ./.local/lib/python2.7/site-packages (from pyudev) (1.14.0)
By default above pip was installing in python2.7 . So I installed for python3
[email protected]:~$ sudo pip install pyudev Output : Collecting pyudev Downloading pyudev-0.23.2-py3-none-any.whl (63 kB) |████████████████████████████████| 63 kB 1.9 MB/s Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pyudev) (1.14.0) Installing collected packages: pyudev Successfully installed pyudev-0.23.2 [email protected]:~$ python3 -m pip install pyudev [email protected]:~$ python3.8 -m pip install pyudev // was not sure which one to be used, I am still naive at this
output : You need to install the “py_sg” module. Try ‘pip3 install –user git+https://github.com/crypto-universe/py_sg’.
//(SKIP below a & b command . NOT REQUIRED NOW) //a.) pip3 install --user git+https://github.com/crypto-universe/py_sg //b.) sudo pip3 install --user git+https://github.com/crypto-universe/py_sg
…. TILLL HERE
use command :
sudo python3 ~/wdpassport-utils.py -u
sudo python3 ~/wdpassport-utils.py -u
if Output is
=
[!] Multiple Western Digital Passport devices found. Use --device /dev/_ to choose.
then RUN :
sudo python3 ~/wdpassport-utils.py -u -m -d MOUNT_NAME // mount name of your drive
identify the drive name usiing :: “lsblk”

& using below command I was able to access it.
sudo python3 ~/wdpassport-utils.py -u -m -d /dev/sdb

Phewwww !!!!!!!!!!!!!!!!!!!!
After lots of If & buts , I accessed it. Hurray !.