Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running on Ubuntu server as root user (according to whoami).

I'm trying to untar a package. Unfortunately the untarred folder and all files are somehow owned by another user (zabbix).

I did install zabbix recently but I am logged in as root so I expect the untarred files to be owened by root. What am I doing wrong?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

tar encodes the numeric id of the owner and primary group of every file. When you untar a tarball all the owners will be set back to their original numeric id's, for example uid 500. What you have is the zabbix user in your system created as uid 500. Hence, when you restore the archive, the files appear to be owned by zabbix.

To confirm, try

id zabbix and ls -aln $DIRECTORY

My guess is they will be the same.

share|improve this answer

Add the --no-same-owner parameter to your command (assuming a gnu tar). When running as root, tar automatically preservers file ownership and permissions.

As an aside: Are you sure you really need to be doing whatever you're doing as root?

share|improve this answer
    
do you mean that the tar i'm untarring was tarred by owner zabbix? it is the latest distribution of memcached so it does not make sense to me. –  Niro Feb 24 '10 at 8:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.