简体   繁体   English

ant Permission Denied问题

[英]ant Permission Denied problem

After extracting and saving the ant files into an opt/ directory and setting the path variable to $ANT_HOME/bin 解压缩并将ant文件保存到opt /目录并将路径变量设置为$ANT_HOME/bin

I ran the following command on a CentOS 5 我在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! 谢谢!

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 如果其他人拥有它,那么sudo或者成为root

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. 第二个需要root权限,并为每个人提供执行和读取权限,以及对所有者的写入权限。

You can view the current permissions and ownership of the file by running ls -l /path/opt/apache-ant-1.8.2/bin/ant . 您可以通过运行ls -l /path/opt/apache-ant-1.8.2/bin/ant来查看文件的当前权限和所有权。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM