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

Can someone tell me how can I extract a password protected .7z file in Ubuntu server?

(I know the password, I just need a program to do so and an example of how to use said program...)

share|improve this question
up vote 27 down vote accepted

Install p7zip-full on the server first and then run this to extract a z7 archive called test.7z, encrypted with the password password:

7z x test.7z -ppassword

As JanC adds below, you can omit the whole -ppassword flag and it will just ask you for the password on extraction:

oli@bert:~/Desktop$ 7z x test.7z

7-Zip 9.04 beta  Copyright (c) 1999-2009 Igor Pavlov  2009-05-30
p7zip Version 9.04 (locale=en_GB.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)

Processing archive: test.7z

Enter password (will not be echoed) : <<I typed the password here>>

Extracting  botch2

Everything is Ok

Folders: 1
Files: 0
Size:       0
Compressed: 118
share|improve this answer
I think it also asks for the password if you don't give one on the commandline (which might be safer if multiple users use the server). – JanC Nov 16 '10 at 9:07
I can confirm that is true. – Oli Nov 16 '10 at 9:10
Anywhay this can be done via gui? – tinhed Nov 16 '10 at 15:46
@tinhead Right click the file, click extract, bung in the password. I thought this was the out-the-box behaviour but in case it isn't, I have the file-roller, lzma and p7zip-full packages installed. Install some of them and try again. – Oli Nov 16 '10 at 15:57
Well that's great. Spent 10 hours compressing, turns out that -p='my passphrase' is not the right argument format. Fileroller didn't want to compress it, hanging itself after gathering a list of files, so had to use the command line. Can't figure out what the pwd is. It's not my passphrase, 'my passphrase', ='my, ='my passphrase' or ='my passphrase. Great. Starting compressing again, this time with argument -pmy\ passphrase, that seemed to work (tested it this time around)... Edit: Also -mhe=on might be worth mentioning. – Luc Aug 2 '13 at 7:34

there is a rarcrack to do this task. It can handle .rar, .zip and .7z files. Check out this article:

Hope this will help

share|improve this answer
tnx for this, but I know the password, just need to extract this :) – Wolfy Nov 16 '10 at 8:17
rarcrack is also pretty awful with its false positives. I tested it on my test.7z from above and it kept exiting with wrong passwords. – Oli Nov 16 '10 at 9:05
Broken link, error 404. – gerrit Oct 19 '15 at 19:10

as @oli says rarcrack is pretty awful, but searching over github I found 7zrecover. It is very flexible and it does not miss passwords!

share|improve this answer

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.