Chattr

From WL-HDD Wiki

Jump to: navigation, search
WL-HDD Contents
What is the WL-HDD
Features
Pro's/con's
Reviews
Hacking
Inserting the HDD
Hacking Guides
Basic setup guides
Packages guides
Requests
Troubleshooting
This Wiki
Credits
Editing help
Contact Me

Contents

[edit] Prerequisites

To complete this guide, the following is assumed:

You are running Oleg's firmware (1.9.2.7-6b or later)
You have harddisk partitions up and running with an extended filesystem mounted to /opt
You have installed the Ipkg package system.
You have configured your partitions to automount.
You have setup and successfully ran VSFTP from within your LAN.
You have already completed the Samba with Users guide

[edit] Purpose

The purpose of this guide is to show how to protect single file from being deleted.

Consider following scenario: You are using Samba as well as VSFTP. Both methods of access uses same directory structure. You want to use the .message files to send messages to ftp users. And you don not want the .message files to be deleted by samba users. Samba user can delete any file if he has write permission for directory. even if the file does not belong to the user or group and user has not privilege to write into it. The way how to prevent deletion of such file if us chattr.

[edit] Installation

In puty type

ipkg install e2fsprogs

Now you can use chattr and lsattr utilities.

[edit] Usage

To make file non-deletable just set its immutable attribute

chattr +i .message

Now the file is not deletable unless you use -i on it.

[edit] Behavior

  • Folder that contain non-deletable file cannot be deleted.
  • My Windows Vista looks quite puzzled by such non-deletable file. When I delete it from Windows Explorer it disappears and when I reload the folder it appears again.
  • Total Commander (7RC) is also a little puzzled. It doesn't delete such file but it throws no error.

[edit] See also

chattr at Wikipedia

chmod at Wikipedia

ls at Wikipedia

Personal tools