NAS over CIFS on an old Fedora Core distro does not preserve file ownership on copy
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.