protect my file!
February 12, 2008 8:58 PM   Subscribe

I would like to save an Excel spreadsheet onto the desktop of a computer for people to look at, but not to modify. I know how to protect the sheet to make it read-only or to require a password to modify it, but is there any way for me to prevent people from deleting it all together? I should add that the computer on which I want to have the file is running Mac OS X. Is there a way to make a file un-deletable? It is a public computer, so it must always be logged in under the same user name.
posted by foxinthesnow to Technology (12 answers total)
 
I'm not sure this would apply but I used DeepFreeze in the past on public computers. Everytime you re-boot the computer, it comes back to its original state; therefore your file could be erased, but would reappear next time your restart the computer.
posted by ddaavviidd at 9:09 PM on February 12, 2008


OS X is based on Unix, so you can declare the file to be owned by the administrator (or another account), viewable by everyone and editable only by the owner.

Another way to do it might be to put it on Google Docs and put up a link to the spreadsheet rather than the spreadsheet itself.
posted by aeschenkarnos at 9:22 PM on February 12, 2008


I'd've thought:

chmod -w /path/to/filename.xls

would make it read-only. Don't have a power-up mac handy to test with, sorry.
posted by pompomtom at 9:25 PM on February 12, 2008


Can you use "print to pdf" on the Excel document and then have that PDF be the file you have onto the desktop and have th doc owned by the administrator so it can't be modified.
posted by bottlebrushtree at 9:26 PM on February 12, 2008


This shouldn't be too hard. You want to create a guest account for the public viewing. Make sure this guest account can open Excel (the Application). Now, using an Administrator account on the computer (this will be by default the 'primary user' on the computer), create the Excel file you want, and put the file in the primary user's Public folder. Now when the guest user is logged in, he can see and open the Excel spreadsheet, but cannot modify it.
posted by onalark at 9:29 PM on February 12, 2008


The surefire way to make sure no unauthorized user will delete the file:

Lock the file in "Get Info" in the finder, then change the owner to someone that isn't the logged in user.

create two accounts on the machine, admin and "Local Guest" (or whatever, a non admin account) created in the System Preferences -> Accounts Pane.

The Local Guest will be the account you will leave the machine logged in as.

Login as Local Guest, copy the excel file to the desktop

Two ways to change the owner.

(easier in tiger to do via gui)
In the finder, select the file, go File -> Get Info (check the lock here)
There is a submenu labeled Permissions,
Under owner, select the Admin. When prompted, enter admin username / password.

In Leopard, you can't delete the creator of the file as the owner in the gui, but you can change it to Read Only, and click the + and add your admin user, and make it Read/Write

From the command line (still easier to lock via the gui)

open terminal

type "su admin" (without "") hit enter
type admin password
type "sudo -s"
type admin password again
cd Desktop
chown admin "excelfilename"
type "exit"
type "exit" (again)
Quit terminal.

You should now be unable to unlock the file, remove the lock, or move it from the desktop folder.

When you want to delete the file, just do the terminal steps again, but instead do chown "other user" excelfilname
posted by mrzarquon at 9:35 PM on February 12, 2008


Adding a new user to your OS X computer
posted by onalark at 9:35 PM on February 12, 2008


With the file locked, it will keep the users from moving the file to another folder (it will make copies) it will however still let you move it to the trash, in the finder anyway, and that is kind of a pain still.

Another option, if this machine is running leopard, is to copy the locked file to the default user template directory, and then enabling temporary guest user. If the file disappears or is modified, just log out the guest account and log back in, it will restore the guest account to whatever the template is.
the terminal command is (run as admin)

sudo cp excelfile /System/Library/User\ Template/English.lproj/Desktop/excelfile

Just remember to delete the file from the template in the future, or else all new users, not just the guest account, will be blessed with that file (why they don't let you create a seperate guest template folder i don't know).
posted by mrzarquon at 9:43 PM on February 12, 2008


I was wrong, pleae ignore me.
posted by pompomtom at 1:19 AM on February 13, 2008


In Unix and derivatives, if you want to protect a file against being deleted or moved, as opposed to overwritten, you need to change the permissions on the directory that contains the file to disallow changes to that directory. This is quite different from Windows, where you can actually prevent a file being deleted by playing with the permissions on that file itself.

So, as far as I know, if you're using Unix permissions to do the job you want to do (make your spreadsheet both unchangeable and non-removable) you will need to do what's been suggested above, not only for the file itself, but for the Desktop folder that contains it.

This would have the side effect of disallowing the user involved to make any changes to the Desktop, which may or may not be what you want.

You might want to try putting the file in some other directory that it's OK to make immutable, and set up a cron job that creates a hard link to the file inside the Desktop folder every minute. That way, if your users attempt to delete or move the spreadsheet, they'd simply end up deleting or moving the link, which would shortly reappear as if by magic.
posted by flabdablet at 5:02 AM on February 13, 2008


Create an alias file on the desktop and keep the original file elsewhere. Deleting the alias file will not delete the original.
posted by JJ86 at 5:36 AM on February 13, 2008


I second onalark's advice.
posted by adamrice at 6:48 AM on February 13, 2008


« Older Who said this?   |   God loves a terrier, but what's that thing he's... Newer »
This thread is closed to new comments.