287

I have a zip file that I need to extract into another folder. When I set up extraction to said folder it says "permission denied". I've read here how to log into a terminal as root and superuser but can't find anything to help me.

I need to extract a file from my Downloads directory to /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins.

Please explain how to extract a zip file to the correct folder.

4
  • Are you limited to command line? What folder are you trying to extract to? Is the extension .zip?
    – Dan
    Sep 5, 2014 at 16:38
  • yes the extension is .zip im trying to extract the zip file to plex media server plug ins ...its in my downloads folder but when i try and extract to new directory it says i dont have permission
    – Tj Cooke
    Sep 5, 2014 at 16:41
  • Into which folder are you trying to extract it to?
    – Parto
    Sep 5, 2014 at 16:51
  • var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins to be exact is where i want it to go
    – Tj Cooke
    Sep 5, 2014 at 16:55

3 Answers 3

380

We'll extract to a different folder to be sure that permissions aren't in our way:

  1. Open a terminal (Ctrl+Alt+T should work).

  2. Now create a temporary folder to extract the file:

    mkdir temp_for_zip_extract
    
  3. Let's now extract the zip file into that folder:

    unzip /path/to/file.zip -d temp_for_zip_extract
    

You should now have the contents of your zip file temp_for_zip_extract and can copy them into the desired folder.

If you can't copy the files to your folder, then check the permissions on your target folder.

The path to the downloads folder depends on what you used to download it to, try ~/Downloads. If you can't find it, then try this in a terminal:

cd ~;  find -name 'filename.zip'

You can also use a file manager, of course. There is Nautilus, Nemo, Thunar and many more, depending on your environment. Start the file manager and double click on your zip file, just like you would do in Windows.

15
  • ok now i guess im typing wrong pathname ....feel stupid asking this but what would be the default path to my downloads folder in terminal?
    – Tj Cooke
    Sep 5, 2014 at 16:50
  • basically i want to add a plug in to my plex media server i just need to add this bundle there so i can install channels to my server
    – Tj Cooke
    Sep 5, 2014 at 16:51
  • See my edit on how to find your file. I believe you only have a permission problem.
    – Jan
    Sep 5, 2014 at 16:55
  • yeah its a permissions problem and having no luck finding it in terminal i can see it under files under my name /home/Downloads but cant find in terminal says no such file or directory
    – Tj Cooke
    Sep 5, 2014 at 17:08
  • isnt there a program or something that will just unzip to appropriate folder with permissions already set?
    – Tj Cooke
    Sep 5, 2014 at 17:09
44

Your targeted directory is owned by root (/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins), so you cannot write to it as a normal user.

Instead of mucking around with permissions, you can use sudo to unzip as the superuser.

sudo unzip ~/Downloads/whatever.zip -d "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins"

I suggest you do this to a temporary directory first to ensure the files are what you expect and will not damage/destroy your plex installation:

unzip ~/Downloads/whatever.zip -d /tmp/whatever

then cd /tmp/whatever and verify that contents are what you expect. If so, then go ahead with the sudo command I showed above.

1
  • 1
    I end up with /tmp/whatever/whatever that actually has all the files. How do I remove that if I don't know the name of the second whatever?
    – user677955
    Mar 26, 2022 at 20:06
0

Try this: extract to the current directory, and then move to the directory you want:

ls zipped_folder output:

- folder1
- file1
- file2
...
unzip zipped_folder.zip;
mv zipped_folder destination_folder/;

ls destination_folder will give:

zipped_folder
- folder1
- file1
- file2
...
existing_folder
- ...
- ...
existing_file1
existing_file2
...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .