Permission denied in shell

I am trying to extract a rar file on osx using a shell execution. The unrar command executes fine, but when it tries to extract the files I get a permission denied. I tried a sh and a sudo before the execution, but nothing seems to work.

Can anyone give me some advise, please.

Thank you.

Can you post the command you’re passing to the shell?

Is it possible that you’re trying to extract into an un-writable folder location?

Also, what does theShell.ReadAll return?

when i use wkhtmltopdf in my application within misclibs folder on Macosx, i need to do a chmod on the executable when i got the permission denied.

Dim s As New Shell
s.Execute(“unrar x /Volumes/Music/test/test.rar”)

[quote=39939:@Tim Jones]Is it possible that you’re trying to extract into an un-writable folder location?
Also, what does theShell.ReadAll return?[/quote]

The folder is writeable. I can create files in it using BinaryStream.
The shell execution result is:

[code]UNRAR 4.20 freeware Copyright © 1993-2012 Alexander Roshal
Extracting from /Volumes/Music/test/test.rar

Cannot create text.txt
Permission denied
No files to extract
[/code]

Creating the rar files and extracting them from within the same application works.
But if I try to extract a rar that was made from a different app gives an permission denied.

It looks like the permissions are bound to the app that created the file under OS X?

Yes - it looks like RAR is trying to reset the permissions on the test.txt file to the original permissions and that’s where you’re getting the failure. What is you cd into /private/tmp/ before you extract?

Dim s As New Shell s.Execute("cd /private/tmp ; unrar x /Volumes/Music/test/test.rar")

Yes, in the tmp folder it extracts correctly.

Your shell command executes in a directory that has no write permissions, obviously.
Try this:
s.Execute(“pwd”)
And then see what it outputs. I guess it’s either “/”, i.e. the root dir, which is usually protected.

[quote=40068:@Thomas Tempelmann]Your shell command executes in a directory that has no write permissions, obviously.
Try this:
s.Execute(“pwd”)
And then see what it outputs. I guess it’s either “/”, i.e. the root dir, which is usually protected.[/quote]
BINGO!!!

I had my app creating a BAT file instead of just the one big command
The first line was CD
but I guess BASH is picky… CD didn’t change the path (PWD=/), but “cd” did

I stuck PWD and WHOAMI into the batch file… and now everything seems to work
now to get things pointing back where I want them to be