Scripting file permission problems...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Scripting file permission problems...
# 1  
Old 03-22-2005
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...
# 2  
Old 03-22-2005
Code:
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 -)

# 3  
Old 03-22-2005
do the 2 boxes have compatible UID's/GID's?
# 4  
Old 03-24-2005
Quote:
Originally Posted by aselby
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sendmail dir permission problems.

I accidently deleted the queue directory and now i'm receiving this error when I try to send email with sendmail. :~# mailq MSP Queue status... /var/spool/mqueue-client (1 request) -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- s495xA7J002673 ... (1 Reply)
Discussion started by: galford
1 Replies

2. Shell Programming and Scripting

Execution problems with scripting

Hi, I am new to scripting.I had one problem infront of me.I tried in many ways with minimal knowledge........Kindly help me. Description: I want a shell script where it has to read an input.txt file and need to remove duplicate lines and the result need to kept in output.txt file. input... (5 Replies)
Discussion started by: bhas
5 Replies

3. UNIX for Dummies Questions & Answers

Shell Scripting Permission Denied

Everytime I try to run a shell script I get the error message permission denied. So I have googled/searched around and have been using the command chmod u+rwx (filename) to give myself permission to execute my program. However, I was wondering if there was anyway to actually just this to... (5 Replies)
Discussion started by: Jimmyd24
5 Replies

4. Web Development

Permission problems calling Ruby from php script

I'm just getting my feet wet with web development, so hopefully this is a simple thing I'm overlooking, but so far I'm stumped. I have a php script that calls Ruby via exec(). This works fine in my test environment, but when I moved it to my production environment I run into a permissions... (7 Replies)
Discussion started by: dantes990
7 Replies

5. Shell Programming and Scripting

Unix scripting problems

Hi, In my unix server, i received a file in /usr/data/xmit location. i want to write a unix script after file reached. So how can i write a one line code which chceks the presence of the file? and second line line should take the status of the prevous line. like below. Line 1: checks for the... (16 Replies)
Discussion started by: JSKOBS
16 Replies

6. Shell Programming and Scripting

Beginner bash scripting - a few problems

Hey Guys, I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at... (1 Reply)
Discussion started by: traxy
1 Replies

7. Shell Programming and Scripting

How to create file in ksh scripting with permission(rw-rw-rw)

Hi, Please provide your inputs.. Thanks in Advance, Mansa (1 Reply)
Discussion started by: mansa
1 Replies

8. Shell Programming and Scripting

Gather File permission during scripting on unix as numbers.

Hi, I have a script with following file permission on box. -rwxr-xr-x 1 root system 15347 Aug 14 15:08 b_reboot.ksh Without calculating or watching at -rwxr-xr-x (permission's) of this above mentioned file. I would like to get the file permission assigned to a file. Basically... (7 Replies)
Discussion started by: ajilesh
7 Replies

9. UNIX for Dummies Questions & Answers

File permission problems.

Hi all, I am on SunOS 5.8 box. The problem is when i move files from one folder to another the command is executed and file is moved, but file permissions in the destination folder are "----------". i have to chmod the file and change the permissions everytime. i dont have a clue why this is... (3 Replies)
Discussion started by: The Nemi
3 Replies

10. Shell Programming and Scripting

Scripting problems

Hello, Im trying to write a script where it will only execute on a certain day. What would the script look like? if then do this is this correct?? (13 Replies)
Discussion started by: lewisoco
13 Replies
Login or Register to Ask a Question