Disk ownership by root, how to change?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Gizmouk

Disk ownership by root, how to change?

Post by Gizmouk »

Hello all, I'm a recent convert from Windows having problems with the fact that 'root' owns all my disks. How can I change this to my user ID of 'chris' ?

Running this command (which I found on here) returns...

chris@office ~ $ mount|grep ^/dev
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sdd4 on /mnt/32CDD5731F873A12 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/sdb1 on /mnt/70C00943C0091150 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/sde1 on /mnt/usb-BUFFALO_External_HDD_0000141D5C32-0:0-part1 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/sdf1 on /mnt/wwn-0x50024e920290a857-part1 type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/sdc1 on /media/chris/Photos COPY type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096,uhelper=udisks2)

I have plenty of disks but can't do much as root ownership gets in the way.... I have tried mounting disks and using SUDO CHOWN like this...

sudo mount /dev/sdf1 /media/Xternal
sudo chown -R chris:chris /media/Xternal

But 'root' still retains ownership... I have re-booted in between

What am I doing wrong???
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
altair4
Level 20
Level 20
Posts: 11453
Joined: Tue Feb 03, 2009 10:27 am

Re: Disk ownership by root, how to change?

Post by altair4 »

Please post the output of this command:

Code: Select all

cat /etc/fstab
And this one:

Code: Select all

sudo blkid -c /dev/null
Most of those look like NTFS partitions so you can't chown, chmod, or pretty much chanything an ntfs partition. You need to specify ownership and permissions at the moment of mount or in fstab.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Mute Ant

Re: Disk ownership by root, how to change?

Post by Mute Ant »

The owner-and-permissions information is held in the file-system (not the disk) and only works normally if it's a POSIX file-system, like EXT2|3|4 or BTRFS. So you can't chown a FAT file-system, as an example.

Mounting non-POSIX file-systems like FAT or NTFS, you have to specify the owner and permissions during the mount. If you don't, linux will use root as the owner with read-only for everyone else. You can't alter that once the file-system is mounted.
Gizmouk

Re: Disk ownership by root, how to change?

Post by Gizmouk »

chris@office ~ $ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=714db5c8-96da-4963-a692-8629e3760f36 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=05617aad-37aa-44c9-a582-ddc95d49d80a none swap sw 0 0
/dev/disk/by-uuid/70C00943C0091150 /mnt/70C00943C0091150 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=PHOTOGRAPHS 0 0
/dev/disk/by-uuid/32CDD5731F873A12 /mnt/32CDD5731F873A12 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=INFORMATION 0 0
/dev/disk/by-uuid/0783AE3B2FA05626 /mnt/0783AE3B2FA05626 auto nosuid,nodev,nofail,noauto 0 0
/dev/disk/by-id/usb-BUFFALO_External_HDD_0000141D5C32-0:0-part1 /mnt/usb-BUFFALO_External_HDD_0000141D5C32-0:0-part1 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=exTivo 0 0
/dev/disk/by-id/wwn-0x50024e920290a857-part1 /mnt/wwn-0x50024e920290a857-part1 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=BACKUPS 0 0
chris@office ~ $
chris@office ~ $ sudo blkid -c /dev/null
[sudo] password for chris:
/dev/sda1: UUID="714db5c8-96da-4963-a692-8629e3760f36" TYPE="ext4" PARTUUID="8ca01ddc-01"
/dev/sda5: UUID="05617aad-37aa-44c9-a582-ddc95d49d80a" TYPE="swap" PARTUUID="8ca01ddc-05"
/dev/sdb1: LABEL="PHOTOGRAPHS" UUID="70C00943C0091150" TYPE="ntfs" PARTUUID="cb368b55-01"
/dev/sdc1: LABEL="Photos COPY" UUID="17C3C9B727A74162" TYPE="ntfs" PARTUUID="18a2525d-01"
/dev/sdc5: UUID="1f8241a9-badb-4214-8190-3ace0d6fcf88" TYPE="swap" PARTUUID="18a2525d-05"
/dev/sdd1: PARTUUID="4b9b0b6f-15b8-4d81-bb61-d4eb972b16cb"
/dev/sdd2: UUID="0783AE3B2FA05626" TYPE="ntfs" PARTUUID="2e83a41b-9357-427f-b262-6adb83b45509"
/dev/sdd3: UUID="d68f15ea-8df8-4361-98e1-3fb43b128497" TYPE="swap" PARTUUID="6101c458-13f8-4e70-b109-c021c4f55cb3"
/dev/sdd4: LABEL="INFORMATION" UUID="32CDD5731F873A12" TYPE="ntfs" PARTLABEL="INFORMATION" PARTUUID="fce91bbd-bf60-41a2-8438-a5e2426b0e84"
/dev/sde1: LABEL="Xternal" UUID="0B15DAD267233B27" TYPE="ntfs" PARTUUID="71b2bc6b-01"
/dev/sdf1: LABEL="ExTivo" UUID="24849F6370C511E4" TYPE="ntfs" PARTUUID="d442c640-01"
chris@office ~ $

I think these are nearly all NTFS, moved over from my Windows system..... THANKS!
altair4
Level 20
Level 20
Posts: 11453
Joined: Tue Feb 03, 2009 10:27 am

Re: Disk ownership by root, how to change?

Post by altair4 »

Let's take this one as an example:
/dev/disk/by-uuid/32CDD5731F873A12 /mnt/32CDD5731F873A12 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=INFORMATION 0 0
First: A rant: Lord have mercy I hate what the Disks utility does to fstab.

Second: In the context of that line I'm not sure what you meant by "can't do much as root ownership gets in the way". It's true that with that line it will be owned by root but by default an NTFS partition in fstab unless directed otherwise will allow read / write to everyone.

Third: If you want to change ownership you need to add another option you your list: uid
/dev/disk/by-uuid/32CDD5731F873A12 /mnt/32CDD5731F873A12 auto uid=chris,nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=INFORMATION 0 0
So unmount the partition:

Code: Select all

sudo umount /mnt/32CDD5731F873A12
Edit fstab and add the uid=chris option to that specific line.

Then remount with this command:

Code: Select all

sudo mount -a
The partition will now be owned by you.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “Beginner Questions”