Joshua David
asked on
bash: ./Facebooker.pl :Permission Denied
hey i am using kali linux and just trying to open Facebooker.pl in the terminal but it always says bash: ./Facebooker.pl :Permission Denied
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Agreed with Arnold. Giving read,write,execute to everyone is bad practice.
To correct permission issues follow the following steps (i am assuming you have enough rights)
1. Figure out what user you are using to execute the file by executing the command: whoami.
2. Figure out the permission and ownership settings on your file by executing the command: ls -lart /path/to/your/file/Faceboo ker.pl
example:
4. Review the rights on the file [example: -rw-r--r-- meaning: stickybit=0, user Foo: read,write, users in group Bar: read, other users: read] and alter them using the instruction provided by Arnold. The example rule doesnt have execute rights, so it will provide the same error.
5. Validate if the file can be executed by running the file ./path/to/your/file/Facebo oker.pl
6. If all else fails being root you can also use the command: . ./Facebooker.pl (dot space dot slash) to execute the file overruling the execute permissions.
To correct permission issues follow the following steps (i am assuming you have enough rights)
1. Figure out what user you are using to execute the file by executing the command: whoami.
2. Figure out the permission and ownership settings on your file by executing the command: ls -lart /path/to/your/file/Faceboo
example:
-rw-r--r--. 1 Foo Bar 0 May 10 15:53 /home/example/Facebooker.pl
3. Review the ownership [example: owner:Foo group:Bar] and alter for example the ownership to your user named hacker using the command: chown hacker:bar ./Facebooker.pl4. Review the rights on the file [example: -rw-r--r-- meaning: stickybit=0, user Foo: read,write, users in group Bar: read, other users: read] and alter them using the instruction provided by Arnold. The example rule doesnt have execute rights, so it will provide the same error.
5. Validate if the file can be executed by running the file ./path/to/your/file/Facebo
6. If all else fails being root you can also use the command: . ./Facebooker.pl (dot space dot slash) to execute the file overruling the execute permissions.
[root@sux12 example]# ./Facebooker.pl
-bash: ./Facebooker.pl: Permission denied
[root@sux12 example]# . ./Facebooker.pl
Im Running!
I know it is a bad habit to give permission to all that is why I mentioned it on the below that you are giving access to all.
You can use instead chmod 700 Facebooker.pl .
By the above commands, you are giving permission to the only user.
You can use instead chmod 700 Facebooker.pl .
By the above commands, you are giving permission to the only user.
In addition to my fist comment. The problem might also be caused by the perl executable the file is prob. trying to run. Review the first line of the .pl file using: head -n 1 /path/to/your/file/Faceboo ker.pl.
Try to run the perl executable and make sure you are allowed to using the instructions before.
[root@sux12 home]# head -n 1 /home/example/Facebooker.pl
#!/usr/bin/perl
Try to run the perl executable and make sure you are allowed to using the instructions before.
[root@sux12 home]# /usr/bin/perl -version
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Why not just use chmod +x Facebooker.pl instead?
Hi serial,
As the post of Arnold explains, you might as well use chmod 777 which isnt very secure. Best practice is to apply least privs on executables.
As the post of Arnold explains, you might as well use chmod 777 which isnt very secure. Best practice is to apply least privs on executables.
@Chris, Gralike.
Sorry, keyboard stuck. should have been chmod u+x Facebooker.pl
You should really not use the numbers anymore with chmod. I think very long ago, that was a standard practice. You should generally specify one of the u(+/-)rwx, g(+/-)rwx, o(+/-)rwx combinations to add or subtract the permission mask you want rather than forcibly setting everything as a hard coded mask.
Sorry, keyboard stuck. should have been chmod u+x Facebooker.pl
You should really not use the numbers anymore with chmod. I think very long ago, that was a standard practice. You should generally specify one of the u(+/-)rwx, g(+/-)rwx, o(+/-)rwx combinations to add or subtract the permission mask you want rather than forcibly setting everything as a hard coded mask.
ASKER
Thank you sir. your help means a lot. And by the way thanks to all the other experts also for responding to my question..
Thanks to you all !
Thanks to you all !
chmod 777 example.com
or
chmod 777 Facebooker.pl
This command will give permission to user, group and others on the system to access that!