2

I have 5 internal drives and 3 external.

I would like the internal drive's files to be owned by my default user hutber

I have tried to chown them with sudo as seen here:

enter image description here

It looks successful, however enter image description here

I am unsure if its possible to change, but here is my mount options for the drive

enter image description here

And just an overview of all drivers. With the drive in question on display.

enter image description here

  • lol a downvote? What for? – Jamie Hutber Oct 27 '17 at 22:27
  • You guys over here aren't very helpful with giving me feedback on why the question sucks. Any idea would help a lot guys. – Jamie Hutber Nov 3 '17 at 10:39
  • I agree that 'your question sucks ...' comments are not very helpful. Surely this site is supposed to be catering for all levels of users? – Time4Tea Nov 3 '17 at 14:57
  • I upvoted your question, because although you seem to have some misunderstanding about file ownership, you've made an effort with your question and included several screenshots. – Time4Tea Nov 3 '17 at 15:33
1

Is this drive mapped in /etc/fstab? If so, you can modify the options there, this "nosuid" option need to be removed as others have pointed, and you can also add "gid=ownerGroupID, uid=ownerID" to the options list in order to have the files on the drive explicitly mapped to particular uid/gid and these be further usable to you.

  • Ah indeed, exactly what I was after. Now I wonder, will this has any implications on the drive :D Thank you and sorry I didn't get to this intime for the bounty. I was away for 9 days :( – Jamie Hutber Nov 12 '17 at 23:33
6
+25

When you mount something, you mount a filesystem: Basically, a particular way to assign a number of disk blocks to some file name. A filesystem usually occupies one partition, and there may be several partitions on a harddisk.

Unix-centric filesystems (like ext2, ext3, ext4) implement the concept that every file "belongs" to a particular user (uid) or particular group (gid`).

Other filesystems (FAT, NTFS) may not implement this concept, or may have other ideas what constitutes a "user". In this case, Linux sometimes tries to map the "foreign" ownership and permissions to Linux ones, and sometimes it just assigns a particular user and group to all files.

So:

  • You can't just change ownership of all files of an ext-filesystem to a particular user using mount options. You can apply chown and/or chgrp to it, but in many cases this may not be a good idea, in particular for a filesystem that contains your Linux system files and programs.

    Therefore, don't do that. Instead, make sure your own files are created with you yourself as owner. Create new groups and add yourself to the groups if necessary. In short, just do some sane administration. "All files should be mine" doesn't work.

  • If you want to mount a "foreign" filesystem, you can, depending on the filesystem, supply the uid and gid mount options. See man mount for details.

    This works fine for reading, and for writing FAT-based filesystems, but I wouldn't recommend it for writing stuff to NTFS-based filesystems.

  • It's not important if the disk is internal or external. In fact, the disk isn't important at all, the type of the filesystem is. You didn't say which types of filesystem you have, or even which partitions you want to use.

    The only thing one can see from the information you gave is that one of them is NTFS (the "2 TB" one, not the "8 TB"), which doesn't mix well with Linux in the first place.

You get downvotes because it shows that you haven't understood basics about Linux, and are about to do things that will bite you in the long run. Don't do those things.

  • :) Thanks for letting me know. I'm at work so can't test out these things yet, but I can do some further reading. I believe that if somebody was going to down vote me saying something in a similar vein to what you have written but in a much smaller form would have helped me out massively. I might be wrong, but downvoting and not taking any time to explain your actions is quite rude and unhelpful. But... #internet so I am not surprised lol I just would have appreciated some help. I'm a lite linux user having only started using it in the last 2 years and never needed to tough file systems. – Jamie Hutber Nov 3 '17 at 14:52
  • 'Your question sucks because you don't understand basics about Linux ...' isn't very helpful. Perhaps this guy is a new user and everyone has to start somewhere, right? I would have upvoted your answer if not for this comment. – Time4Tea Nov 3 '17 at 14:56
  • @Time4Tea: Of course new users have to start somewhere. That's why I wrote the answer and explained things. And he explicitely asked for feedback "why his question sucks". Maybe I shouldn't have quoted that... – dirkt Nov 3 '17 at 15:24
  • I didn't see him say in the question that 'his question sucks' (perhaps he edited it). I will reverse my downvote, as you changed your comment and your answer is good. I just don't think it's right that people should be criticized, just because they misunderstand a fundamental concept. – Time4Tea Nov 3 '17 at 15:36
  • @Time4Tea: It's in the comments below the question: "You guys over here aren't very helpful with giving me feedback on why the question sucks." So I was giving him feedback on "why the question sucks", as asked. I didn't intend to criticize him. Clearer now? – dirkt Nov 4 '17 at 7:34
0

I suspect this is due to the nosuid option used for mounting, and that you are mounting as root (at bootup).

The mount man page states:

suid
    Allow set-user-identifier or set-group-identifier bits to take effect.

nosuid
    Do not allow set-user-identifier or set-group-identifier bits to take effect. (This seems safe, but is in fact rather unsafe if you have suidperl(1) installed.)

That said, with anything to do with disks, take backups and read manuals before you do anything. And if you do do anything, make sure you have a WORKING backup!

  • (no)suid affects the suid mode bit (shown as s in ll, also see `man chmod) and not the owner/group of a file. – dirkt Nov 6 '17 at 19:49
  • Sadly indeed, this has no effect for me – Jamie Hutber Nov 12 '17 at 23:30
0

As others have suggested, it seems that the reason your file permission changes are not persisting may be because of compatibility issues between Linux and the NTFS file system (which is designed for use with Windows). There are a couple of pages here that describe some things you could try to get it to work:

Is NTFS under linux able to save a linux file, with its chown and chmod settings?

Any way of maintaining permissions when using NTFS mounted drive in Ubuntu?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.