The sticky bit in VIB files

If a VIB file has the sticky (01000) bit set, then adjustments to the file will be monitored. Without the bit being set, a file will not be editable. This mechanism is used by the /sbin/auto-backup.sh script

eg:

~ # ls -al /custom
drwxr-xr-x    1 root     root                512 Jun  1 15:53 .
drwxr-xr-x    1 root     root                512 Jun  1 15:56 ..
-r--r--r--    1 root     root                 14 Jun  1 14:30 myfile
~ # echo "#Extra Line" >> /custom/myfile
-sh: cannot create /custom/myfile: Operation not permitted
~ # chmod 1444 /custom/myfile ~ # ls -al /custom
drwxr-xr-x    1 root     root                512 Jun  1 15:53 .
drwxr-xr-x    1 root     root                512 Jun  1 15:56 ..
-r--r--r-T    1 root     root                 14 Jun  1 14:30 myfile
~ # echo "#Extra Line" >> /custom/myfile
~ # ls -al /custom 
drwxr-xr-x    1 root     root                512 Jun  1 15:57 .
-r--r--r-T    1 root     root                 14 Jun  1 14:30 .#myfile
drwxr-xr-x    1 root     root                512 Jun  1 15:56 ..
-r--r--r-T    1 root     root                 26 Jun  1 15:57 myfile

Notice the .# file. This contains the original contents of the file.

NB, chmod +t could also have been used.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: