LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Better, safer way to mount remote resources? (https://www.linuxquestions.org/questions/linux-networking-3/better-safer-way-to-mount-remote-resources-612330/)

SlowCoder 01-09-2008 08:11 AM

Better, safer way to mount remote resources?
 
Say you have a Linux client with directories mounted to shared resources on a file server. These files need to be writable, so the mount read only option is not viable.

A user enters the old, trusty rm -rf / on the Linux client, and poof! All your data on the client and the mounted resources on the server are now gone!

In Windows, this is not quite as easy a task to do, because the shared resources would be accessible through either a shortcut or a separate mapped drive. So, if the shortcut was deleted, the data would remain, and a specific command to each separate drive would be required to perform the delete on each resource.

So, what are the options available in Linux to make sure a simple rm command doesn't kill your stuff?

harry edwards 01-10-2008 05:15 PM

A few ideas:

Alias rm, for example

Code:

alias rm="rm -i"
The -i switch prompts the user for confirmation.

Another method is to revoke execute on rm i,e,

Code:

chmod o-x /bin/rm

osor 01-10-2008 07:09 PM

If you want to have the same loophole used by Windows “shortcuts”, you might shadow your directory with symbolic links (à la lndir). So the same way that if Windows “shortcuts” are deleted, the real files remain unharmed, the symbolic links would be deleted and the real files would remain unharmed. Unlike Windows shortcuts, with symbolic links, your program doesn’t have to know that it’s dealing with a symbolic link, so other things like reading and writing would work fine (and you still have the ability to damage the files by careless writing).


All times are GMT -5. The time now is 10:33 PM.