Recent

Author Topic: executable permission  (Read 6485 times)

airpas

  • Full Member
  • ***
  • Posts: 179
executable permission
« on: July 31, 2014, 12:56:42 pm »
Hi
how do you make the application run on another linux distro , without adding (chmod +x) ?.
my app's run only in the distro where lazarus installed , if i move my app binary to another distro it says ( Permission denied) until i type ( chmod +x )

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: executable permission
« Reply #1 on: July 31, 2014, 01:21:17 pm »
AFAIK you can't. Part of security.

You could create a shell script that runs chmod +x yourprogram, but you still need users to run the shell script.

Presumably you could write a daemon that automatically sets execute on all files in a directory or something, or there might be another mechanism to do this but I've never heard of one.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

airpas

  • Full Member
  • ***
  • Posts: 179
Re: executable permission
« Reply #2 on: July 31, 2014, 01:45:52 pm »
thanks
solved by put the app in a zip archive and then extract it in the guest distro .
seems transferring the app (naked) from host distro to usbdisk to guest distro  , changed the permission bits!!
« Last Edit: July 31, 2014, 01:51:58 pm by airpas »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: executable permission
« Reply #3 on: July 31, 2014, 03:45:35 pm »
Ah, that's a nice solution.

Edit: though I wonder what happens if the user names<>uid mappings are different on those systems...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: executable permission
« Reply #4 on: July 31, 2014, 09:31:13 pm »
thanks
solved by put the app in a zip archive and then extract it in the guest distro .
seems transferring the app (naked) from host distro to usbdisk to guest distro  , changed the permission bits!!
Yep, that's expected. Direct copying should turn off executable permission to avoid unintended run (e.g. without user noticing).

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: executable permission
« Reply #5 on: July 31, 2014, 11:58:30 pm »
Yep, that's expected. Direct copying should turn off executable permission to avoid unintended run (e.g. without user noticing).
I doubt it is that! The USB stick probably has a FAT32 file system, which knows nothing about Linux's file permissions. Format your USB stick as EXT3/4, JFS etc.... any file system that supports *nix like permissions, then copying files onto it will retain permissions. USB sticks might come standard with FAT32, but they can be formatted (just like a hard drive) to any other file system. All my USB sticks don't have FAT32 any more.

Alternatively, tar.gz the files before copying.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: executable permission
« Reply #6 on: August 01, 2014, 12:34:37 am »
Yep, that's expected. Direct copying should turn off executable permission to avoid unintended run (e.g. without user noticing).
I doubt it is that! The USB stick probably has a FAT32 file system, which knows nothing about Linux's file permissions. Format your USB stick as EXT3/4, JFS etc.... any file system that supports *nix like permissions, then copying files onto it will retain permissions. USB sticks might come standard with FAT32, but they can be formatted (just like a hard drive) to any other file system. All my USB sticks don't have FAT32 any more.

Alternatively, tar.gz the files before copying.
Proven on my machine. I transfer between two ext4 drives.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: executable permission
« Reply #7 on: August 01, 2014, 11:50:23 am »
Alternatively, some commonly used NASses have NFS options. This allows for native *nix shares.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: executable permission
« Reply #8 on: August 01, 2014, 02:44:39 pm »

Quote
Proven on my machine. I transfer between two ext4 drives.

That is very strange because I have used a ext3 formatted usb stick for a couple years now, and have so problems copying files to and from, and still keeping file permissions intact. What program do you use to do the copying?
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: executable permission
« Reply #9 on: August 02, 2014, 10:32:10 am »

Quote
Proven on my machine. I transfer between two ext4 drives.

That is very strange because I have used a ext3 formatted usb stick for a couple years now, and have so problems copying files to and from, and still keeping file permissions intact. What program do you use to do the copying?
Err... cp

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: executable permission
« Reply #10 on: August 02, 2014, 12:36:50 pm »

Quote
Proven on my machine. I transfer between two ext4 drives.

That is very strange because I have used a ext3 formatted usb stick for a couple years now, and have so problems copying files to and from, and still keeping file permissions intact. What program do you use to do the copying?

Permissions or ownership?

Permissions should be ok with any suitable *nix capable filesystem. (though suid and other increased privileges might be skipped).

Ownership is a matter of keeping uid's and gid's in sync.

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: executable permission
« Reply #11 on: August 03, 2014, 01:54:18 am »
Permissions or ownership?
As I said, permissions wasn't a problem. I was referring to the standard RWX for World, Group and Owner.

Quote
Ownership is a matter of keeping uid's and gid's in sync.
Yes, I had to tweak my uid's between the two systems.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

TinyPortal © 2005-2018