1826056 Members
4197 Online
109690 Solutions
New Discussion

tar

 
Marco_163
Advisor

tar

Who tell me why I can't tar files as root while I can do that as user?.
Marek
14 REPLIES 14
Michael Schulte zur Sur
Honored Contributor

Re: tar

Marco,

that should not happen. Can you explain what you were trying to tar and what happened?
error messages

greetings,

Michael
Eric Antunes
Honored Contributor

Re: tar

Hi Marco

What error do you get?

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Marco_163
Advisor

Re: tar

No erros, at all.
First I thought that it's not a tar file.
But, I simply tar that as "normal" user.
Marek
Sanjay Kumar Suri
Honored Contributor

Re: tar

Can you check which tar is being used and give full path to execute the tar command?

$whereis tar
tar: /sbin/tar /usr/bin/tar

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Marco_163
Advisor

Re: tar

I used tar from /sbin and /usr/bin directory and I received the same result - no error but the file was not tarred.
Marek
Muthukumar_5
Honored Contributor

Re: tar

Can you check that file as,

$ file
it will informations there.

Find more as,

$ which tar
$ what `which tar`

Try to execute with -v mode tooo.

what are you getting here.
# /usr/bin/tar -xvf

$ /usr/bin/tar -xvf
Easy to suggest when don't know about the problem!
Marco_163
Advisor

Re: tar

I tried to use /sbin/tar and /usr/bin/tar - results are the same : no error and no files.
Marek
Muthukumar_5
Honored Contributor

Re: tar

what do you get for

file

on root and normal users?

what do you get for

tar -y

something unknown option on tar ..? do you get any messages on command line.

Try with verbose mode. Try for other tar file.

As,

normal user

echo hai > /tmp/test.file
tar -cvf /tmp/test.tar /tmp/test.file
mv /tmp/test.file /tmp/test.filenormal

root user
tar -xvf /tmp/test.tar

what are you getting there.

Note: If you give your test and results to forums so that we can help at once. Without that and saying not working no messages will not help to others.
Easy to suggest when don't know about the problem!
V. Nyga
Honored Contributor

Re: tar

Hi Marco,

maybe an alias?

Try 'alias|grep tar'

Volkmar
*** Say 'Thanks' with Kudos ***
Michael Schulte zur Sur
Honored Contributor

Re: tar

Marco,

so far I do not know, what you where trying to do. can you give an exampe?

greetings,

Michael
Marco_163
Advisor

Re: tar

Soory,
It was my fault
tar -xvf /test/user9.tar
works

but I wrote
tar -xvf /test/user9.tar /test
and nothing happend.
Marek
Geoff Wild
Honored Contributor

Re: tar

That is correct - tar only takes a file name or device - not a directory as an option.
(unless use use -C /directory - which performs a chdir).


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Michael Schulte zur Sur
Honored Contributor

Re: tar

Marco,

check first with tar tvf /test/user9.tar
what is in the archive and if you used absolute or realive path names.
Then select the name of the file you want to extract.
I assume you wanted to extract /test right?

Michael
Muthukumar_5
Honored Contributor

Re: tar

We can not use -C option to change directory while extraction there.

It (11.00) is not working as like Linux there.

Linux.

tar -xvf -C

Hp-ux tar is used to get archieve files as like,

tar cvf test.tar -C

And no more warnings / error while using with tar -xvf there. ( Linux is good on this )

You can do this as,

cd ; tar -xvf ;cd -

that is all.
Easy to suggest when don't know about the problem!