Saturday, June 11, 2011

Permissions for mounting Externals


When mounting Externals, often the default permission will be that of the user mounting the device. This can create a barrier when wanting to access the External over a network. So when mounting, it is good practice to give suitable permissions that meet your specific needs. Ubuntu Docs has a good page on permissions however, you probably just want a working example. So here you go.

For mount, the umask detemines the permissions and if you read the Ubuntu Docs page briefly, read, write and execute permissions are given by 4, 2 and 1 respectively. As you will see, 0000 will result in permissions = drwxrwxrwx. If you give umask = 0001, then the permissions = drwxrwxrw-. A simple concept, however, at first I thought that it was the other way around.

So here's how I would mount an External on my server for read/write access by guests/users in the specified group:
mount -t ntfs-3g -o uid=admin-user,gid=guest-user-group,umask=0000 /dev/sdc1 /media/OneTouch

And if I wanted to mount with permission for just the user who mounted it:
mount -t ntfs-3g -o uid=admin-user,gid=guest-user-group,umask=0027 /dev/sdc1 /media/OneTouch

Extra control can be given using uid and gid to determine who is the owner and which users of the group can access the External. This may take a little bit extra to tweak but can be a good security measure. To get started, use the following command to determine which group a users belongs to:
id username

For more information about mounting, there's a resource here.

Adios, till next time!

No comments:

Post a Comment