8

I have 2 XFS partitions I want to mount via /etc/fstab:

/dev/sdb1        /media/data        xfs        defaults        0        2
/dev/sdc1        /media/backup      xfs        defaults        0        2

Both are mounted at boot but when I try to access it as a non-root user, I get

$ cd /media/data
-bash: cd: /media/data: Permission denied

$ ls /media/data
ls: cannot access /media/data/audio: Permission denied
ls: cannot access /media/data/documents: Permission denied
ls: cannot access /media/data/downloads: Permission denied
ls: cannot access /media/data/images: Permission denied
ls: cannot access /media/data/video: Permission denied
audio documents downloads images video

Note that from the ls command there is a Permission denied error but the last line shows the directory names although they are in red font. I have tried doing sudo chmod 766 /media/data and sudo chmod 766 /media/backup but I still get permission errors when trying to access said mount points as a non-root user.

I am using Fedora 20 and I am not sure if this has something to do with SELinux but in my previous setup with a partition of NTFS, I don't get these errors and the partition was accessible by non-root users.

2 Answers 2

1

766 doesn't allow the user to enter the directory because the "x" (execute) bit is not set. Better:

sudo chmod 755 /media
sudo chmod 755 /media/data
sudo chmod 755 /media/backup
3
  • chmod 755 does make the user enter the directory but doesn't allow writing. So I guess I'd have to go with chmod 777 as it seems to work. Question is, are there any security implications by doing this?
    – baktin
    Commented Feb 3, 2014 at 4:23
  • Well, yes there are security implications...but the only alternative is to give each user their own directory. As an aside, I don't like using /media/ for manual (/etc/fstab) mounts because Gnome's automount thingy likes mounting things there.
    – samiam
    Commented Feb 3, 2014 at 4:26
  • 2
    If you're on a single user system then chown /media/data and /media/backup so that your user owns these directories.
    – bsd
    Commented Feb 3, 2014 at 10:30
1

I have currently resolved this by:

  1. Creating a new group and add my user to the new group
  2. chgrp the mounts /media/data and /media/backup to created group
  3. chmod 775 to both mounts

I can now access said mount points as my user and any user added to the new group I've created.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .