Why can't I run programs on another partition in Linux?
Solution 1
Make sure that your mount options allow the execute permission bit.
There are mount options one can use to limit the permissions of files within the mounted filesystem: general noexec
prevents all files from being executable, FAT-specific option showexec
grants the permission only to files with extensions .exe
, .com
and .bat
. Note also that noexec
is implied by user
and users
.
If you use user
or users
you can still get the execute permission bit working by mounting with explicitly specified exec
mount option after the user
or users
option.
See mount manpage for details.
Solution 2
When you mount a FAT or NTFS partition, the permissions are determined at mount time, by the umask
, fmask
and dmask
options. The first is general, the other two are specific for files and directories.
Also you may be interested in uid
and gid
option to establish the owner and group of all files and directory on the partition.
An example:
mount -t ntfs-3g -o uid=500,gid=500,umask=0022 /dev/sda1 /mnt/win
Related videos on Youtube
TegRa
Updated on September 18, 2022Comments
-
TegRa over 1 year
So for convenience, I store all my data on my Windows partition so that I can access my data easily from both Linux and Windows. However, I tried compiling a C++ program with g++, and found out that I cannot run the program with
./program_filename
, as it tells mebash: program_filename: Permission denied
Doing
cp program_filename ~/program_filename
and running it from my home directory works just fine, however.
So I tried
chmod +rwx program_filename
, butls -l
shows that the permissions are still set as-rw-------.
for all files in the directory. Nothing changes when I do this as root, either.Is there a simple fix for this?
(In case it's useful, I am running Fedora 16 x64)
-
drs over 9 yearsWelcome to Unix & Linux! Since links often go stale, it is always preferred to include the essential parts of the answer here, and provide the link for reference.