There are two reasons you want to find weak file permissions on a drive shared with other users:
- You want to protect your files from other users.
- You want to prank other users by modifying their files
Find the files
find command is the start. With this command, you can search every file and select or eliminate files you do not want.
- The option
-permis how you will find the permissions you want.
- The option
-notwill negate the results, which can be useful if you modify the script.
- u = user
- g = group
- a = everyone
- r = readable
- w = writeable
- x = executable
-perm mode= exact permission bits
-perm -mode= all permission bits
-perm +mode= any permission bits #1
-perm /mode= any permission bits #2
The mode is a combination of the Permission Groups and File Permissions. Normally written in octal format, using letters is easier to understand.
- Find files readable for everyone
find /path -perm /a+r
- Find files writable for everyone
find /path -perm /a+w
- Find files writable and readable for everyone
find /path -perm /a+r -perm /a+w
find /path -perm -600
You should not care about files that are executablle.
Pranks to Play
The best pranks that do not harm another user is to change their
.alias file will change some of their common commands just slightly. For example, adding this to
.alias will really confuse them when they run their ls command.
alias ls='echo "Learn Permissions"; ls'
.bashrc file will run each time they open their terminal. This one will likely stick around longer because they will see it only once a day. Here is something you can add to
echo "Learn Permissions";