Unlock WD Password Protected HDD in Linux

Here is the details of what I was trying to perform on Linux Mint 18.3 and 19.1. Same results.

https://blog.bestcoding.net/en/unlock-wd-passport-drive-linux/

sudo apt-get install python-pip python-dev lsscsi

sudo pip install py_sg

I get

The directory ‘/home/easyt50/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/home/easyt50/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting py_sg
Downloading https://files.pythonhosted.org/packages/de/fe/aa8b849771ed622e0f734183fe4ddb84648ea017b2a08f308b04bbf779bf/py_sg-0.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named setuptools

----------------------------------------

Then there is a third command of
cd ~; wget https://raw.githubusercontent.com/evox95/wdpassport-utils/master/wdpassport-utils.py

Which I did not do b/c the second command did not work.

A post was merged into an existing topic: Linux Mint 19.1 Tessa first impressions

sudo apt install python-setuptools python-wheel
1 Like

Thanks! That got me two steps closer.

Now I go on to the phase:
Unlock WD My Passport Drive

Plug in your password protected drive.
Run in terminal this command and enter password:

~/wdpassport-utils.py -u

I can see wdpassport-utils.py in my /home, but when I try this command I get;
‘bash: /home/easyt50/wdpassport-utils.py: Permission denied’… then I tried as root;

‘root@8300:/home/easyt50# ~/wdpassport-utils.py -u
bash: /root/wdpassport-utils.py: No such file or directory’ …then I tried;

easyt50@8300 ~ $ sudo ~/wdpassport-utils.py -u
sudo: /home/easyt50/wdpassport-utils.py: command not found

Any Thoughts?

chmod +x /home/easyt50/wdpassport-utils.py
python /home/easyt50/wdpassport-utils.py
2 Likes

It’s pretty much Linux 101 stuff.

:+1::+1::+1::clap::clap::clap: You did it! I can now read / write to my WD Passport drives!

And if you could explain what the last 2 commands did. Not that I will understand all of it, but I am trying to learn.

1 Like

Linux File Permissions


https://securitytweak.com/2019/01/30/how-to-run-python-scripts-on-linux-os/

2 Likes

Hey, @Akito, if I may? :wink:

The first line changed the permissions on that particular file “wdpassport-utils.py”, so that it can be executed as a “program”.
The second line was simply the execution of the sayd file (wich happens to be a Python program/script and is now executable because of the first command) with the help of the python interpreter that is present on your system.

More information on this topics in the links from Akito

2 Likes

You could be a teacher. Thanks

1 Like

Man, how do you know these things! Lots and lots of experience, I suppose.
I will give it a try.

1 Like

because the full solution was spread across a few different posts, @easyt50 was kind enough to put all of the necessary commands together:

sudo apt-get install python-pip python-dev lsscsi

sudo apt install python-setuptools python-wheel

sudo pip install py_sg

cd ~; wget https://raw.githubusercontent.com/evox95/wdpassport-utils/master/wdpassport-utils.py

chmod +x /home/user/wdpassport-utils.py

Then
Plug in your password protected drive.
Run in terminal this command and enter password:

sudo python /home/user/wdpassport-utils.py

sudo ~/wdpassport-utils.py -u

1 Like