LinuxQuestions.org
Visit Jeremy's Blog.
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 04-03-2009, 11:00 AM   #1
nurikabe
LQ Newbie
 
Registered: Aug 2005
Posts: 9

Rep: Reputation: 0
NAS over CIFS on an old Fedora Core distro does not preserve file ownership on copy


I've inherited a system running FC5 with a couple of NAS drives connected over CIFS. I thought CIFS preserved file ownership, permissions, and file details on copy, but that doesn't seem to be the case. (Everything gets saved as "root".) Wondering if this is:

1. A problem with the old FC5 distro?
2. A problem with my fstab?
3. A problem with the fact that I don't really understand how Samba/CIFS works.

Here's my fstab:

//nas-01/staging /nas-01 cifs defaults 0 0

Note that no authentication is required to save to "staging" on nas-01.
 
Old 04-03-2009, 02:39 PM   #2
linest
LQ Newbie
 
Registered: Sep 2008
Posts: 23

Rep: Reputation: 1
Quote:
Originally Posted by nurikabe View Post
I've inherited a system running FC5 with a couple of NAS drives connected over CIFS. I thought CIFS preserved file ownership, permissions, and file details on copy, but that doesn't seem to be the case. (Everything gets saved as "root".) Wondering if this is:

1. A problem with the old FC5 distro?
2. A problem with my fstab?
3. A problem with the fact that I don't really understand how Samba/CIFS works.

Here's my fstab:

//nas-01/staging /nas-01 cifs defaults 0 0

Note that no authentication is required to save to "staging" on nas-01.
Look here:
http://www.lunix.com.au/tag/tip-linux-cifs-mount/

Notice how you can specify the user to bind as. You haven't done that.
 
Old 04-05-2009, 10:52 PM   #3
nurikabe
LQ Newbie
 
Registered: Aug 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linest View Post
Look here:
http://www.lunix.com.au/tag/tip-linux-cifs-mount/

Notice how you can specify the user to bind as. You haven't done that.
Thanks. So this means that all files will be saved as per the specified uid / gid, right? Is there anyway to make the NAS aware of all users as defined in /etc/passwd and preserver ownership / permissions. Example, if I copy a file from the main drive, I want the owner and permissions to be the same on the NAS.
 
Old 04-05-2009, 11:15 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
It probably has to do with how the nas works then your client configuration. The uid= & gid= options will be used as a fallback if cifs isn't supported.

My guess is that it doesn't really support cifs. What kind of device is it? Can you create users? If you don't have a way of adding users & coordinating credentials as with a samba server, then it may not provide you with the support you want.

Another possibility is it uses the equivalent of "force user" and "force group" for guest shares.

Last edited by jschiwal; 04-05-2009 at 11:18 PM.
 
Old 04-05-2009, 11:25 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
What's the underlying file system? fat or ntfs won't store this info because they simply lack the needed structures to do so. So permissions and ownershipts are not really saved, they are emulated at mount time.
 
Old 04-06-2009, 11:46 AM   #6
nurikabe
LQ Newbie
 
Registered: Aug 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
It probably has to do with how the nas works then your client configuration. The uid= & gid= options will be used as a fallback if cifs isn't supported.

My guess is that it doesn't really support cifs. What kind of device is it? Can you create users? If you don't have a way of adding users & coordinating credentials as with a samba server, then it may not provide you with the support you want.

Another possibility is it uses the equivalent of "force user" and "force group" for guest shares.
It's a Buffalo TerraStation. Supports user and group management.

Does one have to match user/group settings on the NAS to whatever exists in /etc/passwd?

Last edited by nurikabe; 04-06-2009 at 12:22 PM.
 
Old 04-06-2009, 11:47 AM   #7
nurikabe
LQ Newbie
 
Registered: Aug 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
What's the underlying file system? fat or ntfs won't store this info because they simply lack the needed structures to do so. So permissions and ownershipts are not really saved, they are emulated at mount time.
Looks like it's XFS (?), with which I'm not familiar.
 
Old 04-06-2009, 02:37 PM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Oh, then that shouldn't be the problem. XFS supports the unix permissions scheme.
 
Old 04-06-2009, 10:21 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The username/password for Samba/Windows probably need to match for a cifs mount. I'm curious if you can use smbpasswd remotely to change credentials on the buffalo nas the way you can for a regular samba server.

One possibility is that the NAS runs as root and has a 'bad user = root' or 'bad user = guest' option for a globally accessible share. The use of XFS indicates that your NAS is probably running either Linux or BSD, which use the Samba server. I believe that the Buffalo NAS runs Linux internally. Often embedded devices have a scaled down linux (such as uCLinux) which runs everything as root and doesn't have regular users. If this is the case, it may use Windows styled (smbpasswd) credentials for access but only have one user that files are saved as (the root user).

If I were you, I would try mounting the share using credentials. For example, you can create a credentials file (e.g. ~/.credentials) in your home directory with the contents:
username=<your_user_name>
password=<your_password>

If your network uses a domain, then also include "domain=<domain_name>" in the file.

Then in your /etc/passwd file, include the options "user,cred=/home/<yourusername>/.credentials,uid=yourusername".

The uid option is optional for cifs, and is a fallback when smbfs is supported by the server. See if mounting with your credentials allows permissions to be preserved. If the credentials are different for the nas then on your Linux system, then include those instead in your credentials file.

Good Luck.
 
Old 04-07-2009, 09:33 AM   #10
nurikabe
LQ Newbie
 
Registered: Aug 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Awesome, thanks. I will experiment with credentials.
 
Old 04-09-2009, 02:51 PM   #11
nurikabe
LQ Newbie
 
Registered: Aug 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by i92guboj View Post
Oh, then that shouldn't be the problem. XFS supports the unix permissions scheme.
Cool. What about EXT2, EXT3?

Last edited by nurikabe; 04-09-2009 at 02:53 PM.
 
Old 04-09-2009, 03:53 PM   #12
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by nurikabe View Post
Cool. What about EXT2, EXT3?
They are THE native linux file systems. Of course they have no problem with that either.

I just suggested that because a lot of hardware comes with a fat or ntfs file system, which are windows native file systems and do not support these things. But neither of ext2/3/4, reiser*, xfs, jfs and many others should be a problem. They all are ok for the purpose.
 
Old 04-09-2009, 04:09 PM   #13
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,362

Rep: Reputation: 172Reputation: 172
Why use Cifs over NFS?
 
  


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
Make KDE/Konqueror preserve time, ownership on file copy tisource Linux - Software 2 06-27-2006 02:23 PM
preserve file ownership with the "zip" command? zovres Linux - General 2 11-25-2004 10:01 PM
Why doesn't "cp -p <file>" copy <file> and preserve ownership? davidas Linux - Newbie 5 04-12-2004 06:44 AM
Preserve the ownership juno Linux - General 1 01-16-2003 02:38 PM
preserve the ownership juno Linux - General 5 01-09-2003 12:01 AM


All times are GMT -5. The time now is 06:59 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