Ownership changes


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Ownership changes
# 1  
Old 07-14-2015
Computer Ownership changes

I have 2 Linux servers and 1 windows server. One Linux server has an NSF share which points to the windows server. The other Linux server rsyncs any data to the other Linux server containing the windows share. My issue is that everytime the Linux administrator rsync data to the linux server containing the NSF share, The ownership of the data on the windows side changes and I want the data to inherit the permission from the windows parent folder.

We removed the rsync switch -p but the ownership and permission still changes on the windows side affecting clients to allow mapping and copying.

Thank you for any advice or help u can give me.

Lace0047

Last edited by Lace0047; 07-14-2015 at 11:18 PM..
# 2  
Old 07-15-2015
Hi Lace0047,
I'm not sure I have a definitive answer for you but I'll throw my thoughts out here and see if it helps.

First, I just want to confirm you are using the "Windows Services for Unix" NFS sharing function on your Windows server. If you are not, please let us know what you are using as it might affect the outcome. Do you also have any sort of mapping between Windows and Linux users or are they independent of each other?
The simplest answer may be to run chown, chmod, or chgrp after the rsync completes in order for the permissions to match the parent folder. This would be pretty straight forward if there are not other files in the destination folder.
If there are files in the destination folder that were not put there by rsync, you could work around this by creating a staging area and doing the following:
  1. rsync to the staging area
  2. chmod/chown/chgrp the files in the staging area
  3. mv the files from the staging area to the final destination.
Is it possible for you to post the full rsync command being used. Rsync has a ton of switches and it may just take some time to figure out which combo of switches accomplish what you are trying to do. There is even a --chmod switch on rsync but the outcome varies depending on what other switches you are using.

Thanks,
Tony

Last edited by rbatte1; 07-16-2015 at 08:43 AM.. Reason: Converted text numbered-list to have LIST=1 tags
# 3  
Old 07-15-2015
Thank you for your reply.

I am using the Services for Network File System.

For the mapping, under the General Settings, I have Active Directory domain name checked with our domain listed. Always the same domain ownership shows up when files gets rsynced. I'm not too sure where it is defined to always use that domain account as its owner on Windows. Do you know where it would be defined? In the NFS shared setting in Windows, I have the Linux IP which mounts the Windows to have R/W and Root Allowed.

I thought about changing the files and folders permissions to its parent folder after the rsync ompletes but there are just too many files and folders to perform it under the whole volume in Windows.

The rsync command run by the 2nd Linux server to the Linux NFS server is
Code:
rsync --rsync-path=/usr/bin/rsync -av -l -z -e \"ssh -i /home/test/.ssh/newid\"


Last edited by Corona688; 07-15-2015 at 03:23 PM..
# 4  
Old 07-15-2015
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)



Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
This User Gave Thanks to Corona688 For This Post:
# 5  
Old 07-15-2015
If your NFS client (windows machine) is mounting linux NFS resources you can modify the registry on windows to map anon gid and uid to a certain user on windows (which is at least present on linux server).

That way any user on windows machine will have permission as user you defined on your linux NFS server (passwd and group files) and windows client (registry).
Matching numbers of course Smilie

Search this on google :
Code:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default

This is the most simple way to configure it.

More advanced ways would include actually using DC (krb, ldap etc.)
But that is a matter for some other topic.

Hope that helps a bit
Regards
Peasant.
# 6  
Old 07-15-2015
Thank you for your reply.

My Windows server is the Server for NFS and the client is the Linux1 which has the Windows share mounted. Your instructions relates if the Windows server is the client. Can it still be done as a Windows being the NFS server?

---------- Post updated at 03:48 PM ---------- Previous update was at 03:38 PM ----------

Browsing the registry in Windows, I found the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerforNFS\CurrentVersion\Exports\0

Changing the RestrictChown from value 0 to 1 may do the trick. It will restrict any changes to the ownership but allowing changes to the NFS share. I'll need to reboot the server and see if it works.

I also had the problem that the rsync not only caused the change of ownership but wiped the permissions completely. It may fix that problem as well.
# 7  
Old 07-16-2015
Hello Lace0047,

As you haven't mentioned too many details about windows server which you have but trying to give you a suggestion on same, if you are having cygwin system. The option to ignore NTFS permissions has changed in Cygwin version 1.7. This might be what's causing the problem.
Try adding the 'noacl' flag to your Cygwin mounts in C:\cygwin\etc\fstab, for example:
none /cygdrive cygdrive user,noacl,posix=0 0 0

To run from target server:
Code:
 rsync -vrulpt --stats --rsh=ssh singh_user@server1:source_path target_path >> /target_path_logs 2>&1

Also if you see man page for rsync then you will find out the -p option is to preserve permissions as follows.
Quote:
man rsync
-p, --perms preserve permissions

Thanks,
R. Singh
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

retain ownership

Hi, I have a script which transfers files/directories from one HP unix to another HP unix server using SCP but i need to retain ownership of files/folders same as source server my script is as follows cd /sasdata/TR_CNTO328/C0328T07/Dry_Run_1/Macros find . -type d -newer . -exec scp -pr {}... (6 Replies)
Discussion started by: tushar_spatil
6 Replies

2. UNIX for Dummies Questions & Answers

regarding changing ownership and group

i am able to change the mode using chmod and able to change permission. but i am not able to change group and ownership. getting as invalid can any one help me regarding this . (4 Replies)
Discussion started by: satheeshkr_cse
4 Replies

3. Shell Programming and Scripting

Get ownership info from LS

Hi, When I do the ls-ld command for example like this: # ls -ld /Applications I get an output like this: drwxrwxr-x+ 114 root admin 3876 18 Aug 14:04 /Applications I need to somehow use sed to put the ownership into a format like this: root:admin So basically remove... (2 Replies)
Discussion started by: pcwiz
2 Replies

4. UNIX for Dummies Questions & Answers

Ownership question

Hi there, Complete Newbie here so any help would be so appreciated! :) I've set up a test directory and am trying to figure out out how to ensure that all new files will remain owned by the directory owner... not the creator of the file?? (3 Replies)
Discussion started by: CasperQuiet
3 Replies

5. UNIX for Dummies Questions & Answers

changing ownership?

how would i change ownership of file1 so the user NATE gets ownership of the file? (1 Reply)
Discussion started by: trob
1 Replies

6. Shell Programming and Scripting

Why the cp keeps the original ownership?

I want to copy a file from another user to my owner directory, and want to change the ownership to my account. in jung's directory: -rwxr-xr-x 1 jung smart 23 Dec 1 2005 .runme cp /home/jung/runme . under my directory: -rwxr-xr-x 1 jung smart 23 Dec 1... (1 Reply)
Discussion started by: freelong
1 Replies

7. UNIX for Dummies Questions & Answers

precompressing and ownership

I'm looking for a way to create preprocessed .gz files of static pages to serve up to those browsers that can accept them. I know I can use: gzip -c --best index.html > index.html.gz to create the .gz file _and_ keep the original. What's the proper command line way to run that on each... (2 Replies)
Discussion started by: dheian
2 Replies

8. Solaris

Filesystem ownership with zones

What I have" Solaris 10 U4, recently patched. ZFS filesystems on the global zone Local Zones on the zfs filesystems. If I make a new ZFS filesystem, and present it to a local zone, i.e. /u01. If I change the ownership of /u01 in the Local zone to oracle:dba /u01. The file becomes... (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

9. Shell Programming and Scripting

help regarding file ownership

hi friends,i have a doubt,if there is a file for which i have only read access then is there any way to execute it,plz reply soon (5 Replies)
Discussion started by: amit007
5 Replies

10. UNIX for Dummies Questions & Answers

ownership of files

Hi, While changing ownerships from the root on a server i'm managing, i typed chown -R username:users * and it changed all ownership to username. Can someone tell me if there is someway I can set things back the way they were before? I can't even su username from the root. Am I going to just... (4 Replies)
Discussion started by: szhu
4 Replies
Login or Register to Ask a Question