Prevent a folder from being deleted?

Discussion in 'Apple' started by Timur Tabi, Aug 28, 2006.

  1. Timur Tabi

    Timur Tabi Guest

    My mother is a new Mac user, and as expected, there were some growing
    pains. One of the things she did was to delete the Documents folder.
    Specifically, she

    1) deleted the folder (so it ended up in the Trash). She has no idea
    exactly how it happened, though.
    2) realized her mistake, so she dragged the folder back to the Desktop.
    3) some time later, her Mac recreated her Documents folder in her Home

    At this point, things really got screwed up. I had to ssh into her
    computer in order to fix it.

    So my question is: is there a way to prevent a folder from being
    deleted and have it otherwise useable? She'll still need to be able to
    create and delete files and other folders inside the Documents folder.
    Timur Tabi, Aug 28, 2006
    1. Advertisements

  2. Timur Tabi

    Hans Aberg Guest

    I think /Users/Shared/ behaves like that if one does not have admin permissions.

    But you should probably setup a backup system; while waiting for Mac OS
    X.5, for example using 'rsync' automated via 'crontab'.
    Hans Aberg, Aug 28, 2006
    1. Advertisements

  3. If you open the "Get Info" window, there is a checkbox called "Locked".
    Select this and you can't delete the folder anymore.

    Jochem Huhmann, Aug 28, 2006
  4. If you open the "Get Info" window, there is a checkbox called
    "Locked". Select this and you can't delete the folder anymore.[/QUOTE]

    Nor will you be able to create or delete files or other folders inside
    Michelle Steiner, Aug 28, 2006
  5. OSX has a feature called "access control lists" (ACLs), which are a
    more advanced way of controlling permissions on files and directories
    than is available in traditional Unix.

    First you need to enable ACLs on the root volume:
    $ sudo fsaclctl -p / -e
    then you can set fine-grained ACLs for the files/folders in question:
    $ chmod +a "mom deny delete" ~mom/Documents

    You can use the -e option to the ls command to see the ACLs.
    See the man page (eg. for chmod) for more information.
    Christopher C. Stacy, Aug 28, 2006
  6. Sorry, never actually tried that. Hmm. Doesn't work, then ;-)

    Jochem Huhmann, Aug 28, 2006
  7. Timur Tabi

    Jamespmanley Guest

    Select the folder, get info on the folder & lock it.

    James Paul Manley
    Prostate Cancer Patient
    Albuquerque, New Mexico 87121

    I have advanced prostate Cancer with a Gleason rating of 9
    and I am convinced that the Lord Jesus Christ will heal me as
    a testimony to his love.

    Jim Manley's Photoshop Elements Page

    Jim Manley's Photo Retouching Page
    Jamespmanley, Aug 29, 2006
  8. Timur Tabi

    Jon Guest

    Please learn to
    - Quote (leave only the text you are actually replying to from the
    previous post)
    - Not top-post (i.e., post your reply below the text you are quoting,
    not above)
    - Format your signature properly, i.e., with two hyphens and a space on
    a separate line (like mine below) to separate it from text, and
    - Not to use a signature of more than five lines, preferably less.

    _Especially_ when answering with one or two words, a fifteen line
    "signature" like yours is downright offensive.

    Please note that I'm not even mentioning its contents! In a _properly_
    formatted signature that is not too big, you may say anything you like,
    as far as I am concerned.
    Jon, Aug 29, 2006
  9. If the first three things are done, I for one don't care how long or
    what the content of stuff that comes after the sig delimiter. That's
    pretty much left over from 4800 baud days, no?

    I'd settle for trimming and bottom posting, even.
    John McWilliams, Aug 29, 2006
  10. Sorry, never actually tried that. Hmm. Doesn't work, then ;-)[/QUOTE]

    Michelle Steiner, Aug 29, 2006
  11. Timur Tabi

    Király Guest

    Here's how to do it. Log in as an an administrator, launch Terminal, and
    enter the following:

    sudo chmod 1775 /Users/mom
    sudo chown root:mom /Users/mom
    sudo chmod 770 /Users/mom/Documents
    sudo chown root:mom /Users/mom/Documents

    Now your mom can add and delete stuff inside ~/Documents at will, but
    will be prompted to enter and administrator's username and password if
    she tries to delete the folder itself.


    Lang may your lum reek.
    Király, Aug 29, 2006
  12. Timur Tabi

    Király Guest

    Forgot to add: Relaunch Finder after entering all of those.
    Király, Aug 29, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.