LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-06-2011, 01:08 AM   #1
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
how to change folder permissions on USB


I am having a USB disk.
I want to change the permissions of folder on it from 700 to 755 (and all subdirectories in it)
ls -l shows

total 26
Quote:
drwxrwxrwx 2 tkmsr tkmsr 2048 2010-02-12 04:12 HPLAUNCHER
drwx------ 7 tkmsr tkmsr 4096 1970-01-01 05:30 vol1
drwx------ 1 tkmsr tkmsr 20480 2011-01-03 17:43 vol2

how ever even if I am trying it as root this is not happening.

Quote:
chmod -R 755 /media/vol2
This is the command I try always and after the cursor blinks for about 5-6 minutes I get the shell back.
What could be the problem?

Some outputs I am posting
lsusb shows
Quote:
Bus 002 Device 002: ID 03f0:4507 Hewlett-Packard
fdisk -l shows
Quote:
Disk /dev/sdb: 499.4 GB, 499405291520 bytes
255 heads, 63 sectors/track, 60715 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x579a78f1

Device Boot Start End Blocks Id System
/dev/sdb1 2 59918 481283302+ f W95 Ext'd (LBA)
/dev/sdb2 59919 60715 6401902+ c W95 FAT32 (LBA)
/dev/sdb5 2 59918 481283271 7 HPFS/NTFS

--

Output from /var/log/syslog is
Quote:
Jan 6 10:24:12 tkmsr ntfs-3g[2278]: Version 2010.3.6 external FUSE 28
Jan 6 10:24:12 tkmsr ntfs-3g[2278]: Mounted /dev/sdb5 (Read-Write, label "vol2", NTFS 3.1)
Jan 6 10:24:12 tkmsr ntfs-3g[2278]: Cmdline options: rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,dmask=0077
Jan 6 10:24:12 tkmsr ntfs-3g[2278]: Mount options: rw,nosuid,nodev,uhelper=udisks,silent,allow_other,nonempty,relatime,fsname=/dev/sdb5,blkdev,blksize=4096,default_permissions
Jan 6 10:24:12 tkmsr ntfs-3g[2278]: Global ownership and permissions enforced, configuration type 1
 
Old 01-06-2011, 01:14 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Change the settings of fmask and dmask in /etc/fstab. Fat32, and NTFS filesystems are not native to Linux. So you need to set the permissions in your mount command options or the fstab entry.

There are manpages for mount and mount.ntfs.
 
Old 01-06-2011, 01:27 AM   #3
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
These are my fstab entries
Quote:
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda8 during installation
UUID=06ecf0b7-ab12-4ada-82dc-d3267d45ad21 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda14 during installation
UUID=1414ee34-775a-4ca6-a196-5e23b09f07a8 none swap sw 0 0
# swap was on /dev/sda15 during installation
UUID=49343515-0b63-46b5-8244-96cba544ade2 none swap sw 0 0
/dev/sda7 none swap sw 0 0
UUID=a20a4466-24bc-42c5-93e2-2193e99847b5 /mnt/1 ext2 rw 0 0
UUID=1c1bc84c-9ef5-4daa-a630-8fe29b5d12d1 /mnt/jaunty ext2 rw 0 0
~
I do not see the USB here at all.In fact in Ubuntu you do not need to mount or unmount the USB it automatically (I don't know how) does that.

Which entry in above you are referring as fmask dmask?
 
Old 01-06-2011, 03:23 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
I don't use Ubuntu and don't normally use Gnome. I think if you right click on the disk icon, and select properties, there may be an advance settings options to set the default permissions of the disk. I made some searches on Google, and gconftool was used, but the keys mentioned aren't used on SuSE. Things dealing with udev, hal & policy kit can vary between distro's and distro versions. Ironically making things easier, involves adding a lot of complexity. Sometimes the old-school method is actually easier.

You could create your own entry in /etc/fstab. First find out the UUID of the filesystem with "sudo blkid". You can also list the disk/by-uuid device nodes. "ls -l /dev/disk/by-uuid"
Then use "UUID=<UUID number>" in the first field. Here is an example using a pendrive:
Code:
UUID=7479-7F2E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1000,gid=1000,shortname=mixed,dmask=0022,fmask=0022,utf8=1,noatime,flush
You can leave out noatime if you aren't using a pendrive. It will extend the life of the flash memory by not updating the access time after reading a file.

Now "sudo mount /mnt/pendrive" will mount this pendrive with 0755 permissions for files & directories. You might consider using fmask=0133 instead to mask out the "x" bit on files for removable devices.

One advantage of an entry using the UUID or LABEL in fstab is that you can have different devices mounted differently. Add the option "users" and you don't need to use sudo to mount the pendrive. A regular user can mount it, but the ownership and permissions will be set in the fstab entry. If you use dmask=077,fmask=066 another user (without sudo permissions) can mount but not use the pendrive (on the same computer). While this won't prevent mounting the pendrive on a different computer, it can help prevent accidental access by someone sharing the computer.
 
Old 01-06-2011, 03:29 AM   #5
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Original Poster
Rep: Reputation: 39
Quote:
Originally Posted by jschiwal View Post
I don't use Ubuntu and don't normally use Gnome. I think if you right click on the disk icon, and select properties, there may be an advance settings options to set the default permissions of the disk.
I checked there was no advance permissions thing and infact what I saw in permissions tab was permissions could not be determined.
Quote:
Originally Posted by jschiwal View Post

One advantage of an entry using the UUID or LABEL in fstab is that you can have different devices mounted differently.
I did not get this part.
 
Old 01-06-2011, 03:48 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Apparently, the permissions tab is intended for files. On a previous version of KDE, I was able to right click on a disk icon, and change the way it was mounted automatically.

---
The UUID of a filesystem is unique to only that file system. It stands for "Universal Unique IDentifier".
The fstab entry won't be used for another removable drive you plug in. A different pendrive will mount automatically as before.

To test my post, I changed the fstab entry to:
UUID=7479-7F2E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1000,gid=1000,user,shortname=mixed,dmask=0022,fmask=0022,utf8=1,noat ime,flush

I also created a new user. As that user I entered the command:
mount /mnt/pendrive

The pendrive mounted with these permissions:
drwxr-xr-x 3 jschiwal jschiwal 16384 1969-12-31 17:00 /mnt/pendrive

Change the fstab entry like this:
UUID=7479-7F2E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1000,gid=1000,user,shortname=mixed,dmask=0077,fmask=0077,utf8=1,noat ime,flush

It is mounted with these permissions:
drwx------ 3 jschiwal jschiwal 16384 1969-12-31 17:00 /mnt/pendrive/

Suppose you share your computer with a roommate. Your roommates pendrive will have a different UUID number and you can create another entry for it.
UUID=7479-E32E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1001,gid=1001,user,shortname=mixed,dmask=0022,fmask=0033,utf8=1,noat ime,flush

The pendrive will be mounted with your roommate being the owner. As an "other" user, you will be able to read files, but not write to them.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change folder permissions in fc-6 chryslercirrus99 Fedora 3 06-07-2007 06:32 PM
can't change permissions for windows folder nikoz Linux - General 1 06-21-2006 08:19 AM
FOLDER permissions change automatically Echo Kilo Linux - Newbie 5 08-21-2005 03:09 AM
Script to change folder permissions waitingforOES Linux - Newbie 1 03-07-2005 01:34 PM
Change folder permissions eggoz Linux - Newbie 2 03-17-2003 01:35 AM


All times are GMT -5. The time now is 09:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration