Skip to content

Instantly share code, notes, and snippets.

@davidsth
Created February 9, 2013 03:56
Show Gist options
  • Save davidsth/4743765 to your computer and use it in GitHub Desktop.
Save davidsth/4743765 to your computer and use it in GitHub Desktop.
File locker
#!/bin/bash
# Use this to hide your folders
# Don't forget to chown : root and chmod : 700 this file
# How to use:
# filelock [option] filename
# option: lock or unlock
# Note: when you lock the file, it will be hidden and won't be readable.
if [ $1 = "lock" ]; then
echo "hiding $2 and locking..."
chmod -rx $2 && mv $2 .$2
echo "Done Locking."
elif [ $1 = "unlock" ]; then
echo "unlocking $2 ..."
mv $2 ${2//./} && chmod +rx ${2//./}
echo "Done."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment