LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-05-2013, 02:29 PM   #16
yrc
LQ Newbie
 
Registered: Mar 2013
Posts: 11

Original Poster
Rep: Reputation: Disabled
Smile


Quote:
Originally Posted by pingu View Post
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?
 
Old 03-05-2013, 02:59 PM   #17
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
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.
 
Old 03-05-2013, 03:24 PM   #18
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
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.
 
1 members found this post helpful.
Old 03-05-2013, 05:07 PM   #19
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
What eSelix said; the app should be doing this for you, or if desperate, try inotify as suggested.
 
Old 03-05-2013, 09:06 PM   #20
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by shivaa View Post
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...
 
Old 03-05-2013, 11:26 PM   #21
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,868
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
> do you understand my point?

No. The original rights of the files should be kept, instead of changing them to a constant value.
 
Old 03-06-2013, 06:24 AM   #22
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by yrc View Post
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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to set a group with default read & write permissions Blackninja Linux - General 3 06-16-2011 08:18 PM
Set default file/directory permissions replica88 Linux - Newbie 2 04-04-2010 10:12 AM
Set default permissions for new files and folders jmkelm08 Linux - General 1 09-11-2006 08:26 PM
File write permissions of 777 and 755 wissyweb Linux - Security 2 01-24-2006 08:12 AM
Where to set default file permissions (umask)? tredegar Linux - Newbie 14 01-27-2004 05:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration