Changing Drive Access from Root to User

I suppose someone has to post the first Help Desk post so it might as well be me.

I’m running Kubuntu 19.04 with 5.0.0-27-generic kernel. The os is running on a nvme m.2 Samsung drive. There are a number of other internal hard drives connected. They have all had a partition created on the drives and they are all mounted. But I only have access to one non-OS drive. I as user have access to that drive in Dolphin The other drives show up in Dolphin but access is limited to root and Dolphin does not allow me to change read/write access to those other drives. This has always been a problem on this computer. Externally installed drives don’t that that problem. Any advice in changing the permissions for those other drives would be appreciated. Thanks

As in you can’t mount the drive at all, or the drive mounts but you cannot access it’s contents?

The drives are mounted but read/write access is restricted to root and Dolphin isn’t allowing access to be changed to user from root.

What filesystem for them?

You can fix it in terminal, either way, but if it’s supported, this is a perfect use case for acls.

If it’s a posix filesystem (ext4, xfs, btrfs, zfs, …), I’ve done this with a find command:

find . -type d -print0 | xargs -0 setfacl -d -m u:<username>:<permissions as rwx>
find . -type d -print0 | xargs -0 setfacl -m u:<username>:<permissions as rwx>
find . -type f -print0 | xargs -0 setfacl -m u:<username>:<permissions as rwx>

That’ll hit all directories and files, and ensure new files in those directories have the same permission.

I generally use ext4 for the file system. I’m looking at gparted and see that the 1 TB drive that the system can access is NTFS for the file system for some reason.

As a test I switched a previously unaccessible drive from ext4 to ntfs and now it’s accessible. What gives I wonder?

They must be formatted NTFS. No way I can think of for that to be an accident. Lend them to someone lately?

No, they were all new drives. I reformatted one of the drives to make sure it was formatted as ext4 but when I tried to access it in Dolphin it wasn’t accessible.

Never heard of new drives being formatted NTFS, unless they are USB drives.

Best I can suggest is to reset the partition table, or even clear it using wipefs, then making the partition(s) again.

Dolphin, at the moment, can’t do anything with drives that are owned by root. You have to manually change the ownership to you via chown (or create a folder and make it belong to you). This is the only downside of Dolphin.

1 Like

Thanks, I’ll try to figure that out. I did re-format a drive into ext3 in gparted but Dolphin still doesn’t allow access.

Go to the location of the mounted drive (usually in /media/$USER) and enter this in the command line:
sudo chown $USER:$USER .

I do suggest that instead of doing that, create a folder on that drive, leave the owner of that drive as root and make the newly-created your own.

sudo mkdir <folder name>
sudo chown $USER:$USER <folder name>
1 Like

That worked. I created a Media folder in each previously inaccessible drive then changed the owner to allow user access to those Media folders. Thanks a ton.

An update. While the recommendation did give me access to some drives it did not give me access to all. I asked a buddy of mine to come up yesterday to give me a hand and we got the other drives accessible.

I’m going off memory so some of the details may be wrong but I wanted to post them in case someone else had the same problem.

Open root/media/username and the mounted drives should be there.
Find the drive you want to change access from root to user.
Copy the name of that drive.
Open that drive in the terminal using Shift+F4.
Change from user to root in the terminal using su and entering your root password.
CD into that drive using cd /media/username/drivename
Then mkdir Media to create a user accessible folder on that drive. You don’t have to name it Media.
Then chown -R $USER:$USER/media/username/drivename/Media

That should give user access to the drive. That is if I remember what we did yesterday correctly.

1 Like