Harddrive access denied Linux Fedora 36

Was attempting to setup SyncThing on Fedora 36, so my phone sends its pictures to my PC. ATM it’s not syncing because it says it’s a “read-only file system”. I attempted to go into the properties of the drive and set users to be able to both read and modify content hoping it would fix the issue, but it gave this error (see pic). Any clue what I’m supposed to do?

sudo chmod -R u+rw /run/media/[...] should do it (it recursively changes the permission for the user who owns that file so they can read and write to that file/folder and every subfolder/file). If not, sudo chown -R $USER /run/media/[...] and then run the command above again (it changes the owner of that file and folder recursively). Don’t forget to omit the [...] and give the actual full path. Please keep a backup just in case…

I see it is an external drive, so if it is ExFAT, FAT32 or lower, those file systems do not support file ownership (not just those, but I would imagine you would have them. Look up whether your FS supports file ownership and permissions). So to write to those, you would need to run your Syncthing client as root (the one on your computer)

PS: It goes in the command line :stuck_out_tongue:


Not sure why it shows up as external, it isn’t. Just a normal HDD sitting inside my PC with a SATA data cable plugged in (and power ofc). Anyway TY, I shall try it. and I’ll make sure syncthing is turned off so it doesn’t sync any changes to my phone (where the originals are), just in case it does happen to delete everything. It’s set to receive only but still just to be safe. :smiley:

Update, it didn’t work. my bro messed around with it about. apparently it’s what you said, the file system format isn’t right. so ig I’m formatting to one that will work lol. backing up the pics just to be safe though. taking a long time :frowning:

I doubt your file system of an internal drive is formatted with an old/obscure (at least I’d assume only those don’t support ownership) though. In the end, you can run Syncthing as root on your computer but I definitely don’t recommend it unless there is just no way that can be exploited (like in a virtual network that doesn’t have internet access and your end device stays on that network)… Either way, have fun :d

1 Like

This is not accurate. If it was, you wouldn’t be able to plug in a FAT32 flash drive and write to it without performing all your write operations as root.

The more accurate answer is that it depends on how the filesystem was mounted.

From the mount(8) man page:

   Mount options for fat
       (Note: fat is not a separate filesystem, but a common part of the
       msdos, umsdos and vfat filesystems.)

       uid=value and gid=value
           Set the owner and group of all files. (Default: the UID and
           GID of the current process.)

           Set the umask (the bitmask of the permissions that are not
           present). The default is the umask of the current process.
           The value is given in octal.

           Set the umask applied to directories only. The default is the
           umask of the current process. The value is given in octal.

           Set the umask applied to regular files only. The default is
           the umask of the current process. The value is given in
   Mount options for ntfs
       uid=value, gid=value and umask=value
           Set the file permission on the filesystem. The umask value is
           given in octal. By default, the files are owned by root and
           not readable by somebody else.

Either way, it’s likely something to do with age. I forgot to mention, but I pulled the HDD from a pretty old server PC. the HDD was in apparent great condition, and free, hence why I went with it.

When a drive is mounted under /run/media/, that is usually because it was mounted by udisks rather than the mount command or fstab. If you mounted the drive without needing root permissions (assuming you didn’t specially edit your fstab with the user flag), you used udisks — this is how most (all?) file managers mount drives.

Regardless, this is only tangentially related to the matter at hand.

What filesystem is currently on the drive? Some filesystems (*cough* Microsoft ones *cough*) are highly prone to corruption.

Are you able to read and write files to the drive manually? Is Syncthing running as your user (I believe this is the typical behavior)? Is Syncthing running with any additional sandboxing/restrictions?

I am not able to write to the drive manually. I do not know what filesystem is currently on it. I originally set it up with Windows 10 if that helps any, but it worked the entire time (and even worked for Linux Mint), only now when I try on Fedora has it not worked. tmk, Syncthing is running as user, I didn’t do anything to attempt to make it run anything different.

You have given all the right hints to solve your problem.

The filesystem in use is NTFS. NTFS is a :nauseated_face: filesystem from Microsoft that does absolutely nothing better than ext4. So I recommend reformatting as ext4 (or another good non-proprietary filesystem, such as a COW one) anyway, but in the meantime you can make it work by installing ntfs-3g.

If you’re running Fedora 36, I believe you’re using btrfs for the file system. That could explain why Linux Mint worked for you but Fedora did not. I think Fedora is one of the few distros that ships with btrfs on the latest stable release.

If you’re not married to Fedora, it could be worth switching back to Linux Mint or something else Ubuntu based. Assuming btrfs is part of the problem, a new distro would be an easy way to sidestep it.

Very late reply. Anyway personally I’d rather format my drive than switch distros. I just haven’t got around to it yet haha
Anyway ty

also late reply:
about mounting drives with ntfs filesystem into Linux:
by default they get mounted read only. Linux does that pretect the data on those devices the reason: Linux uses a reverse engineered driver for ntfs file systems as microsoft does not offer much documentation for ntfs.

linux can read from ntfs drives just fine. its writing that can bring problems and in the worst case corrupt the whole drive.

as other already wrote: ntfs is a bad file system. any modern file system linux uses is better than ntfs. if you dont need the data on the ntfs drive just format it to a linux file system. btrfs or ext4 are good choices :slight_smile:

Very late reply x2:

Others have already said my initial suggestions: permissions issues on mount (which you can fix with mount options) or fs corruption forcing it to mount read-only (not as easily fixable).

So I will add a third (admittedly unlikely) guess to add into the mix: SELinux contexts. AFAIK Mint does not support SELinux, so your drive won’t be labeled with SELinux labels. I’m not sure how that behaves in an SELinux enforcing environment like Fedora. I would not be surprised if it turned the whole thing read-only. I doubly don’t understand how SELinux would behave with NTFS, so that just adds to the mix.

As a sidenote: Check the SMART data on your drive as well, maybe it’s starting to fail. RO mounts are symptoms of that as well.

Kind of a meta note, but in my opinion there is no such thing as late replies on here. :slight_smile:

If anything, it’s better to chime in if you’re able to because it collects more information and experience into fewer threads, thus making research through our community-built database more convenient for future people!

Ok, so with the help of y’all here I was able to get it working. Yes, the problem was indeed the file system (it was for sure NTFS; partition manager told me that). I was unable to format the drive at first. Turns out I had to unmount the drive, then format it using ext4 (used this website as a guide: How to Format Disk Partitions in Linux {ext4, NTFS and FAT32}), then remounted it, and ran mazer’s suggested commands:
sudo chown -R $USER /run/media/[...] then: sudo chmod -R u+rw /run/media/[...] (ofc inputting my filepath instead)
I was then able to send/edit/delete any file, and thus SyncThing was able to copy my pics there as well.
Now I have everything working properly again! Thanks guys! :smiley: