# Force permissions.

## dE_logics

Is there any way to force specific permissions for files and directories separately even if it has been copied from somewhere else?

----------

## dE_logics

Or a better solutions maybe -- set default permissions for mounting optical media and USB fat/ntfs storage devices.

----------

## Jaglover

You can set umask, dmask, fmask options for FAT. Not sure about other filesystems, man mount will tell.

----------

## dE_logics

Not from fstab. I was wondering about doing the same for hotplugging CD/DVD/block devices.

----------

## Jaglover

 *dE_logics wrote:*   

> Not from fstab.

 

Not sure what you mean by that, I'm using fmask=133 in fstab for my USB sticks.  *dE_logics wrote:*   

> I was wondering about doing the same for hotplugging CD/DVD/block devices.

  http://reactivated.net/writing_udev_rules.html#ownership

----------

## dE_logics

 *Jaglover wrote:*   

>  *dE_logics wrote:*   Not from fstab. 
> 
> Not sure what you mean by that, I'm using fmask=133 in fstab for my USB sticks.

 

You have listed fstab like - 

/dev/sr0

/dev/sdb

/dev/sdc

/dev/sdd

etc...

?

 *dE_logics wrote:*   

> I was wondering about doing the same for hotplugging CD/DVD/block devices.

  http://reactivated.net/writing_udev_rules.html#ownership[/quote]

This changes the permission of the device node, not the mounted FS (?).

----------

## Jaglover

```
/dev/sdc1               /media/stick    vfat            noatime,users,noauto,fmask=133,shortname=lower  0 0
```

That's one line from my fstab.

You are correct about udev, the only other idea I can come up with is to run a post-mount script that sets ownership and permissions.

----------

## dE_logics

This fstab method is actually a workaround. It should be handled with udisks which's the proper way.

The major problem with the default permissions is that in multiuser systems where FS is shared and you've set groups as common among them (so they may have correct rw regardless of the user owning the files); only the user who copies the content form the external device to the shared filesystem has write access, otherwise everyone else has ro access, cause the permissions are g-w.

This causes inconvenience to the very end users.

----------

