Listen to File Permission Change
I want to listen to any change in permissions (specifically whether a file is read only or not) of certain text files from within my program. How do I do it?
Basically, I want to get notifications when an relevant file's read-only attribute toggles. This is to implement a feature where editing of a document is disabled if the document is read-only. The editor should detect the change in this property and allow editing when appropriate. This feature is implemented in several Java IDEs like Eclipse, IntelliJ etc.
Please provide sample code.
Thanks,
Krishna
This isn't directly possible in a pure Java implementation.
However, you can implement it quite easily yourself......
Have a Timer task (or similar) that you schedule to run at whatever frequency is suitable for your use, and have it inspect the files that you have registered interest in (check out the File 'canRead' and 'canWrite' methods).
Its then quite easy to set up a notification based system:
* Something capable of monitoring files for changes to their permissions and of notifying
* registered listeners
public interface FilePermissionsMonitor {
void addPermissionsChangeListener(PermissionsChangeListener p, File target);
void removePermissionsChangeListener(PermissionsChangeListener p);
void removeListenersFor(File target);
public interace PermissionsChangeListener {
// could make this more swanky by introducing a PermissionsChangeEvent 'describing' the change.
// e.g, it could provide the 'last known' previous permissions in addition to the target file.
// For brevity, we'll just provide the target File here....
void permissionsChanged(File target);
* A FilePermissionsMonitor which uses a timer to periodically check for changes in permissions
public class PeriodicMonitor implements FilePermissionsMonitor {
Implement this as described at the top of this post. I.e, schedule a TimerTask periodically
which checks the permissions of all Files for which listeners are registered (you'll need to keep hold
of the 'last known' permissions for each file you are interested in. Notify the relevant listeners when
you find a change in permissions
}
Similar Messages
-
/dev/null file permission changes frequently
Hi,
We are experiencing file permission change issue frequently for the
following files:
root@domain5 # ls -l /devices/pseudo/mm@0:null
crw-rw-rw- 1 root sys 13, 2 Apr 22 2009
/devices/pseudo/mm@0:null
root@domain5 # ls -l /dev/null
crw-rw-rw- 1 root sys 13, 2 Oct 25 07:01 /dev/null
By default, above is the file permission settings. If the file permission
changes, it will look like as below:
root@domain5 # ls -l /devices/pseudo/mm@0:null
cr--r--r-- 1 root sys 13, 2 Apr 22 2009
/devices/pseudo/mm@0:null
root@domain5 # ls -l /dev/null
cr--r--r-- 1 root sys 13, 2 Oct 25 07:01 /dev/null
Due to this file permission change the script which uses this file loose
the write permission and the script fails. To fix this issue, we will be
manually changing the permission. Can you please help me to know the cause for
this file permission change.
Thanks,
Ram.You need to correlate any changes on the system to when you have the problem, or see the date on /dev/null change. Software packages can change this, applications can change this, sometimes even patch installs.
Even certain administrative practices.
Here's one example, where touching a vendor software-created printer config with native Solaris admintool would change /dev/null permissions
http://www.rootunix.org/SOLARIS/printFAQ.txt
10) ONLY ROOT CAN SEND PRINT JOBS:
This problem is caused by network spooling software that for a
network printer that uses /dev/null for the printer device. The
software monitors the queue and spools the print requests over the
network to the printer. If the printer setup is modified in any
way with Admintool, the printer device (/dev/null) permissions will
change to 600 owner lp. -
Can you please advice on RAW device file permission change to crw-r-----
Currently we have Oracle9i (9.2.0.5) RAC on IBM AIX 5.2 system with 2 node cluster.
We use the RAW device for Oracle data file default file permission for raw device is crw-rw---- can we change to crw-r-----(remove write permission from group).
Can you please advice.
Thanks & RegardsHi,
What is your intention behind this? If protection, there can ve other ways possible.
Regards,
Ankit -
Monitoring file permission changes [ solved, kind of]
I have a configuration file on my server for a program that runs on Windows desktops. For some reason, the permissions on that file keep getting changed, and it isn't being done manually by anyone. I'm not sure why this is happening, and it seems to happen at random intervals.
Is there a way to monitor when the permissions on this file get changed?
Last edited by timm (2009-04-03 19:47:00)http://fileschanged.sourceforge.net/
fileschanged is a GNU/Linux command-line utility that reports when files have been altered.
You'll need either fam or gamin installed to use this. I was gonna write a similar program myself. It'll most likely be better than having an infinitely look in a script or having crontab calling a script every second. -
Monitoring File Permission Changes with dTrace?
Hi,
We have a file whose permissions are getting changed occasionally, and we're trying to determine which process is changing them.
Can someone describe how to do this with dTrace?
Thanks in advance!
-Rocky
Edited by: umuc-rocky on Mar 31, 2009 10:50 AMTry this clause for starters:
syscall::chmod:entry
printf("Calling program: %s\n", execname);
printf("Target file: %s\n", fds[arg0].fi_name);
} -
Kernel Panic from system file permission changes
A friend and i were trying to share some image files with each-other so we firewire connected our two macs... (both mac book pros mine a intel core on snow-leopard hers the latest is7 operating system -prob Lion) when the corresponding computer did not appear on our desktops I entered "sharing" console on my system prefs and attempted to allow her computer to see and read/write mine... I got a pop up prompt asking if i wished to share all my internal files and I said "yes" Shortly thereafter a repeat prompt kept popping up on my computer saying something like ~"can't share system files" I pressed "ok" each time it appeared and after a few pop ups it all seemed ok...
By now as a backup attempt to share my files i had plugged in my external (open permissions) hard-drive which at this point suddenly told me i am not allowed to read or write on it... I ejected it and since the whole system was still spinning and wanting to share permissions I force-quit the finder and selected "shut down" my system to start fresh but when attempting to restart finder I first a few moments later I got that - multilingual kernel panic prompt
it won't start up - it won't boot from disc (at start i hold down option and insert operating disc) it wont start up (I've depressed shift after start and arrived at a spinning wheel that never ends... i'm also out of my warranty and hoping to solve this without paying for a new macUnfortunately, the log files are full of scary-sounding messages. Unless you have some specific problem other than the logs, there is usually no need to worry about it. Sometimes, a problem may be reflected in the logs, but you can't start with the logs. You'll never finish.
-
I would like some help regarding permissions. In our office, each employee uses their own iMac and we are on a small Ethernet network. There are four iMacs and each is running Snow Leopard. I have configured it so that each iMac is sharing its desktop. In our office workflow, my co-workers and I intuitively share files by dropping them onto each other's desktops.No need to hunt in our drop boxes which are buried a few levels.
ISSUE: When I put a file onto a co-worker's desktop, the file permission changes to 'nobody'. If they continue to work on the file and try to save it, they can't. So in order to continue working on a file they have to 'Get Info' first and change the permissions to 'Read & Write' for themselves. However, if I ask my co-worker to get the file from my desktop, the file's permissions are fine and they can open, modified, and save the file without a problem.
QUESTION: Is there a way to configure our settings so that files can be put onto the desktop's of other co-workers without having to mess with the permissions each time? Why does it work one way (get) but not the other way (put)?You don't have permissions to modify an item you do not own. When you copy a file to another account, it keeps your ownership and permissions, which means only you can write to it. When another user copies your files, they own the copies, which lets them write to it (you might not have noticed, but you won't have permission to write to their copies, either).
You can use ACL (Access Control List) entries to give additional permissions - each user's Drop Box folder is also set up this way. -
Change the file permission of listener log (log.xml) 11gR2
Hi
Is there a way to change the file permission of the listerner log (log.xml)? everytime the a new log.xml is created the file permission is 640.. i want it to be 644. Is there ay configurations that needs to be done?
DB version is 11gR2.
Thankspeacock wrote:
Hi
Is there a way to change the file permission of the listerner log (log.xml)? everytime the a new log.xml is created the file permission is 640.. i want it to be 644. Is there ay configurations that needs to be done?
DB version is 11gR2.
Thanks
umask [-p] [-S] [mode]
The user file-creation mask is set to mode. If mode begins with a digit, it is interpreted as an octal
number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by chmod(1). If
mode is omitted, the current value of the mask is printed. The -S option causes the mask to be printed
in symbolic form; the default output is an octal number. If the -p option is supplied, and mode is omit-
ted, the output is in a form that may be reused as input. The return status is 0 if the mode was suc-
cessfully changed or if no mode argument was supplied, and false otherwise. -
Workflow to change file permission in SharePoint Online Document Library
1.What are my options with SPD 2013 If I want to change a documents file permission in a workflow?
2.Where does SPO host 2013 Workfows?
3.If connecting to SPO Can I use Worklow Manager 1.0?
4.Will I need to host my Workflow Manager workflows on server or Azure if running against o365/SPO?
5.If I wish to create SPO 2013 workflows with Visual Studio 2012, what do I need and will I be limited to actions I see in SPD 2013?
============================
Thank You
cyberpine.comYou can host this workflow as a SharePoint App in SharePoint Online or use SharePoint Designer to create this workflow as long as you use the app step. Managing the permissions can be done with a REST call. The initiator of the workflow must have
been granted the right to "Manage Permissions" and the app must have full control of the Site Collection. We have done so for several of our clients. I know you asked this question some time ago, but I thought the info might still be helpful. -
Whenever I close down Photoshop CS5 I get the message: "Could not save Preferences because the file is locked or you do not have the necessary access privileges. Use the get info command in Finder to unlock the file or change permission on the file or enclosing folders." What on earth does it mean? How can I stop this message from appearing?
See here:
I cannot save recent images. -
Changing oracle file permission with ftp / sql
Hi, i have a question:
I've configure webdav to browse my /i folder.
I can use as well filezilla, connecting with hostname / uname: system / pass / myoraclesystem pass.
Is there a way to change file permission attributes with ftp?
Thank youHi,
Check out ORDSYS.ORDImage type from Oracle Intermedia, and especially its "process" method.
It possesses various commands to change image properties.
HTH. -
Listener name in the listener.ora file is getting change from GPROD to %s_
Dear Experts,
Please note that after doing the R12.1 upgrade, When i bounce the database i have noted that my database listener name in the listener.ora file is getting change from GPROD to %s_db_listener%. Again every time after changeing the listener log file i am able to start the listener.
Please advise.
[oracle@upgrade 11.2.2]$ lsnrctl start GPROD
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 07-OCT-2011 10:07:33
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /u04/d01/tech_st/11.2.2/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u04/d01/tech_st/11.2.2/network/admin/GPROD_upgrade/listener.ora
Log messages written to /u04/d01/tech_st/11.2.2/log/diag/tnslsnr/upgrade/gprod/alert/log.xml
TNS-01151: Missing listener name, GPROD, in LISTENER.ORA
Listener failed to start. See the error message(s) above...
[oracle@upgrade 11.2.2]$ vi /u04/d01/tech_st/11.2.2/log/diag/tnslsnr/upgrade/gprod/alert/log.xml
[oracle@upgrade 11.2.2]$ cd network/admin/GPROD_upgrade/
[oracle@upgrade GPROD_upgrade]$ ls
listener_ifile.ora listener.ora listener.ora_bkpaug2911 sqlnet_ifile.ora sqlnet.ora tnsnames.ora
[oracle@upgrade GPROD_upgrade]$ vi listener.ora
(SID_DESC =
(ORACLE_HOME= /u04/d01/tech_st/11.2.2)
(SID_NAME = GPROD)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u04/d01/tech_st/11.2.2)
(PROGRAM = extproc)
STARTUP_WAIT_TIME_%s_db_listener% = 0
CONNECT_TIMEOUT_%s_db_listener% = 10
TRACE_LEVEL_%s_db_listener% = OFF
LOG_DIRECTORY_%s_db_listener% = /u04/d01/tech_st/11.2.2/network/admin
LOG_FILE_%s_db_listener% = %s_db_listener%
TRACE_DIRECTORY_%s_db_listener% = /u04/d01/tech_st/11.2.2/network/admin
TRACE_FILE_%s_db_listener% = %s_db_listener%
ADMIN_RESTRICTIONS_%s_db_listener% = OFF
IFILE=/u04/d01/tech_st/11.2.2/network/admin/GPROD_upgrade/listener_ifile.oraStep 1- Run the autoconfig on the db tier.
Step -2 Automatically it is changing the setting in the database listener log file and it is showing 4 database listeners are up .
[oracle@upgrade 11.2.2]$ ps -ef |grep inh
oracle 756 1 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 757 756 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 758 757 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 759 757 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 1721 31038 0 11:02 pts/2 00:00:00 grep inh
applmgr 31380 1 0 10:53 ? 00:00:00 /u04/d02/apps/tech_st/10.1.2/bin/tnslsnr APPS_GPROD -inherit
Step - 3
Again down the apps tier services.
Step -4
Reset the listener.ora file in the database tier
Please advise.
Regards
Mohammed. -
How to use FilePermission class to change the file permission in Linux
Hi all,
I'm running in a issue related to changing the file permission under Linux environment. I'm using Suse 10.0 Linux and run jdk 1.5 java runtime.
I want to create a file during execution time and change the permission of the same. I use File.createNewFile() API to create file. By default it does not have all the 3 permission (read,write,execute) for all the user ( user,owner,group). Through program I have to change the file permission ( equal to execute ,chmod 777 filename).I donot want to use runtime.exec() with chmod as the argument , since it creates a process to change the permission which may impact the performance. I want to try FilePermission class , by giving filename and permission as the argument. But it is not changing the permission . Could any one faced this problem ?
If any body guides me, how to change the permission of the file under Linux using FilePermission class , it would be helpful.
Thanks,
SankarHow do I set the Umask prior to starting the program
? Could pls explain in steps.I don't think umask can help you. The mode mask prevents permission bits from being set when a file is created, but does not force any bits to be set. So if execute permission is not set explicitly when a file is created, umask will do nothing about it.
But if you want more information about umask, see the man page for your shell script (sh, csh, etc.) or "man 2 umask". -
Hi everybody excuse my english, i'm form french.
I'm here because I can not install my mobile modem 3G driver (.pkg). When I try to install I have this message *Setup can not open the package. It is likely that the executable file for applications installation has no property rights and / or authorizations.* and after crash and give me exception error *KERNPROTECTIONFAILURE at 0x0000000000000027*.
Thanks for your helpNobody can help me?? I think my installer.app is corrupted due to permission change and I tried all disk authorization repair but nothing to do. There are no apple responsable support in this forum??
thanks -
Changing Folder & File Permission via Java Program
Please help me with some Java Code on how to change Folder & File Permission on CM
Hi Christopher,
Perhaps this
Repository Service auto change resource permissions
thread might help you.
Regards,
Patrick.
Maybe you are looking for
-
Java.lang.UnsupportedOperationException coming out of ant jwsc task
Hello! I'm trying to stand up a simple example web service so that I can 'instrument' it with a QOS monitoring application. (The goal here is to learn to use the monitoring app.) I'm pretty sure that I've got a usable piece of code for a web service;
-
Hello, I am working on the an Integration that uses a DB adapter for polling a table. BPEL process is working as expected. We have some requirements to stop the table polling during some time frames in month. Is there a way to program it to stop duri
-
if(message.startsWith("!setevent ")){ String event; event = String.format(message.substring(10)); sendMessage(channel, "Event set to: "+ event +"!"); if(message.startsWith("!event")){ sendMessage(sender, event); It is for an IRC bot, and i am UBERCON
-
In Firefox 8 on Mac OS 10.7.2, the file menu doesn't list "Import"
I just installed Firefox 8 on my Mac that is running OS 10.7.2. When I went to the File menu to import my bookmarks from Safari, the "Import" option was not there.
-
I"m operating OS X 10.8.5, Mail 6.6 and have discovered I can not extract jpgs from within an email thread. If I catch it upon arrival, everything's fine, but if I reply and continue the thread, the file is no longer extractable. Any advice? Thank