|
|||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
#1 |
|
Prospect
Join Date: Jan 2004
Posts: 8
|
Need to prevent deleting/renaming a folder, but still write to it
Hi all,
I'm in a bit of a bind here. We're trying to set up a system where a folder gets created, but you can't delete it or rename it from the Finder, but you can still use it like a normal folder. You drag files into it, we have a folder watcher that converts the file, sends it to a server, and deletes the files that were created in there when the job is done. The folder has to be deletable and renameable from the APP, not the Finder. No matter what I do, chmod/chgrp/chflags, I can't get the right combo. It's either too restrictive, or too loose. Any ideas? Thanks. Mike |
|
|
|
|
|
#2 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
You need to be a bit more clear about what you want since permissions will not distinguish between your "APP" and another app (e.g. the Finder) unless those apps are running under different user ids. |
|||||||||||||||||||||||
|
|
|
|
|
#3 |
|
Prospect
Join Date: Jan 2004
Posts: 8
|
Well, that's the problem. I'm sorta thinking out loud here.
Let me rephrase it. The app can create the folder, or select on that's already been created to be the folder that's watched. So long as the user has write access to it, we can use it. Users drag-and-drop files into this folder. The app watches the folder for changes, and converts the file(s) inside that folder when they're done copying. The converted file is sent to a server. The original and converted files are deleted. Now, we want to disallow users from renaming/deleting the folder from any app EXCEPT ours. I realize this probably can't be done without a daemon, but I'm hoping it can be. Mike |
|
|
|
|
|
#4 |
|
All Star
Join Date: Aug 2002
Posts: 579
|
You have to restrict write permissions to the containing folder, not the folder
itself. This will also prevent you from creating new folders, unfortunately. If the folder is 'junk' contained in 'abc', then chmod -w abc to prevent deleting junk. |
|
|
|
|
|
#5 |
|
Prospect
Join Date: Jan 2004
Posts: 8
|
That's what I thought. It seems that the 'w' flag which allows writing in the folder, also controls renaming/deleting it which kills the whole purpose of this.
The containing folder's not going to work since users could have "Documents" as their containing folder. Thanks. MIke |
|
|
|
|
|
#6 | |||||||||||||||||||||||
|
Site Admin
Join Date: Jan 2002
Location: Montreal
Posts: 32,473
|
No - as others have already said, it is the "w" of the parent folder (or containing folder) that controls whether the sub-folder can be renamed/deleted. The "w" of the sub-folder (the one created by your APP) is what allows creation/deletion of files in that sub-folder. But there is a chance that you might be able to do what you are trying to do (once you figure it out clearly) by using some of the flags that you can set via the command 'chflags'. Search and you will find an article on the main macosxhints site about this. Last edited by hayne; 04-29-2004 at 12:45 PM. |
|||||||||||||||||||||||
|
|
|
![]() |
|
|