Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ant Permission Denied problem

After extracting and saving the ant files into an opt/ directory and setting the path variable to $ANT_HOME/bin

I ran the following command on a CentOS 5

ant -version

and I am getting the following error

-bash:/path/opt/apache-ant-1.8.2/bin/ant: Permission denied

Is there some permission I am supposed to set or some typical source of this problem?

Thanks!

like image 923
algorithmicCoder Avatar asked May 22 '11 10:05

algorithmicCoder


1 Answers

If you own the file, try

chmod u+x /path/opt/apache-ant-1.8.2/bin/ant

If someone else owns it, either sudo or become root then

chmod 755 /path/opt/apache-ant-1.8.2/bin/ant

You need to have execute permissions on the file; the first gives execute permissions to the owner only and is probably preferable if you own the file and are the only one that uses it. The second requires root privileges and gives execute and read permission to everyone, plus write permission to the owner.

You can view the current permissions and ownership of the file by running ls -l /path/opt/apache-ant-1.8.2/bin/ant.

like image 99
El Yobo Avatar answered Sep 23 '22 07:09

El Yobo