Executing from NTFS partition

I have a shared drive with openSUSE 13.1 and Windows 8.1 Pro that is NTFS (originally formatted from Windows 7 SP1 Pro). I am trying to learn how to program in C (maybe relevant), and I am compiling to said NTFS partition with gcc without a problem lol!. The problem is when I try to execute the a.out file that is generated I always get this error >:(:

bash: ./a.out: Permission denied.

Ok, so I try to run ./a.out again as root and I get the same results. So I change the drive permissions with chmod (said partition is mounted as /home):

sudo chmod -R ugo+rwx /home

I try executing again to no avail, so I double check that the permissions were actually written:

michael@linux-kb46:~/Documents> ls -l /
total 112
drwxr-xr-x   2 root root   4096 Jan 26 01:57 bin
drwxr-xr-x   4 root root   4096 Jan 26 11:47 boot
drwxr-xr-x  20 root root   4100 Jan 27 22:52 dev
drwxr-xr-x 155 root root  12288 Jan 27 23:16 etc
drwxrwxrwx   1 root root   4096 Jan 27 18:11 home
drwxr-xr-x  15 root root   4096 Jan 26 12:18 lib
drwxr-xr-x   7 root root  12288 Jan 26 02:28 lib64
drwx------   2 root root  16384 Jan 26 01:08 lost+found
drwxr-xr-x   2 root root   4096 Sep 27 16:24 media
drwxr-xr-x   2 root root   4096 Sep 27 16:24 mnt
drwxr-xr-x   5 root root   4096 Jan 27 23:35 opt
dr-xr-xr-x 261 root root      0 Jan 27 17:15 proc
drwx------  25 root root   4096 Jan 27 23:21 root
drwxr-xr-x  31 root root    820 Jan 27 23:16 run
drwxr-xr-x   2 root root  12288 Jan 26 02:45 sbin
drwxr-xr-x   2 root root   4096 Sep 27 16:24 selinux
drwxr-xr-x   7 root root   4096 Jan 26 02:31 srv
dr-xr-xr-x  12 root root      0 Jan 27 22:15 sys
drwxrwxrwt  26 root root   4096 Jan 27 23:45 tmp
drwxr-xr-x  13 root root   4096 Nov  6 14:53 usr
drwxr-xr-x  16 root root   4096 Jan 26 02:06 var
drwxr-xr-x   1 root users  8192 Jan 25 11:43 win8
michael@linux-kb46:~/Documents> 

So the I realize that ntfs-3g does not allow live alteration of permissions on an NTFS partition, so I changed my /etc/fstab file to this:

/dev/disk/by-id/ata-ST95005620AS_5YX1NEZD-part6 swap swap defaults 0 0
/dev/disk/by-id/ata-ST95005620AS_5YX1NEZD-part7 / ext4 acl,user_xattr 1 1
/dev/disk/by-path/pci-0000:00:1f.2-scsi-1:0:0:0-part5 /home ntfs-3g defaults,users,group=users,locale=en_US.UTF-8 0 2
/dev/disk/by-id/ata-ST95005620AS_5YX1NEZD-part4 /win8 ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

Seems correct to me. So I restart my computer just to make sure the changes went into effect and it doesn’t help. I have had success moving the file to /opt and executing it as root. So does anyone know how I can fix this problem? It is especially perplexing since both reading and writing from/to the partition work, and running as root doesn’t help.

Thank you in advance.

If the ntfs partition is used by windows 8 OS
You must SHUT windows down fully to make the partition fully accessible from Linux
Windows 8, by default does not actually Shut down, you have to change the settings to make it do this.

Please click here the watch Will You Still Love Me Tomorrow? online.
Also Follow link.
Please Click here to watch online the watch The Secret Life Of Walter Mitty online.
Also follow.
Please Get here the watch The Hobbit: The Desolation of Smaug online.
Also Click here to watch online.
Please source the watch Ride Along online.
Also Get here.
Please follow the watch Grudge Match online.
Also click here.
Please Click here to watch online the watch Her online.
Also source.
Please click here the watch Delivery Man online.
Also Follow this link.
Please Click this to watch the watch The Legend of Hercules online.
Also Get here.
Please click here the watch Frozen online.
Also Click this to watch.
Please Get here the watch Devil’s Due online.
Also Click here to watch online.
Please click here the watch Lone Survivor online.
Also source.
Please click here the watch American Hustle online.
Also source.
Please click here the watch The Nut Job online.
Also follow.
Please Click this to watch the watch The Wolf of Wall Street online.
Also source.
Please click here the watch Jack Ryan: Shadow Recruit online.
Also follow.

You better use non-Linux file systems for exchanging data with non-Linux systems only.
You are doing program development for Linux on it, that is not a good idea IMHO.

Non-Linux file systems do not have the ownership/group and permission bits. That is all mimmiced. But that has it’s consequences.

On 2014-01-28 06:06, mfoley93 wrote:

> Seems correct to me. So I restart my computer just to make sure the
> changes went into effect and it doesn’t help. I have had success moving
> the file to /opt and executing it as root. So does anyone know how I
> can fix this problem? It is especially perplexing since both reading
> and writing from/to the partition work, and running as root doesn’t
> help.

It is probably mounted “noexec”. Defaults.

But doing what you are doing means that all the files in that ntfs
partition will be considered executable, even if they are not.

Not a good thing.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Windows 8 is completely shut down as far as I can tell. I don’t have a UEFI BIOS or secure boot capabilities on my computer at all. And I double checked per your suggestion and “Fast Boot” is disabled in the Windows power settings (kind of difficult to find by Windows standards).

I recognize your point, but I don’t really have the disk space for a large enough Linux file system to really work with, everything is pretty much full. That, and right now I’m not programming for any particular platform, everything is simple and the code itself should be platform agnostic. I’m just learning and as of yet the most difficult thing I’ve done is a simple “What’s your name?” → “Your name is …” kind of thing.

It should just be mounted defaults,users,group=users as the fstab file says, so why would it mount noexec? Also, could you please elaborate on why it isn’t good to have everything listed as executable, I fail to see the real harm there.

Well, thanks for everyone’s interest.

Well you can always check the permissions to see.

I haven’t tried to do what you’re doing, but doesn’t that command simply remove permissions (if it even works with NTFS permissions)?
I imagine you should also want to take ownership or otherwise apply permissions that allow access.

I’m also surprised that your /home would be placed on NTFS (is that really correct?).
And, I really wouldn’t advise messing around with the permissions on your /home no matter what the file system is.

If you’re really tight on disk space, I’d recommend

  • Run from a USB stick or LiveCD
  • Get an external disk if you can afford it.
  • If there isn’t an issue for you, if your root file system ( / ) is on a Linux FS, I’d just create a small folder on that partition and do your C coding in there instead of working on NTFS. Or, boot to Windows to do your compiling and executing on NTFS.

I’m hesitant to suggest because your hybrid Linux/Windows appears to be so unusual, but you could try to modify the permissions from within Windows… Rt-click the top of the file system tree you want to modify, click the Security tab and “Advanced,” then start checking or unchecking everything you want. But, if you don’t know what you’re doing, this kind of thing can render your system vulnerabile or unbootable, so beware.

TSU

On 2014-01-28 19:36, mfoley93 wrote:
> robin_listas;2620079 Wrote:

>> > Not a good thing.
> It should just be mounted defaults,users,group=users as the fstab file
> says, so why would it mount noexec?t.

I mean this:


> minas-tirith:~ # grep /windows/C /etc/fstab
> UUID="D89260D89260BD1E"   /windows/C       ntfs-3g user,users,gid=users,fmask=0117,dmask=0007,locale=en_US.UTF-8      0 0
> minas-tirith:~ # mount | grep windows
> /dev/sda2 on /windows/C type fuseblk (rw,nosuid,nodev,noexec,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096)
> minas-tirith:~ #

Notice the options used on fstab? Notice then the actual mount options
that were used?

Noexec is a default option, implicit, for ntfs.

> Also, could you please elaborate on
> why it isn’t good to have everything listed as executable, I fail to see
> the real harm there.

The permissions you see from Linux on and NTFS or FAT partitions are
emulated, not the real on disk permissions. You get the permissions you
define at mount time, and they are the same for all files on the disk
(ok, the partition).

So, if you want execute permission for a file, you get execute
permissions on all files.

So, it can happen (depending on the browser), if you click to open a
text file, it may try instead to execute it, with unpredictable results.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

I repeat, you should not use a non-Linux file system as an integral part of your Linux system. and certainly not mounted on /home.

All the warnings above from others apply.

And when something gives a warning/error (like Permission denied), you should not fall back to a sort of “rather dead then slave” attitude by trying the same thing again as Superuser. That is certainly a recipe for disaster. You should try to understand why you get that message. And for this particular case, it requires knowledge about file ownership by user/group and permission bits read/write/execute for owner/group/world.

This is only my advice. It is up to you to take it or leave it.

On 2014-01-29 10:16, hcvv wrote:
>
> I repeat, you should not use a non-Linux file system as an integral part
> of your Linux system. and certainly not mounted on /home.

I did not notice that “detail”. You are right, “/home” absolutely must
be a Linux filesystem.

If you do not have space for a separate “/home” partition, then instead
use the main filesystem (root), and use symlinks from your home to
spaces in your Windows partitions for data. Like for example:


/home/username/Documents/Win -->  /windows/C/Users/username/Documents/


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Definitely.

Advice: Before you wind up in a real mess, perhaps we should see what your disk layout is so we can make some sound suggestions to straighten up your system.

Open a terminal as root (Terminal - Super User Mode), then do:

fdisk -l

(that’s a small letter “L”, not a number “1”)

Copy the output

(select the output using your mouse cursor, then do

Ctrl-Shift-c

)

Post it here

(Start a post, then click on the # symbol at the top of the post, then between the “CODE” and “(slash)CODE” blocks, do

Ctrl-v

This will be a list of your partition setup.

Then, do

df -h

and post that output here the same way.

We should be able to make some important suggestions, then.

-fb

On 2014-01-30 05:26, Fraser Bell wrote:
>
> robin_listas;2620382 Wrote:
>>
>> … “/home” absolutely must be a Linux filesystem.
>>
>
> Definitely.
>
> Advice: Before you wind up in a -real mess-, perhaps we should see
> what your disk layout is so we can make some sound suggestions to
> straighten up your system.

Agreed.

> Open a terminal as root (Terminal - Super User Mode), then do:
>
>
> Code:
> --------------------
> fdisk -l
> --------------------


lsblk --fs

is also very instructive.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)