“Permission denied.”
If this error appears when you try to read the file, you don’t have read permission. If the error appears as you try to save the file, you don’t have write permission:
See who owns the file:
% ls -l filename
Ask the owner for read/write permission.
If the owner isn’t available, ask your system administrator to change the file permissions.
If you have read permission, you can copy the file into your own directory and work on it there; e.g., to copy a file named memo to your own directory:
% cp memo ~/memo.mine
Be sure to tell the owner that you made changes to a copy of the file.
Repeated denial to files that you think you should be able to share
Can’t create or remove files in a directory
How to change permissions
Check the file’s permissions, owner, and group:
% ls -lg
If you are the file’s owner, use chmod. E.g., to add write permission to all for a file named memo:
% chmod a+w memo
To add permissions for all users:
% chmod a+r memo read permission % chmod a+w memo write permission % chmod a+rw memo read/write
To add permissions for the group:
% chmod g+r memo read permission % chmod g+w memo write permission % chmod g+rw memo read/write
You can also subtract permissions:
% chmod g-rw memo
Or change permissions on all files in a directory:
% chmod g+rw *
Or change the group that a file belongs to:
% chgrp sales memo
Or you can use a three-digit number to indicate what permissions you want for a file; e.g., to give read/write permission to both the file owner (you) and to the group of the file memo, type:
% chmod 660 memo
Other possible values for read-only permission:
400 -r-------- 440 -r--r----- 444 -r--r--r--
Read-write:
600 -rw------- 660 -rw-rw---- 666 -rw-rw-rw-
Read-write-execute:
700 -rwx------ 770 -rwxrwx--- 777 -rwxrwxrwx
Execute only:
100 ---x------ 110 ---xx--- 111 ---xx--x