Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

URGENT Permissions issue

URGENT Permissions issue

URGENT Permissions issue

We have a java script that generates files in a folder on our Linux server that need to be picked up by a process on another server but the files are being written with RW only permissions and we need them written with RW-R--R--

The folder is setup to default to the RW-R--R-- permissions when new files are created but somehow the Java app is setting it differently.

Until I can figure this out can someone show me how to setup a simple script to periodically execute the command CHMOD 644 /ops/acct/*.JRF?
Every 10 - 20 minutes should be sufficient but my Linux skills are still fairly basic.

This is an automated process that needs to occur relatively quickly but we cannot sit and monitor the folder all night long to keep modifying the files.

Any help would be appreciated.

At my age I still learn something new every day, but I forget two others.

RE: URGENT Permissions issue

crontab -e (sudo if not root)

cron table entry

/10 * * * * [command line goes here]

use tab to separate the parameters.



Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.

RE: URGENT Permissions issue

Thanks Chris.

I had managed an overnight work around by setting my putty session to keep-alive and using the following code to keep changing the file permissions on those files.
watch -n 30 chmod -f 644 "*.JRF" || true

I had to force the return code true otherwise when the other server picked up the existing files and there were none left in the folder the chmod command would throw an error and cause the watch command to stop working.
Now I have to figure out why these files are not generating with the correct permissions from the java app.


At my age I still learn something new every day, but I forget two others.

RE: URGENT Permissions issue

Go to the .profile or .bashrc file for the userid that the Java process runs in and put the following command in it. Or, if the java process is started with a shell script, put it somewhere before the "java" command in the script.


uname 0 

This will cause any files the process creates to be created with wr-wr-wr- file permissions.

Whatever you do, don't set up a cron job to chmod it. That's addressing the symptom, not the cause.

RE: URGENT Permissions issue

you must've thought of
umask 0
I would propose:
umask 002

RE: URGENT Permissions issue

Yeah, it depends on how open he wants to be with the files. I assumed once he had the correct command he would investigate what the value meant and adjust it to his needs.

RE: URGENT Permissions issue

Thanks guys.
I never did find out where the permission was being set in the app but did add the umask 022 to the beginning of the shell script that runs the java app and that cleared up the problem.
This is probably a better method anyway.

There are a few issues with file permissions that will need to be cleared up but there have been a number of changes in the way permissions all over the server are handled so it will take some testing to ensure everything remains working.

At my age I still learn something new every day, but I forget two others.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close