无法运行编译的文件 - 庆典:./a.out:权限被拒绝。 (我试过CHMOD) [英] Unable to run compiled files - bash: ./a.out: Permission denied. (I've tried chmod)

查看:1058
本文介绍了无法运行编译的文件 - 庆典:./a.out:权限被拒绝。 (我试过CHMOD)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 CC test.c以编译我的C源代码,才生成的a.out 文件

I've compiled my C source using cc test.c, and it did generate a.out file.

然而,当我运行它,我得到这个错误 -

However when I run it I get this error -

bash: ./a.out: Permission denied

我的来源不在主目录,它是在不同的FAT-32分区,所以我已经安装在驱动器,其中code是使用下面的命令 -

My source is not in the home directory, it is on different FAT-32 partition, so I've mounted the drive in which the code is using the following command -

$ udisks --mount /dev/sda7 --mount-options umask=022
Mounted /org/freedesktop/UDisks/devices/sda7 at /media/48E9-FD53
$ cd /media/48E9-FD53/C

然后,我用我的编译code CC

我也试过 GCC 。但我仍然得到同样的错误。

I've also tried gcc. But still I get the same error.

然后我做了 - 搭配chmod + X的a.out ,还是一样的问题。另外随着(行chmod 755 a.out的)和文件模式ü+ X的a.out

Then I did - chmod +x a.out, still the same problem. Also with(chmod 755 a.out) and chmod u+x a.out.

我也试过编译和使用执行程序须藤

I've also tried compiling and executing the program using sudo.

我也尝试 - 须藤CHOWN sannidhya:sannidhya的a.out

我试过,我在Google上搜寻后发现每一件事情,还是没能得到它的工作。

I've tried every thing that I found after googling, still couldn't get it to work.

我如何运行 .OUT 文件(没有它移动到主目录)?

How can I run .out file (without moving it to home directory)?

注意 - 我使用Ubuntu LTS 12.04

Note - I am using Ubuntu 12.04 LTS.

奇怪的事情在这里,即使在运行后搭配chmod + X的a.out ,上运行 - LS -l的a.out ,我得到 -

But a weird thing here is, even after running chmod +x a.out, on running - ls -l a.out, I get-

-rw-r--r-- 1

还当我检查的属性的a.out ,在权限标签,当我检查允许执行文件作为节目,蜱出现并迅速消失。

also when I check the properties of a.out, under Permissions tab, when I check Allow executing file as program,the tick appears and quickly disappears.

推荐答案

看来你已经安装在分区没有-exec标志设置。你必须重新挂载分区:

Seems that you've mounted the partition with with no-exec flag set. You'll have to remount the partition:

sudo mount -o remount -o exec /dev/sda7

这篇关于无法运行编译的文件 - 庆典:./a.out:权限被拒绝。 (我试过CHMOD)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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