1

What is the correct way to mount a disk image so all users (guest included) are able to access it?

I'm currently stuck after mounting it with:

sudo mount -o loop,users,ro,offset=262145048576 '/path/Disk Image.img' '/media/guest-Folder/Disk'

My normal user session can access it, but on a guest session I get an error: "This location could not be displayed. You don't have the permissions necessary to view the contents of Disk" while trying to view the contents in Nautilus.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
eridani
  • 1,362
  • 3
  • 10
  • 27

1 Answers1

1

The guest session is prevented to access it because of the default AppArmor setting. One way to fix it should be to open this file for editing:

sudo nano /etc/apparmor.d/abstractions/lightdm

find these lines:

owner /{,run/}media/ r,
owner /{,run/}media/** rmwlixk,  # we want access to USB sticks and the like

and remove the owner keyword so it looks like:

/{,run/}media/ r,
/{,run/}media/** rmwlixk,  # we want access to USB sticks and the like

But that would give the guest users access to all mounted stuff, which would defeat the security scheme. So I would rather add a new rule, so it looks something like this:

/{,run/}media/ r,
owner /{,run/}media/** rmwlixk,  # we want access to USB sticks and the like
/media/guest-** rmwlixk,
Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
  • Thanks, seems it didn't worked. Tried sudo apparmor_parser -r /etc/apparmor.d/abstractions/lightdm to reload the profile as suggested in http://askubuntu.com/a/190297/251621 but got AppArmor parser error for /etc/apparmor.d/abstractions/lightdm in /etc/apparmor.d/abstractions/authentication at line 17: syntax error, unexpected TOK_MODE, expecting TOK_OPEN error. – eridani Aug 05 '16 at 21:48
  • @eridani: Try sudo apparmor_parser -r /etc/apparmor.d/lightdm-guest-session instead. – Gunnar Hjalmarsson Aug 05 '16 at 22:05