In this post, I will show case a winform application that I have just finished building which will tell you the correct command when given the required permissions. For example, a read permission is identified as a 4 in Unix environments.
I have created a small table below:
Permission Level | Permission Bit |
Read | 4 |
Write | 2 |
Execute | 1 |
Since you need to define permissions for: the owner; owner group and others, you need to supply 3 permission bits per command. Plus one more for special permissions at the beginning but we can ignore that for now.
So if we wanted to give the below permissions:
Special – ignore
Owner – read (4), write(2) and execute(1)
Owner group – read(4) and write(2)
Other – read(4)
we would use the following command: chmod 0764 <path-to-file>
Now we can get on with the actual winform… I created this to tell me what permissions I needed to assigned. Below is a screenshot of the winform:
This also keeps a short history of the permissions in the history textbox which is flushed after so long to stop the textbox from overflowing. Here is a download for the project, in the zip folder is both a ps1 file and an exe file. Enjoy!