LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 12-13-2012, 12:54 PM   #1
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Rep: Reputation: Disabled
Need help understanding tar xvf and permissions


We have a QA and production server being set up for a new site. There are a group of files in several different directories I'd like to be able to copy from QA to production once they've been tested in QA.

In QA we have super-user root authority. In production we do not. So if we create new files in QA, they typically have owner and group of 'root.'

So I created an .sh file in QA that creates a .tar file of all the affected files (about 20-25). I create the .tar file in QA then move the .tar to PROD.

The problem is when I extract the .tar file in production via 'tar xvf file' I typically get several permission errors such as:

Cannot open: File exists
Cannot utime: Operation not permitted
Cannot change mode to rwxr-xr-x: Operation not permitted

My questions are:
1) When I create the .tar file from QA, is it also storing the owner and group names for each file?

2) If any of the files in the .tar are new to production and were created in QA via the superuser root, does that cause problems copying to production because in prod we don't have superuser authority? In QA should we be using the same group name we use in prod?

3) In the case of "Cannot open: File exists" errors, I was able to fix some by changing the prod group name, but in other cases, even when giving 777 file authority, I continued to get this error message.

Man, I'm confused. Any guidance appreciated. Let me know if I can provide more detail.
 
Old 12-13-2012, 01:07 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Does both QA and production servers use any name service? that means, can they identify same user account?
Well, it depends. It do store ownership, but owner's account (i.e. same username) should be present on both servers. If both servers are using a name service and both can identify same user, then you'll not have any problem in copying/extracting tar files.
 
Old 12-13-2012, 01:51 PM   #3
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shivaa View Post
Does both QA and production servers use any name service? that means, can they identify same user account?
Well, it depends. It do store ownership, but owner's account (i.e. same username) should be present on both servers. If both servers are using a name service and both can identify same user, then you'll not have any problem in copying/extracting tar files.
Both production and QA recognize the same user account, call it "NiceGroup." The owner's account, however is not the same in production. In production, when we sign on to the server, we use the id of, call it "ProdOwner." So if we copy a new file to prod, instead of "root" or "NiceGroup" as the owner as on QA, we have "ProdOwner."

So in prod, many files have "ProdOwner" for the owner, and "NiceGroup" for the group.

Is the simplest thing to do, for both QA and prod, to have the owner and group both be "NiceGroup"?
 
Old 12-13-2012, 02:11 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
It means, you can login into production from QA using ssh or telnet etc. Then tar file will carry it's ownership/group after copy into QA.
Once try following from QAServer:
QAserver# scp -r ProdOwner@prodserver:/path/to/source/example.tar /path/to/target/
And check what ownership it has, using:
Code:
ls -l example.tar
Then you can:
Code:
chown qauser:qagroup /path/to/target/example.tar
 
Old 12-13-2012, 03:10 PM   #5
misterpiddles
LQ Newbie
 
Registered: Nov 2012
Location: Boston-ish, MA, USA
Distribution: Debian
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shivaa View Post
It means, you can login into production from QA using ssh or telnet etc. Then tar file will carry it's ownership/group after copy into QA.
Once try following from QAServer:
QAserver# scp -r ProdOwner@prodserver:/path/to/source/example.tar /path/to/target/
And check what ownership it has, using:
Code:
ls -l example.tar
Then you can:
Code:
chown qauser:qagroup /path/to/target/example.tar
Thanks, shivaa. I'll have to run some tests since I'm a newb and haven't gone quite this deep before, but thanks for the info!
 
Old 12-13-2012, 03:25 PM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
...I'm a newb and haven't gone quite this deep before
No problem, but just a tip:- If there's any name service (I actually doubt there's any such setup between QA and production) like NIS, NIS+ or LDAP, then there will be no problem in copying, accessing or extracting etc. But if it's not there, and both server maintains there own /etc/passwd to manager there users, then you might need to do some extra work, as mentioned above
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 11:55 AM
[SOLVED] simple tar xvf question atjurhs Linux - Newbie 12 11-01-2012 12:06 PM
What is the difference between the commands tar -xvf and tar - xzf kenholtmeyer Linux - Newbie 4 08-03-2011 04:29 PM
tar xvf does nothing and exits with 0 crisostomo_enrico Solaris / OpenSolaris 20 09-20-2007 11:57 AM
Tar xvf I get segmentation fault lvt lists ok Help! Bob Ross Red Hat 0 01-27-2004 11:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration