简体   繁体   English

Linux“权限被拒绝”的解决方法

[英]Solution for Linux "permission denied"

I am pretty new to the Ubuntu environment and I have a question regarding the solution to "permission denied" error.我对 Ubuntu 环境很陌生,我对“权限被拒绝”错误的解决方案有疑问。

When I am trying to run the following command that executes a shell script and writes the result into a txt file, I get the permission denied error.当我尝试运行以下执行 shell 脚本并将结果写入 txt 文件的命令时,出现权限被拒绝错误。

./test_image.sh > testCase.txt

I know that I can just sudo run the command, but I am hoping to do this command through a Java program and was wondering if there would be a way to give permission to any user that is trying to run this command.我知道我只能 sudo 运行命令,但我希望通过 Java 程序执行此命令,并且想知道是否有办法向任何尝试运行此命令的用户授予权限。

Thank you in advance!!先感谢您!!

Why do you have permission deny error?为什么你有权限拒绝错误? Maybe you need to give your script rights to execute (eg. chmod +x test_image.sh) or give the user rights to write/change testCase.txt in a given directory.也许您需要授予脚本执行权限(例如 chmod +x test_image.sh)或授予用户在给定目录中写入/更改 testCase.txt 的权限。 I am afraid you need to learn a bit about standard permissions or even ACLs, Selinux policy, setuid, sticky bits, etc.恐怕您需要了解一些有关标准权限甚至 ACL、Selinux 策略、setuid、粘滞位等的知识。

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

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