I have run into this problem too many times. Sometimes when I'm trying to run a command on the terminal it will say "Permission Denied." How can I get that permission??
2 Answers
@Avinash Raj is useful but , I think what user meant without realizing it is how to run a script ./script you need to change the mode and get the permission you can achieve that with
chmod +x script_name.extension
which makes the script executable and let you run it !
or you can right click the file go to properties and then permissions and check the executable checkbox
and then back to terminal to actually run it .
after if you double click it you get options to open in text editor or run in terminal etc..

- 391
- 1
- 3
- 10
-
In addition to this, you can't add executable mode (+x) to a file inside a non-linux (ext) filesystem since they don't support that functionality (like in windows NTFS or FAT32). So ensure that the file you are trying to execute is in the Linux filesystem/directory. – Camicri Jul 01 '14 at 03:28
The permission denied error (code 13) warns you that your request cannot be carried out by the system, since your user/group IDs do not give you the required privileges. For instance, consider this file in my home directory :
$ ls -l test.txt
-rw-r----- 1 me mygroup 0 Jul 1 03:54 test.txt
The rw-r-----
part states that the owner (me
) can perform read/write operations on the file, while members of the mygroup
group can read it. Others can't do anything.
In order to read this file, you'll type :
$ cat test.txt
Yet, if you're not me
, and don't belong to the mygroup
group, you'll get a beautiful Permission denied (13)
error.
If you want to know more about the UNIX permissions system, have a look here, here or here. Note that this system applies to all programs (commands) on your system. Any program trying to read test.txt
must be running as me
, or someone in the mygroup
group in order to succeed (otherwise, the same error will occur).
When performing administration tasks such as package management or system configuration, it is usually necessary to have root
privileges. These tasks require access to files owned by root
, or the execution of kernel-tasks that can only be carried out with super-user privileges. On Ubuntu, you can run a command as root
using sudo
:
$ sudo mycommand
However, this requires you to be registered as a sudoer, which will probably be the case if you're the first or only user on that machine. More about sudo.

- 2,018
- 14
- 21
chmod 777
serves debugging purposes, no more. Don't end up with a full-777 system. – John WH Smith Jul 01 '14 at 02:54chmod 777
. This will only end up with a hopelessly insecure system and (if it was done system-wide) there is no way to un-do it except to wipe and reinstall. I repeat, the appropriate solution is most likely not to change file permissions. – thomasrutter Jul 01 '14 at 03:22chmod +x <filename>
will give execution permission to file. And usesudo <command>
to run as root user – Pandya Jul 01 '14 at 05:25