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!
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
Better set umask to 011 or 001, so you will get permission of 655 (i.e. rw-r-xr-x) or 665 (i.e. rw-rw-r-x). In that case file will be executable for all.
No - by default files are never executable. And if you prevent created directories from searched (the x), then the user will not be able to use the directory...
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).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.