Scripting file permission problems...

Hello all -

I have two systems.

1) Linux box running Redhat 8.0
2) Tru64 box running V4.0f

From the Linux box I am remotely mounting a directory (nfs mount) that resides on the Tru64 machine.

The directory that is nfs mounted contains two subdirectories:

my_dir1
my_dir2

I want to run a script that will:

1) Copy my_dir1 to my_dir1_saved
2) Copy my_dir2 (rename) to my_dir1

So, basically you now have:

my_dir1_saved (previously my_dir1)
my_dir1 (previously my_dir2)
my_dir2

I want to keep the original my_dir1 around - thus the need to cp (rename) my_dir1 to my_dir1_saved. Then, I want to copy my_dir2 and make it my_dir1.

I don't want to use the mv command - we want to have all the original files around.

My problem is this:

I'm using the cp command this way:

cp -rpf my_dir1 my_dir1_saved
cp -rpf my_dir2 my_dir1

The problem is that file permissions, ownership, and group aren't being kept when I do the copy command.

Any help will be appreciated...


mkdir my_dir1_saved
cd my_dir1
tar cf - . | (cd ../my_dir1_saved; tar xf -)
cd ../my_dir2
tar cf - . | (cd ../my_dir_1; tar xf -)

do the 2 boxes have compatible UID's/GID's?

That was the problem.

Upon further study - I noticed that the numbers were incompatible.

The problem is fixed.

Thank you.