Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Permissions issue USB external hard drive CLOSED

Here you can discuss every aspect of Debian. Note: not for support requests!
Post Reply
Message
Author
User avatar
mike acker
Posts: 131
Joined: 2017-06-28 21:23

Permissions issue USB external hard drive CLOSED

#1 Post by mike acker »

I've been using an external hard drive tonight,with a USB connection

I ran into a permissions issue: the drive mounted at /media/<user>/<partition name>
but didni't pickup my permissions -- rather -- it was owned by root

I fixed it by navigating to /media/<user/ and then issuing a
sudo chown -R <user> <partition name>

I'll have to do it every time I use the disc -- but -- that's OK -- it's an offsite backup disc

still -- it occurs to me -- on SD chips, and thumb drives -- these are usually FAT32 devices -- and have no permissions
the external hard drive -- the partition -- i formatted it as ext4

when SD chips or thumb drives are mounted -- Debian does not ask for authentication. but when an internal drive is mounted -- it does -- and ends up with the right user

when the ext4 partition is mounted via USB -- again -- the system does not ask to authenticate.

is there a bad test here? i.e. does the system determine not to ask for authentication based on the use of the USB bus -- rather than the type of partition ??
Last edited by mike acker on 2018-12-04 17:29, edited 1 time in total.
Viva la Resistencia

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Permissions issue USB external hard drive

#2 Post by bw123 »

...
I ran into a permissions issue: the drive mounted at /media/<user>/<partition name>
but didni't pickup my permissions -- rather -- it was owned by root
...
Why would the owner and/or permissions change depending on who mounted it?
resigned by AI ChatGPT

User avatar
mike acker
Posts: 131
Joined: 2017-06-28 21:23

Re: Permissions issue USB external hard drive

#3 Post by mike acker »

bw123 wrote:
...
I ran into a permissions issue: the drive mounted at /media/<user>/<partition name>
but didni't pickup my permissions -- rather -- it was owned by root
...
Why would the owner and/or permissions change depending on who mounted it?
my first thought was that the owner and permissions would be inherrited -- from the parent directory -- in this case - <user>

you would think a USB attached hard drive would mount just like a thumb-drive (automatic) -- or -- just like an internal SATA drive (requires admin password to approve the mount).

nope I had to do the chown myself

I think the difference is in in the partition type: the thumb drive will be FAT32 ( no permissions supported ) v. the hard drive -- which has an EXT4 partition
Viva la Resistencia

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Permissions issue USB external hard drive

#4 Post by bw123 »

I understand the confusion. I think this type of automount is done (mostly) through udisks2 and policykit, at least that's how it seems to be handled on plasma in stretch. They are freedesktop.org projects I think, and might be implemented differently on different desktop environments. I never saw an ext fs inherit permissions, but I guess anything is possible. You would probably do better looking up the way they work on your specific desktop, it's not really a debian issue.

The way I understand it, a device or fs itself does not have an 'owner' or set of permissions. Every single file and dir entry on ext fs has separate owner and permission set on each file. They are assigned as numbers, uid and gid, and translated to user names by the system. uid0=root, first 'regular' user is usually uid 1000. When a file is created, the owner and permission is created along with it. Copying usually preserves these, some filemanagers let you turn this off, or select to copy without preserving attributes. In that case the copying user would probably be owner, and permissions might be inherited from the parent dir? Every file and folder will have an owner and permission set in any case, AFAICT.

I never have an issue with usb flash or external drives, they seem to work the same for me on kde but that may be more luck than anything. Troubleshooting the freedesktop policies is very aggravating, so I'lll leave that to you. Let people know what you find out? Thanks.
resigned by AI ChatGPT

User avatar
mike acker
Posts: 131
Joined: 2017-06-28 21:23

Re: Permissions issue USB external hard drive

#5 Post by mike acker »

bw123 wrote:I understand the confusion. <snip>

I never have an issue with usb flash or external drives, they seem to work the same for me on kde but that may be more luck than anything. Troubleshooting the freedesktop policies is very aggravating, so I'lll leave that to you. Let people know what you find out? Thanks.
thanks; making a record of my experience with this was the actual purpose

this morning when I fired up the system again -- the external/USB hard drive mounted with me as the owner

from that I conclude that the owner ID is probably updated and recorded in the partition definition

as we all know: with a new disc -- which this one was -- it is first necessary to define a partition table. Once that's done partitions can be defined, and added to the disc. I took the default partition table: "MSDOS" -- which allows for four primary partitions -- and -- I think works for up to 2TB drives -- which this one is. I added only one partition as I am using this drive as an offsite backup. The partition was defined as EXT4 -- and given all the remaining space on the disc.

A label is assigned to the partition, in this case: Backup_Vol6

when the disc is to be used, the partition is mounted -- using the Partition label. It mounted automatically at /media/<user>
so al I had to do was open a command line terminal, navigate to /media/<user> and issue the chown -- using sudo.

I used the lsblk command to discover where the device had mounted itself.
Viva la Resistencia

Post Reply