Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Does anyone have the following problem?

I have an Ubuntu box at work and also one at home.
I always copy folders/files to/from an usb disk to/from my boxes.
I have to change permissions of folders/files copied to boxes. The permissions of folders and files are 700.

It is annoying to chmod 755 or 644 to folders resp. files after every transfer. I found that the USB disk mounted on /media has undesirable permissions.

Can that be changed? The USB disk has vfat or ntfs filesystem.

share|improve this question
add comment

1 Answer

vfat and ntfs filesystem don't contain any information to represent your unix file permissions. It will not be possible to set some specific permissions to the files and keep them.

It is possible to set the initial permissions to a specific value and use this also for the creation of new files. This is called umask and supported by the mount command. You can also differentiate between files and directories. Here are some lines of man mount:

umask=value
       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.
dmask=value
       Set  the  umask applied to directories only.  The default is the
       umask of the current process.  The value is given in octal.
fmask=value
       Set the umask applied to regular files only.  The default is the
       umask of the current process.  The value is given in octal.

Use this in the option column in your /etc/fstab file, for example:

# <file system> <mount point>   <type>  <options>                                                        <dump>  <pass>
/dev/hda1       /mnt/usb      auto    rw,suid,dev,exec,auto,user,async,umask=755      0       1
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.