Permissions on a new USB flash drive

7 replies [Last post]
amenex
Offline
Joined: 01/04/2015

After years of accumulating scan results, my HDD is filled up to within 2GB
of its 1TB capacity, so operations of most kinds are excruciatingly slow. It
really does not like editing 2GB text files in LeafPad.

I acquired a new SanDisk 256GB drive, removed its partition table, and formatted
the new partition ext4 with GParted.

Using sudo, I created folders and even changed permissions using
sudo chmod -R 755 Thumb256A
... but they don't change: still root, through & through.

The thumb drive mounts itself when I place it in the USB port, but the permissions
impasse won't let me cut & paste into it.

I have another 256GB thumb drive which was never reluctant to accept new files, but
I don't remember what I did right with that one that I'm not doing today. It's
full, too, however.

The 'puter is a Lenovo T420 ThinkPad running flidas with 8GB of RAM and 18GB of
swap space.

I'm not used to devices that are more difficult to use with trisquel than was the
task of getting them out of the maker's packaging.

George Langford

amenex
Offline
Joined: 01/04/2015

boba provided some historical experience of successs ...

Actually, GParted performed the necessary operations to remove the original msdos/ext4 and
replace it with gpt/ext4 in about five minutes; then I used
sudo chmod -R 755 Thumb256B as before, but still its permissions are staying
the same. So there's another issue involved; except that I _really_ need to offload data.

George Langford

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

After years of accumulating scan results, my HDD is filled up to within 2GB of its 1TB capacity, so operations of most kinds are excruciatingly slow. It really does not like editing 2GB text files in LeafPad.

Nobody should ever do that: learn sed, awk, etc. Also, compressing text files is very effective, as in dividing the size by ~10 with XZ. You can start your command line with (z|bz|xz)cat. less can read those compressed formats too.

sudo chmod -R 755 Thumb256A

With such permissions, only the owner (root, apparently) can write. You can change the owner (and the group) with 'chown':

$ sudo chown -R $USER:$USER Thumb256A

Or you can use a graphical file manager, e.g., 'sudo caja' for Trisquel's default file manager.

amenex
Offline
Joined: 01/04/2015

Magic Banana comes to the rescue yet again:
"With such permissions, only the owner (root, apparently) can write. You can change the owner (and the group) with 'chown':"
$ sudo chown -R $USER:$USER Thumb256A

Which I successfully applied as follows:
$ sudo chown -R $USER:$george Thumb256A

I was previously unaware of that usage of chown; even Google didn't help.

George Langford

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Every user is normally alone in a group with the same name, $USER if that user is executing the command. $george is the content of the shell variable george, an empty string if that variable is not defined. It is probably the case on your system. If so, the command did the right thing. Indeed, according to 'info chown':

OWNER‘:’
If a colon but no group name follows OWNER, that user is made the
owner of the files and the group of the files is changed to OWNER’s
login group.

amenex
Offline
Joined: 01/04/2015

boba inquired about my experience with the full-up 256GB thumb drive:

What I wrote:
I have another 256GB thumb drive which was never reluctant to accept new files, but I don't remember
what I did right with that one that I'm not doing today. It's full, too, however.

"Could you check which file system its partition is using?
If it is using fat, then the explanation is complete."

GParted tells me the file system is msdos (i.e., same as the drive vendor used).
Formatted to ext4. "Permissions not determined." I could read & write right off.

I'll apply Magic Banana's chown solution
sudo chown -R $USER:$george IPv4
Afterwards, its little red light blinked for a couple of minutes while it was doing it recursive thing.
Properties: I've got the 755 permissions now; 77,474 items, totalling 226.1 GB.

Thanks for looking into this. Your theory is correct, it seems. Linux is more secure !
George Langford

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

sudo chown -R $USER:$george IPv4

I repeat: "$george is the content of the shell variable george, an empty string if that variable is not defined. It is probably the case on your system". So, you can just write:
$ sudo chown $USER: IPv4

I've got the 755 permissions now

I doubt you actually wanted all files to be executable (by any user). But that is what you got with 'sudo chmod -R 755'. You certainly just wanted to change their owner and group.

nadebula.1984
Offline
Joined: 05/01/2018

Setting 755 permission is far too dangerous. Use chown instead, and set the permission to 700 (i.e., other users have no access to your files at all).