Linux ant 权限被拒绝问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6087421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:12:17  来源:igfitidea点击:

ant Permission Denied problem

linuxshellunixantcentos

提问by algorithmicCoder

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!

谢谢!

采纳答案by El Yobo

If you own the file, try

如果您拥有该文件,请尝试

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

If someone else owns it, either sudoor 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