Ubuntu 说“bash: ./program Permission denied" [英] Ubuntu says "bash: ./program Permission denied"

查看:26
本文介绍了Ubuntu 说“bash: ./program Permission denied"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在计算机 1 和计算机 2 上运行 Ubuntu.我在计算机 1 上编译了一个 C++ 程序,我可以使用 ./program_name 从终端执行它.它运行良好.

I am running Ubuntu on computer 1 and computer 2. I compiled a C++ program on computer 1, and I can execute it from the terminal using ./program_name. It runs fine.

但是,当我尝试在计算机 2 上执行此操作时,它显示:bash: ./program_name: permission denied

However, when I try to do this on computer 2, it says: bash: ./program_name: permission denied

出了什么问题,我该怎么办?

What's wrong and what can I do about it?

推荐答案

chmod u+x program_name.然后执行它.

如果这不起作用,请将程序从 USB 设备复制到系统上的本机卷.然后在本地副本上 chmod u+x program_name 并执行它.

If that does not work, copy the program from the USB device to a native volume on the system. Then chmod u+x program_name on the local copy and execute that.

Unix 和类 Unix 系统通常不会执行程序,除非它被标记为具有执行权限.您将文件从一个系统复制到另一个系统(或安装外部卷)的方式可能已关闭执行权限(作为一项安全功能).命令 chmod u+x name 为拥有文件的用户添加执行它的权限.

Unix and Unix-like systems generally will not execute a program unless it is marked with permission to execute. The way you copied the file from one system to another (or mounted an external volume) may have turned off execute permission (as a safety feature). The command chmod u+x name adds permission for the user that owns the file to execute it.

该命令仅更改与文件关联的权限;它不会更改与整个卷关联的安全控制.如果是卷上的安全控制干扰了执行(例如,可以为 Unix fstab 文件中的卷指定一个 noexec 选项,该选项表示不要允许对卷上的文件执行权限),然后您可以使用允许执行的选项重新挂载卷.但是,将文件复制到本地卷可能是一种更快、更简单的解决方案.

That command only changes the permissions associated with the file; it does not change the security controls associated with the entire volume. If it is security controls on the volume that are interfering with execution (for example, a noexec option may be specified for a volume in the Unix fstab file, which says not to allow execute permission for files on the volume), then you can remount the volume with options to allow execution. However, copying the file to a local volume may be a quicker and easier solution.

这篇关于Ubuntu 说“bash: ./program Permission denied"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆