Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Aha, I see the situation now!
Now this depends a bit on exactly how the files are copied or moved, also I believe it matters to & from what media.
Like for instance if the application runs a simple bash script, then you could modify that script to keep permissions.
So, what app, from where, to where?
its a java code installed with a particular user say "yrc" and that copies files from a folder to a mount point on the same box.
my question is...is there a option? other than manually changing the files to be executable? is there a cmd like umask that can set the permissions to 750?
umask can not be used here I'm sure, I believe you'll need Java expertise for this which I'm not.
If you copy a file using terminal/bash, then the permissions are kept. Obviously using java they are not - or at least not with your java-app.
Hopefully some java-pro can assist you here, if not I'll think of something tomorrow - I'm going to bed soon, it's night here in my part of the world.
There is no difference which programming language you use, the application which create file is responsible for giving it proper permissions. If you wrote this Java program by self, then use appropriate call for this (for example use FileAttribute in createFile() or setPosixFilePermissions() after creating). If you have no access to source, then you can't set permissions that way you want. Well, you can do some dirty tricks, for example using "inotify" and changing permissions in your own script.
ok - here my situation..
we have a application that moves files from source to destination.
after moving to destination the files are getting "rw-rw---"
in order to use the files in the destination it should have executable for user and group(i.e rwxr-x---)
do you understand my point?
Now it depends on what you are moving them from and where they are going.
Only Windows filesystems have the execute bit set by default. Copying them depends on how that filesystem is mounted - by default the execute bit would only be set by default via mode= option in the mount.
NTFS-3g supports UNIX permissions (it is translated into an ACL supported by ntfs-3g), but when a file is created, its modes are never given the execute permission (a major security failure by default). Binary programs appear to be created with the execute bit, but actually they aren't. The linker creates them without the execute bit, then sets the flag after it is created. No other program does that by default.
Copying files that are already marked executable is preserved. It doesn't change unless the the target filesystem is mounted with a "mode=" option (if available) that blocks it, OR it is mounted "noexec" (which disables the execute permission for binaries).