In the following example we made all files in the /mnt/d executable for their owners. This can be a bit dangerous because it may lower the security barier and may give the owner users to execute other binaries. If the permission denied error is not solved yet the last step is setting the directory permission recursively where the binary, executable, script, application file resides. sudo mount -o remount,exec /dev/sda3 / Set Target/Directory Path Permission In the following examle we remount the partition “/dev/sda3” to the “/” with the exec option. mount -lĪfter specifying the file system with the noexec option we should remount this file system with the exec option. Check the file system if it is mounted with the noexec option by using the mount command with the -l option. File systems may prevent the execution of the command, script, program, or application it mounted as with noexec option. The commands are stored in a disk where they are mounted to the Linux system with file systems. If setting execution permission and changing the owner user of the file is not solved the problem there are other things to do. sudo chown ahmet:ahmet Set Execution Permission For File System The first ahmet is the owner user and the second ahmet is the owner group. In the following example, we change the file owner user and owner group to the ahmet. For example, 1 and 2 variable are used to read first and second command line arguments. What is bash script example Bash script can read input from command line argument like other programming language. Make the script executable with command chmod +x. But this operation requires the root privileges which can be provided with the sudo command. Write the script in the file using an editor. The current owner of the file can be changed with the chown command. We can see that the user ismail has the execution permission which is depicted in the rw xrwxr-x. We can see that the current owner of the helloworld command is the user “ismail”. ls -l -rwxrwxr-x 1 ismail ismail 16864 Nis 11 18:28 helloworld Let’s list the owner information about the specified script. chmod u+xīut this makes the file executable for the current owner of the executable, program, application, or script. The execution permission can be set with the chmod u+x command for the owner. In order to run an executable, program, application or script we should have the execution permission. The first way to solve the permission denied error is settings proper permissions. If the required permissions are not set you may get the “Permission Denied” error. Linux requires different privileges and permissions in order to execute, read, write files, scripts, and commands, etc. In this tutorial, we list some solutions to the permission denied error. This error can be caused for different reasons. When a script, program, application, or command is tried to be executed there may be errors like “ Permission Denied“. Linux bash can be used to run and execute scripts, programs, applications, and commands in a fast and practical way.