Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to unzip a 7zip file from the command line like this, but I get an error with using e or x parameters. The file has only 1 .dat file inside. I get the following error.

valugi@valugi-desktop:/$ 7z x /var/www/site/data/7zip/eu/
Processing archive: /var/www/site/data/7zip/eu/file.7z
can not open output file file.dat
Skipping    file.dat

Sub items Errors: 1

I can open the file if I am opening it with the File Roller desktop application, but I want to use the command line, as I want to integrate this into a PHP script.

How can I find out what is generating this error and how can I fix it?


share|improve this question
up vote 3 down vote accepted

The key is here:


You are on the root directory, you will need superuser privileges to write to var.

Just try:

sudo 7z x /var/www/site/data/7zip/eu/

Or,if the script is going to be called by another user.

sudo -u username 7z x /var/www/site/data/7zip/eu/
share|improve this answer
I think you are right. I will not do sudo as my script gets executed by www-data and I think this user is allowed there.. thanks – Elzo Valugi Nov 23 '10 at 14:24
sudo -u www-data 7z... will let you test it them. – Javier Rivera Nov 23 '10 at 15:14

The part about "can not open output file" suggests writing the target file is a problem.

  1. Check that you have sufficient space in the output directory to take the unzipped file.
  2. Confirm compressed file integrity with "7z t /var/www/site/data/7zip/eu/file.7z"
    • this second point is probably just for your confirmation.
share|improve this answer
yes. I guess is the user group or the file permissions that I have to change. thanks – Elzo Valugi Nov 23 '10 at 14:08

Your Answer


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.