Page 1 of 5

[Abandoned] Can't take ownership of exFAT HDD's

Posted: Mon Feb 11, 2019 12:31 pm
by Death
I've abandoned this issue. Thanks for the help! Original post below:

I recently seem to have lost ownership of my external, exFAT formatted USB HDD's. Root owns them now. I recently ran Photorec to look for some deleted files and noticed this issue after that. But I also downgraded my kernel too so I'm not sure if it's that which has caused it. Anyway, Im using Linux Mint 19.1 and I opened my file manager (Nemo) as root and then tried to change the ownership of these HDD's back to my user account via the GUI but it just tells me that the operation is not permitted. If I can't change it as root then how can I actually get these drives back? :shock:
Thanks!

Updates:
* Apparently these drives were mounted as Ready Only. I've successfully remounted the drives with Read/Write access.
* GUI & Terminal methods for taking ownership are still returning "Operation not permitted" messages. Root still owns them.

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 1:23 pm
by merlyn
Try using chown from the command line.

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 1:46 pm
by Death
merlyn wrote:Try using chown from the command line.


Yeh I did that already and it didn't work :(

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 1:47 pm
by merlyn
you used sudo chown?

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 1:55 pm
by Death
merlyn wrote:you used sudo chown?


I believe so. But to be honest, I forgot the exact command I used which is why I didn't mention it in my opening post. I'm actually just looking up some commands for this now so I can try again. I will post back with results. Thanks :wink:

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:01 pm
by Death
Ok. So I just tried:

Code: Select all

sudo chown myusername:myusername mountpoint

I obviously used my actual username and mountpoint for the drive when I did that. The result was:

Code: Select all

chown: changing ownership of 'mountpoint': Operation not permitted


This is what happened before. Is there another command I can try? Cheers.

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:02 pm
by merlyn
You may have mounted the drives read only, or something like that rather than this being a permissions issue.

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:08 pm
by merlyn
You need chown -R to operate recursively on a whole drive.

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:10 pm
by Death
merlyn wrote:You need chown -R to operate recursively on a whole drive.


I tried that just now but it's the same results.

I suspect Photorec may have made the drives Read Only the other day. Any idea how I would check and change that?

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:14 pm
by merlyn

Code: Select all

mount -l

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:23 pm
by Death
merlyn wrote:

Code: Select all

mount -l


Cheers. Although I did try that just now and got another permission denied (or similar) message. However, I found a command from here which I've modified for my system: https://askubuntu.com/questions/333287/ ... -read-only
Actually looks like it might be working and my backup program is able to run tasks again. So yeh, I learned something new today! Time to take more notes :P If I get more issues I will post back. Thanks for the help!

Edit: Actually, the command I tried was

Code: Select all

fdisk -l
which still gives the ouput

Code: Select all

fdisk: cannot open /dev/sda: Permission denied
fdisk: cannot open /dev/sdb: Permission denied
fdisk: cannot open /dev/mapper/mint--vg-root: Permission denied
fdisk: cannot open /dev/mapper/mint--vg-swap_1: Permission denied
fdisk: cannot open /dev/mapper/cryptswap1: Permission denied
fdisk: cannot open /dev/sdc: Permission denied
fdisk: cannot open /dev/sdd: Permission denied


Code: Select all

mount -l
works.

Just added that for clarity. I was getting confused amongst all this :lol:

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:41 pm
by merlyn
The 'Permission denied' when you tried fdisk isn't an error. You need to run fdisk with sudo. The only part of the filesystem you as a normal user have access to is your home folder. So since /dev/sda is in / you need sudo to access it.

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:43 pm
by Death
Damn it. Spoke too soon!

I forgot about trying to take ownership of the drives again. I tried via GUI and terminal methods once more but still got "Operation not permitted" :(

So, my drives are mounted with RW access now. I can create new folders and files in them so I assume so anyway. But, root is still the owner and I can't take them. Any ideas what to try next?

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 2:56 pm
by merlyn
I'm not sure what you mean by 'take'. If you can write a file then all would seem to be well.

Look at the owner of the files and folders. Are they 'root'?

Re: Can't take ownership of HDD's as root

Posted: Mon Feb 11, 2019 3:00 pm
by Death
merlyn wrote:I'm not sure what you mean by 'take'. If you can write a file then all would seem to be well.


Take ownership I meant. My backup program has been stalling and returning errors about permissions ever since this issue appeared. I cannot do any backups right now because of this. I've checked the drive for errors and it's apparently ok. I've reformatted it too. Something happened around the time I used Photorec and I think it's changed something in my config somewhere. This is why I want to take ownership of these drives so I can see if my backups work again..