You can't use chmod on fat32 or ntfs filesystems. NTFS has a foreign acl and fat32 doesn't store any user permissions with files and directories.
Instead you need to change the way it is mounted. The permissions on files are determined in-mass when the filesystem is mounted. The same is for file permissions.
For vfat, use the mount options "uid=<your-username>,gid=<your_default_group>,fmask=0111,dmask=000". This will change the owner to you and the group ownership to your default group. You can use either your UID number or your username. The fmask and dmask commands determine the permissions of the files and directories.
I just reformatted a pendrive and used these mount options:
Code:
sudo mount -t vfat /dev/sdd1 /mnt/craig/ -o rw,uid=jschiwal,gid=jschiwal,noatime,nodev,noexec,utf8,fmask=0111,dmask=0000,flush
jschiwal@qosmio:/media> ls -ld /mnt/craig/
drwxrwxrwx 2 jschiwal jschiwal 4096 1969-12-31 17:00 /mnt/craig/
I created a group who's name matches my username and made it my default group. I could have used the mount options "fmask=0177,dmask=0077" instead. That would have given me private access to the pen drive while mounted on this machine.
If I wanted to create an fstab entry, I would first determine the filesystem UUID of the filesystem (vfat). This way, even if after pluggin in the pendrive, it is assigned a different device node, such as /dev/sde1, I would still be able to mount it with the permissions I have in the /etc/fstab entry:
[code]
udevinfo -q env -n /dev/sdd1
ID_VENDOR=USB
ID_MODEL=DISK_2.0
ID_REVISION=1219
ID_SERIAL=USB_DISK_2.0_G3X7CRTIRASZ4RCH-0:0
ID_SERIAL_SHORT=G3X7CRTIRASZ4RCH
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
ID_PATH=pci-0000:00:1d.7-usb-0:1.4:1.0-scsi-0:0:0:0
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_
UUID=489E-19FC
ID_FS_UUID_ENC=489E-19FC
ID_FS_LABEL=podcasts
ID_FS_LABEL_ENC=podcasts
ID_FS_LABEL_SAFE=podcasts
[code]
Code:
/etc/fstab entry:
UUID=489E-19FC /mnt/craig vfat rw,noauto,uid=jschiwal,gid=jschiwal,noatime,nodev,noexec,utf8,fmask=0111,dmask=0000,flush 0 0
I might also use the "user" or "users" option to allow mounting this pendrive as a normal user. Notice the "noauto" option. This will prevent the system from trying to mount the pendrive when rebooting. Imagine that the pendrive isn't plugged in. That would cause a failure, dropping into the root shell instead of continuing. The "user" or "users" option combined with the UUID number of the filesystem would even allow you to include a mount command in your ~/.profile command and have the pendrive mount when you log in. You don't need to use sudo, because the mount command is suid, and allows a regular user to mount the device if the "user" or "users" option is used.
---
If you are using KDE or Gnome and your distro uses hal/udev for automounting removable drives, including an /etc/fstab entry may interfere with automounting or signal that you prefer to mount it manually. Instead of mounting it yourself, when the dialog box comes up asking if you want to examine the files (e.g. open the filemanager), press the "Mo
unting" tab. From there you can change how the pendrive is mounted. Be sure the mount as user is selected.
I haven't tried changing permissions in the permissions tab to see whether that would change the mount options on a vfat drive, or if that dialog is useful if you use a different filesystem.
In the least, you can gain full access to the device.
---
Using my previous example with an fstab entry, when running on your system, an external device with that UUID will only be mounted that way. A different regular user can mount it if you use the "users" option, but can't enter the device if you mask out the group and user permissions. This can give you a small amount of protection if the user doesn't have root access or access to a different computer or a live distro and if you don't duel boot to windows. I should emphasize the word "small".