Sunteți pe pagina 1din 5

"Permission Denied" when trying to

open a file in Terminal


#1
Hi everyone
I was trying to open a file (a keygen to be more precise).it was non-executable so
I used chmod +x command in terminal and everything went well to this
point.after this when I tried to open the file i got the "Permission Denied" error.
I tried the sudo command but it couldn't do the job either.
I created another admin account and everything worked with no problem.
so what's wrong with the account I use now? How can I make it right?
Thanks in advance

Feb 11, 2011


LPZ
macrumors 65816
Jul 11, 2006
#2
Please do the following:

1) Open Terminal (in Utilities).

2) Type the following into Terminal, leaving a space after the final character. Do
not press return yet.

Code:
ls -l
(That's lowercase-L before the s and after the hyphen.)

3) Drag the file you wish to open and drop it into the Terminal window. This will
append the file's location to the command you entered, but will not actually
move the file.

4) Now click on the Terminal window to make it active, and press return.

5) Copy and post the complete output.

Feb 11, 2011


Juventino
thread starter
macrumors member
Jun 26, 2010
Tehran
#4
This is what I get :
Code:
-rw-r--r-- 1 Amin staff 30725 Jan 17 05:47 /Users/Amin/Desktop/keygen_osx

Feb 11, 2011


LPZ
macrumors 65816
Jul 11, 2006
#6
Juventino said: ↑
This is what I get :
Code:
-rw-r--r-- 1 Amin staff 30725 Jan 17 05:47 /Users/Amin/Desktop/keygen_osx

The file is owned by Amin, who has permission to read and write. The file is not
executable.

User Amin should be able to read/write to this file (assuming it's a text file)
using TextEdit (for example).

Feb 11, 2011


Sirobin
macrumors 6502
May 6, 2008
California
#7
Try

chmod u+x keygen_osx

and then see if you can execute it.

Feb 12, 2011


Juventino
thread starter
macrumors member
Jun 26, 2010
Tehran
#8
I log in with the account Amin
tried the chmod u+x, still the same result :

Code:

Last login: Sat Feb 12 16:30:38 on console


Amins-MacBook:~ Amin$ chmod u+x/Users/Amin/Desktop/keygen_osx
usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ...
chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...
Amins-MacBook:~ Amin$ /Users/Amin/Desktop/keygen_osx
-bash: /Users/Amin/Desktop/keygen_osx: Permission denied
Feb 12, 2011
Beaverman3001
macrumors 6502
May 20, 2010
#9
This is kind of obvious, but did you repair permissions on the drive yet? Also
with the last command you posted, you left out a space between u+x and the
path, so that command isn't valid. If it worked on one account and not another
you should also consider you might have mistyped.

Feb 12, 2011


LPZ
macrumors 65816
Jul 11, 2006
#10
Juventino said: ↑
I log in with the account Amin
tried the chmod u+x, still the same result :

Code:

Last login: Sat Feb 12 16:30:38 on console


Amins-MacBook:~ Amin$ chmod u+x/Users/Amin/Desktop/keygen_osx
usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ...
chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...
Amins-MacBook:~ Amin$ /Users/Amin/Desktop/keygen_osx
-bash: /Users/Amin/Desktop/keygen_osx: Permission denied
Click to expand...
In Terminal, enter

Code:
chmod 755 ~/Desktop/keygen_osx
to make the file executable.

Then enter

Code:
~/Desktop/keygen_osx
to execute it.

Feb 12, 2011


calderone
macrumors 68040
calderone
Aug 28, 2009
Seattle
#11
Beaverman3001 said: ↑
This is kind of obvious, but did you repair permissions on the drive yet?
What relevance could this possibly have to the OPs question?

Feb 12, 2011


Juventino
thread starter
macrumors member
Jun 26, 2010
Tehran
#12
Beaverman3001 said: ↑
Also with the last command you posted, you left out a space between u+x and the
path, so that command isn't valid. If it worked on one account and not another
you should also consider you might have mistyped.
nah, it's not about mistyping.look at this :

test account :

Code:
Last login: Sun Feb 13 02:06:46 on console
Amins-MacBook:~ test$ chmod u+x/Users/test/Desktop/keygen_osx
usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ...
chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...
Amins-MacBook:~ test$ /Users/test/Desktop/keygen_osx
.
:
|
______|____
_\ /
\ ___\
- ---- \_ __\__--- - [ e ] m b r a c e -- - --- ----- --------
/ /
/____________\
| ... try E once ...
|
: ... and your addicted!
.

Arobas Guitar Pro 6 Keymaker


Enter your offline activation request code:
my current account :

Code:
Last login: Sat Feb 12 17:24:09 on ttys000
Amins-MacBook:~ Amin$ chmod u+x/Users/Amin/Desktop/keygen_osx
usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ...
chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ...
Amins-MacBook:~ Amin$ /Users/Amin/Desktop/keygen_osx
-bash: /Users/Amin/Desktop/keygen_osx: Permission denied
I typed the same thing in both.

---

The chmod 755 command worked! thank you LPZ for your time.
as I know chmod 755 means read and execute access for everyone and also write
access for the owner of the file.
according to the last log I posted I already had read/write access.
I still don't know what the problem was!

http://www.maclife.com/article/feature/25_terminal_tips_every_mac_user_sho
uld_know

http://stackoverflow.com/questions/12276507/run-script-on-mac-prompt-
permission-denied

https://developer.apple.com/library/mac/documentation/Darwin/Reference/
ManPages/man8/sudo.8.html

http://smallbusiness.chron.com/terminal-permission-denied-os-x-31587.html

S-ar putea să vă placă și