andlabs / reallymine

WD MyBook encrypted hard drive decryption (still WIP).
https://github.com/andlabs/reallymine/issues/38
GNU General Public License v3.0
215 stars 48 forks source link

Access permissions denied to drive, ./reallmine trick doesn't seem to work as root #77

Open soulbrix opened 6 years ago

soulbrix commented 6 years ago

I've successfully installed this software, but I can't run it as root. Basically, if I run reallymine as a normal user, it says I don't have permission to access the drive, but if I sudo it, it says it doesn't recognize the command itself. I tried following the instruction to add ./ before reallymine, but it doesn't seem to work, but I might be doing it incorrectly. Can you help me with this? Thanks.

themaddoctor commented 6 years ago

You tried "sudo ./reallymine"? Did you remember that linux/mac are case-sensitive?

themaddoctor commented 6 years ago

Are you sure that sudo is actually installed?

blonkm commented 6 years ago

Try 'ls -al' to check that reallymine is really there. Try 'chmod +x ./reallymine' now run 'sudo ./reallymine' again

andlabs commented 6 years ago

./ only works if the binary is in the current directory; if not, you'll need to specify the path to it somehow.

soulbrix commented 6 years ago

Try 'ls -al' to check that reallymine is really there. Try 'chmod +x ./reallymine' now run 'sudo ./reallymine' again

I have this:

total 101860 drwxr-xr-x 18 ssantos ssantos 4096 out 29 23:12 . drwxr-xr-x 3 root root 4096 out 27 14:07 .. -rw------- 1 ssantos ssantos 1801 out 28 12:36 .bash_history -rw-r--r-- 1 ssantos ssantos 220 out 27 14:07 .bash_logout -rw-r--r-- 1 ssantos ssantos 3837 out 28 12:06 .bashrc drwx------ 17 ssantos ssantos 4096 out 28 12:08 .cache drwx------ 14 ssantos ssantos 4096 out 28 11:26 .config drwxr-xr-x 2 ssantos ssantos 4096 out 28 11:26 Desktop drwxr-xr-x 2 ssantos ssantos 4096 out 27 14:29 Documents drwxr-xr-x 2 ssantos ssantos 4096 out 28 11:47 Downloads -rw-r--r-- 1 ssantos ssantos 8980 out 27 14:07 examples.desktop drwx------ 3 ssantos ssantos 4096 out 27 15:06 .gnupg drwxr-xr-x 11 root root 4096 out 4 2017 go -rw-r--r-- 1 root root 104197862 out 28 11:36 go1.9.1.linux-amd64.tar.gz drwxr-xr-x 4 ssantos ssantos 4096 out 28 12:08 go2 -rw------- 1 ssantos ssantos 1932 out 29 23:12 .ICEauthority drwx------ 3 ssantos ssantos 4096 out 27 14:29 .local drwx------ 5 ssantos ssantos 4096 out 28 11:17 .mozilla drwxr-xr-x 2 ssantos ssantos 4096 out 27 14:29 Music drwxr-xr-x 2 ssantos ssantos 4096 out 27 14:29 Pictures -rw-r--r-- 1 ssantos ssantos 843 out 28 11:28 .profile drwxr-xr-x 2 ssantos ssantos 4096 out 27 14:29 Public drwx------ 2 ssantos ssantos 4096 out 27 15:06 .ssh -rw-r--r-- 1 ssantos ssantos 0 out 28 11:18 .sudo_as_admin_successful drwxr-xr-x 2 ssantos ssantos 4096 out 27 14:29 Templates drwxr-xr-x 2 ssantos ssantos 4096 out 27 14:29 Videos

--

So, it doesn't seem to be there, but the command works by itself, as proven by typing just "reallymine" - it gives all the parameters it can take. I had a few issues installing go, as it didn't seem to install correctly. Had to modify the gopath. Do you think it may have something to do with that? I find it weird that it works without sudo, but then doesn't recognize it. I have a limited knowledge of this, ofc, but I was thinking that Go also has some kind of local vs universal user installation, as defined by the .profile file editing. I was wondering if that could also have anything to do with it.

themaddoctor commented 6 years ago

sudo runs something as root. root might not know about your GOPATH. So you are probably right, and need to set up the environment for root also.

soulbrix commented 6 years ago

Can you point me to the right direction in order to find info about this? Thanks.

themaddoctor commented 6 years ago

Not really. Log in as root and set up the environment the same way you did for ssantos.

soulbrix commented 6 years ago

I just created a new user and did everything by the book, but got the same error. I'm using Ubuntu, the latest version, if that affects anything.

themaddoctor commented 6 years ago

a new user is not the same thing as the root user.

maybe if you created a compiled ReallyMine executable, you could run it with sudo, and not have to worry about GOPATH.

soulbrix commented 6 years ago

https://medium.com/@patdhlk/how-to-install-go-1-9-1-on-ubuntu-16-04-ee64c073cd79 this was the guide I followed to set up Go.

I can try to create that complied executable, any guides I can follow? Thanks.

themaddoctor commented 6 years ago

I don't know. Maybe you can google it or someone else can help you. I have only done it once, and that was more than a year ago.

soulbrix commented 6 years ago

Somehow, I made it to work. At least, I think so. I tried running the command $ reallymine getdek /dev/sdb, is it supposed to take very long? Still testing if it is actually working, at least it ran on root, but I can't tell if the drive is spinning or just stopped.

soulbrix commented 6 years ago

Any information about this? I just need to know this so I don't waste 100 bucks on a 3 TB harddrive to get the contents from this one.

blonkm commented 6 years ago

I hope I remember correctly, but when I ran reallymine getdek it returned almost instantly.

themaddoctor commented 6 years ago

Which chip is on the bridge card? The OXUF and INIC chips often have the keyblock somewhere else and NOT on the user-readable part of the disk. Sometimes in the service area; for that, you need HDDSuperTool.

soulbrix commented 6 years ago

The board is a JMicron

themaddoctor commented 6 years ago

If it's a 3TB, try dumping the keyblock: sudo dd if=/dev/sdX skip=5860528160 count=1 status=none | hexdump -C where sdX is replaced with the name of the disk

soulbrix commented 6 years ago

It's a 2 TB, I thought of buying a 3 TB to extract it because I dunno if a 2 TB would work

themaddoctor commented 6 years ago

Then use the number 3907024928

soulbrix commented 6 years ago

Alright, thanks. Will it be quick? Just to gauge how long it should take when I do it.

themaddoctor commented 6 years ago

0.00001 seconds

soulbrix commented 6 years ago

OK, so I got this as a result:

00000000 57 44 76 31 c8 4e 00 00 00 88 df e8 00 00 00 00 |WDv1.N..........| 00000010 00 00 00 00 00 00 f0 00 00 00 00 00 00 00 00 00 |................| 00000020 01 00 00 00 00 00 46 50 00 00 00 00 00 00 00 00 |......FP........| 00000030 00 02 ff 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000050 20 00 d0 44 00 00 00 01 00 00 00 00 57 44 76 31 | ..D........WDv1| 00000060 96 ab bd 05 4b b7 ca f4 7d 1b 5d 0a 27 f1 7a 1e |....K...}.].'.z.| 00000070 85 ee 14 0f 5b 4e 7a 65 a8 17 6c 9c f1 e3 e5 b3 |....[Nze..l.....| 00000080 df 69 b3 d7 42 00 da fb 1e bc 15 2b 35 bf d7 32 |.i..B......+5..2| 00000090 be 43 c4 9a ca 1a 03 6c f9 fb c1 eb 1d 61 e0 25 |.C.....l.....a.%| 000000a0 85 30 9b 8c bd fd e2 12 8c 24 57 34 ea 66 07 ec |.0.......$W4.f..| 000000b0 ae 3d 30 55 8c 76 6b 2d 7a f8 6b 1c a1 19 ed f5 |.=0U.vk-z.k.....| 000000c0 66 b1 f8 3d 1b ad f4 cd c9 08 65 ff 4a a5 24 12 |f..=......e.J.$.| 000000d0 a6 99 60 c8 eb ca 22 38 24 b2 8f 29 07 68 bf 92 |..`..."8$..).h..| 000000e0 26 93 d0 c5 d9 f8 13 85 b4 ab be b7 a7 b5 b4 77 |&..............w| 000000f0 6d bb 6c 42 76 18 c0 85 31 bb 05 53 62 0d 35 fe |m.lBv...1..Sb.5.| 00000100 61 ed f9 d9 36 c0 75 e3 20 43 3a 47 f9 02 83 a4 |a...6.u. C:G....| 00000110 09 10 5d 39 4f c6 87 2c 0b 76 12 6b 3a c7 10 64 |..]9O..,.v.k:..d| 00000120 7a d1 01 18 2c 70 1c 90 af 8c 6d 7c 1f 78 96 9b |z...,p....m|.x..| 00000130 2b 19 ea 7a 4b 95 ed bc 31 30 72 42 58 ee e9 20 |+..zK...10rBX.. | 00000140 29 07 1b eb 22 93 65 0a b9 59 10 26 e7 14 3a 78 |)...".e..Y.&..:x| 00000150 bf f0 4d 62 f1 35 e2 5c d3 91 44 36 4b 96 0f da |..Mb.5...D6K...| 00000160 5f cf f6 c6 2b 3e 7c 80 c3 94 ad b3 f1 4b 5a 07 |_...+>|......KZ.| 00000170 14 82 19 ff 1e b0 7a 88 30 72 02 30 cd e5 7c 3d |......z.0r.0..|=| 00000180 dc 5a 0a d4 52 b2 64 25 25 d3 9b 2d f8 c1 19 93 |.Z..R.d%%..-....| 00000190 57 de e8 59 69 ca 8f d8 8a 22 ee 54 75 e0 39 2e |W..Yi....".Tu.9.| 000001a0 99 6d db 3c 0c fd 69 1f 69 8b d6 5c f8 55 e8 23 |.m.<..i.i...U.#| 000001b0 86 53 49 20 9f 92 91 a2 c8 0a 81 5d c0 ef 59 d3 |.SI .......]..Y.| 000001c0 96 7c 71 49 67 2b f6 54 6f a5 93 9d 09 dc 0f cf |.|qIg+.To.......| 000001d0 1f 48 9e 65 64 f6 e3 6a d6 de 69 98 49 34 bb f3 |.H.ed..j..i.I4..| 000001e0 03 08 32 99 9d df 29 c9 de e3 5d fd 9c a2 50 75 |..2...)...]...Pu| 000001f0 f0 67 76 51 5e e2 8c 72 7b 72 e1 e1 08 df da 9f |.gvQ^..r{r......| 00000200

What does it mean?

themaddoctor commented 6 years ago

Here's your DEK: 67f41df3e4bbfb9e4d4a99cf649c2527ec06c00460f27c2ff84c66c6f6ea8a2b

soulbrix commented 5 years ago

Hello, guys. I have finally got a 3TB drive to do this, but I have one more question: do I have to reinstall ubuntu on this new drive in order to create the image, or can I use the previous installation and somehow redirect the image to the empty disk? Thanks.

themaddoctor commented 5 years ago

Run ubuntu from a live CD or USB.

soulbrix commented 5 years ago

Hm, didn't think it would be possible to install the apps there, but I'll try. Thanks!

soulbrix commented 5 years ago

I set it all up and let it run during the night, only to find out it gave a input/output error on the to be decrypted drive. Is it a sign the disk has problems?

soulbrix commented 5 years ago

Also, @themaddoctor, I saw on this other thread (https://github.com/andlabs/reallymine/issues/32) that it seems to be possible to just mount the drive without creating a whole disk image, did I understand this correctly? Thanks

themaddoctor commented 5 years ago

https://github.com/themaddoctor/linux-mybook-tools/blob/master/Mounting%20encrypted%20WD%20disks%20in%20linux.pdf

soulbrix commented 5 years ago

Ok, it stopped and gave the same error at the same file size, 3,2 GB. I'll try that method then.

soulbrix commented 5 years ago

I followed your guide. Went well up until the very last step, where it said it couldn't read the superblock. Do you know why this could be?

soulbrix commented 5 years ago

before, this is what was shown:

/dev/mapper/wd: DOS/MBR boot sector MS-MBR XP english at offset 0x12c "Invalid partition table" at offset 0x144 "Error loading operating system" at offset 0x163 "Missing operating system", disk signature 0x21365; partition 1 : ID=0x7, start-CHS (0x0,32,33), end-CHS (0x3ff,254,63), startsector 2048, 3497361408 sectors; partition 2 : ID=0x7, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 3497363456, 409595904 sectors

then, I get this:

test@test-Aspire-M3910:~/wd$ sudo kpartx -a /dev/mapper/wd
test@test-Aspire-M3910:~/wd$ sudo mkdir -p /mnt/wd
test@test-Aspire-M3910:~/wd$ sudo mount /dev/mapper/wd1 /mnt/wd
mount: /mnt/wd: wrong fs type, bad option, bad superblock on /dev/mapper/wd1, missing codepage or helper program, or other error.
test@test-Aspire-M3910:~/wd$ 

Got this with dmesg | tail: [ 1158.253759] print_req_error: I/O error, dev sdg, sector 6293504 [ 1158.253777] Buffer I/O error on dev dm-3, logical block 786432, async page read

Disks utility says that the disk contains a bad sector - should I run "fsck"? Will it destroy the partition or just some data?

themaddoctor commented 5 years ago

should I run "fsck"? No Will it destroy the partition or just some data? Probably.

You could try copying the disk (through the decryption filter) with one of the ddrescue variants. They skip over bad sectors in the correct way. Then do your data recovery on the copy.

soulbrix commented 5 years ago

The ddrescue is going now, running on /dev/sdg - since the layer is active right now, I figure it's still doing the recovery through the filter, right? Or do I need to set it specifically to dev/mapper/wd?

themaddoctor commented 5 years ago

Or do I need to set it specifically to dev/mapper/wd?

yes

soulbrix commented 5 years ago

aaah, this is driving me insaaane, it was at 35% after 16 hours. Alright, I'll change it to that drive.

MrDecay commented 5 years ago

Patients is key

On Dec 12, 2018 10:46 AM, "soulbrix" notifications@github.com wrote:

aaah, this is driving me insaaane, it was at 35% after 16 hours. Alright, I'll change it to that drive.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andlabs/reallymine/issues/77#issuecomment-446657381, or mute the thread https://github.com/notifications/unsubscribe-auth/AQE6xe1af6Yv3JP_5Z4zl02AA2eYanntks5u4TLbgaJpZM4X98La .

soulbrix commented 5 years ago

I ***ed it up even more. I had 2 kernels but only one worked with the module, tried removing one using Synaptics, now the command to create the layers won't work and there is only a dm-0 device. Seems like it's a kernel issue. Will check if downloading the packages again fixes the issue.

sathyagooogle commented 3 years ago

bash: cd: music: Permission denied how to solved this problem