0
I have 2 servers in different domains. I use 3rd server to run batch script. All servers have cygwin installed hence I use Linux shell commands as well. All server could talk to each other. The goal: copy a folder from source server to destination. Since it has a million files in it I am going to use tar utility. I am able to run the script on 3rd server and create a tar file from source folder, copy it to destination folder and untag it. It works fine ... except folders and files on destination server can't be opened because I have an error: access denied. I see that files don't have 'read' permission. If I run chmod a+r * on files it works fine. Note: I use the same user on all servers. How could I preserve 'read' access to the files? I will attach my batch later:
SET SRC1=\\source-server\D$
SET CMD1=pushd %SRC1%
SET SRC2=MyTar\
SET SRC3=result.tar
SET CMD2=tar cfpz %SRC2%%SRC3% %SRC2%
SET DST1=\\destination-server\D$
SET CMD3=copy %SRC2%%SRC3% %DST1% /y
SET CMD4=pushd %DST1%
SET CMD5=tar xfpz %SRC3%
%CMD1%
%CMD2%
%CMD3%
%CMD4%
%CMD5%
Have the the 3 users the same SID ? You can have it from
mkpasswd | grep your_user | awk 'BEGIN { FS=":"}; {print $5}'
– matzeri – 2018-07-08T05:27:34.287Well I checked that 2 servers i.e. the one where source files are located and the one where I'm running the script has the same user with the same SID. But the user on destination-server i.e. where I open tar file is not listed in mkpasswd at all – susik – 2018-07-08T15:04:33.433
I think that I have to add user to destination server since mkpasswd does not list it. Could someone give a hint how to add the user in order mkpasswd list it? Thanks – susik – 2018-07-09T23:33:39.987