Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Executing from NTFS partition

  1. #1

    Question 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 . The problem is when I try to execute the a.out file that is generated I always get this error :

    Code:
    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):

    Code:
    sudo chmod -R ugo+rwx /home
    I try executing again to no avail, so I double check that the permissions were actually written:

    Code:
    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.

  2. #2
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,733
    Blog Entries
    20

    Default Re: Executing from NTFS partition

    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.
    Leap 15.1_KDE
    My Articles Was I any help? If yes: Click the star below

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,251

    Default Re: Executing from NTFS partition

    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.
    Henk van Velden

  4. #4
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Executing from NTFS partition

    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)

  5. #5

    Default Re: Executing from NTFS partition

    Quote Originally Posted by caf4926 View Post
    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.
    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).

    Quote Originally Posted by hcvv View Post
    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.
    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.

    Quote Originally Posted by robin_listas View Post
    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.
    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.

  6. #6
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,760

    Default Re: Executing from NTFS partition

    Well you can always check the permissions to see.

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,377
    Blog Entries
    2

    Default Re: Executing from NTFS partition

    Quote Originally Posted by mfoley93 View Post

    Code:
    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):

    Code:
    sudo chmod -R ugo+rwx /home
    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

  8. #8
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Executing from NTFS partition

    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:

    Code:
    
    > 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)

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,251

    Default Re: Executing from NTFS partition

    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.
    Henk van Velden

  10. #10
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Executing from NTFS partition

    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:

    Code:
    /home/username/Documents/Win -->  /windows/C/Users/username/Documents/
    --
    Cheers / Saludos,

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

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •