How would I lock a folder.

qwikstreet

OS X Friendly
Eventhough I am logged into my user name (main admin account) can I still lock a folder under neath my Home directory?
 
You can do it via the "terminal.app".

sudo chmod 000 "directory"

You can do the reverse also.

sudo chmod 755 "directory"
 
So if I'm logged in and walk away. Someone can't come and open that folder without typing my login password?
 
You won't even be able to open it up at all. It will never prompt you for a password. It will give you an error stating that you don't have sufficent privs.

Once you change them back the folder will then be accessible.

Am I mistaken in thinking that once you set privs to 000 you wouldn't be able to set them back to original?
 
If it's a folder that you want to use very often then you can also use an encrypted disk image. Whenever you want to use it you just double-click the image and it asks for your password. Then you can read to and write from that 'folder' (it shows up as a drive on your desktop) until you right-click on it and choose eject. If your computer goes to sleep it will ask for your password again when it wakes up for you to continue using the drive. It also ejects when you log out or reboot. It's a very safe way to store stuff you don't want people to see.
 
Originally posted by Rhino_G3
Am I mistaken in thinking that once you set privs to 000 you wouldn't be able to set them back to original?

No, you can do what hypocampers said to reverse it. Maybe you are thinking of setting the system immutable flag. If you do this to a file or directory:

sudo chmod 000 "directory"
sudo chflags schg "directory"

Then you won't be able to change it back, delete it, view it, or anything unless you reboot your computer into single user mode and fix the flags and permissions. (For single user mode: hold down cmd+s while booting) There are also ways of preventing people from booting into single user mode, if it's something you really need to protect.
 
Back
Top