LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-15-2009, 10:51 AM   #1
brockangelo
LQ Newbie
 
Registered: Aug 2008
Posts: 11

Rep: Reputation: 0
Looking for help understanding filesystems and permissions


Read the post here and really like its summary of filesystems and inherited permissions. Now here's another question:

How does all of this change when you are mounting a windows share with CIFS?

My configuration can be summarized like this:

Linux1 box mounts NTFS drive using CIFS (windows share on xp box). Linux1 box rsyncs to the Linux2 box running EXT3 and tries to sync data from the CIFS mount on Linux1 to a mounted VFAT external USB drive on Linux2.

Linux1 box has the following fstab:
Code:
//192.168.1.2/music  /media/music  cifs exec,credentials=/etc/cifspw 0 0
Linux2 box has the following fstab:
Code:
/dev/sdb1 /media/usb vfat auto,rw,users,uid=0,umask=000 0 0
So, essentially, I think I'm getting a crash course on just about every possible 'file system & permissions' scenario at once.

I still am getting the following error when I run an rsync:
Code:
root@black:/home/brockangelo# rsync -azvv -e ssh /media/music/ root@example.com:/media/usb/music/ --exclude=/.recycle/
opening connection using ssh -l root example.com rsync --server -vvlogDtprz. /media/usb/music/
building file list
[sender] hiding directory .recycle because of pattern /.recycle/
done
delta-transmission enabled
...
rsync: failed to set permissions on "/media/usb/music/Aerosmith/Big Ones/06 Janie's Got a Gun.mp3": Operation not permitted (1)
I've got some permissions in here that are not quite right. Not really looking for someone to just tell me what to do to fix it - though that obviously would help - would rather find a good explanation of all these factors that are in play so I know how to handle these situations later.
 
Old 03-15-2009, 12:36 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Code:
Linux2 box has the following fstab:
/dev/sdb1 /media/usb vfat auto,rw,users,uid=0,umask=000 0 0
For a removable drive, don't use the "noauto" option instead. You don't want booting to fail because the device isn't plugged in.
Also, use "UUID=<UUID#>" instead of the device. The next time it is plugged in, it could have a different device node assigned.
You can use "udevinfo -q env -n /dev/sdb1" to discover the UUID number of the device.

You could instead, while the device is mounted, list the /dev/disk/by-uuid/ directory and see which link points to /dev/sdb1.
ex:
Code:
ls /dev/disk/by-uuid/ -l
total 0
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 145266D35266B95E -> ../../sda2
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 14D23645D2362AFE -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 21a3c26d-0927-494a-b429-e7c613237525 -> ../../sda7
lrwxrwxrwx 1 root root 10 2009-03-14 00:47 61b27e9c-572d-4706-9d03-1fb49fefd53b -> ../../sdb1
Different filesystems use different sized uuid serial numbers. For a vfat drive, it will be shorter. In my example, I would use:
UUID=61b27e9c-572d-4706-9d03-1fb49fefd53b
in the first column of the fstab entry.

Fat32 & NTSC filesystems aren't Linux native, so you can't use chmod or chown to change the permissions. That is the reason for the error message you are seeing. If you are using Samba to share an ext3 filesytem, then using cifs instead of the obsolete smbfs will allow permissions to be retained. You can even use setfacl & getfacl.

If the permissions are important, and you are backing up files to a Fat32 or NTSC filesystem, it would be better to create a tar archive. The permissions and ownership will be contained inside the archive. The -G <timestampfile> option allows you to easily create incremental backups.
A tar archive will preserve ownership, permissions, and attributes. My version won't preserve ACLs however.

There are some options you could try mounting cifs, vfat or NTFS. "uid=", "gid=", "fmask=", "dmask=" determine the permissions of the mounted filesystem. They are changed en-mass. You can have different permissions for directories than files however. When saving files to a mass storage device, it is a good idea to have the 'x' bit clear. You need the 'x' bit set for directories however.

If you use both the "user" and "uid" options, the filesystem can be mounted giving you exclusive access, using the correct "fmask" & "dmask" values. Not only that, but you can mount it manually as a normal user. You don't need to su to root. So on your system at least, a pendrive with a UUID number can only be mounted with ownership and permissions that you determined. It could be mounted normally on another computer of course.
 
  


Reply

Tags
cifs, mount, ntfs, rsync, share, vfat, windows


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
Howto: Permissions and ownership on FAT and NTFS filesystems openSauce Linux - Newbie 8 03-09-2009 11:52 AM
Understanding filesystems veeruk101 Linux - Newbie 2 11-30-2007 02:29 AM
Understanding permissions veeruk101 Linux - Newbie 3 07-18-2007 04:21 PM
Understanding File Permissions username132 Linux - Software 13 04-03-2006 04:42 AM
Setting permissions for filesystems TazG Linux - Newbie 7 06-25-2004 03:12 PM


All times are GMT -5. The time now is 02:56 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration