A script for linux to change user permission

I got fed up with always going through IDEAs directory structure and changing the user permissions every time IntelliJ issued a new build release so I created a script to do this.

What the script does is go through the directory of a newly installed IDEA and:
1) Removes any permission for the other group (chmod o-rwx)
2) Changes ownership of all files and folders in the installation directory to the specified group (the name of the group is supplied as a parameter to the script).
3) Copies the permission that the owner of the files (user) has to the group (chmod g+u) recursively.
4) Removes a file called 'current' from the working directory.
5) Creates a symlink that's called 'current' in the working directory that points to the installation directory.

The usage of the script is:


I hope this script will benefit someone else besides me and you guys at IntelliJ are welcome to use the underlying idea in your Linux installer (I think it's lacking such a thing, where a group can be specified that should be allowed to run the tool).

Just to give you an idea of how this script works for me: I have a directory where I install Aurora builds.

 build804
]]>


When I install a new build, it goes into a folder called buildXXX where XXX is the build number. Let's say that build 805 just came out. Then I install build 805 to /intellij/build805, run the script on that folder by issuing: "./idea_prep.sh build805 dev". This will change the permissions for build805 and generate a new 'current' link that points to the new installation.

Kind regards,
Stefan Freyr.



Attachment(s):
idea_prep.sh
2 comments

I didn't get a chance to not that the GROUP that is specified is a user group that will be able to use the IDEA installation. For example, I have a group called 'dev' that all users are in that will need to use development tools.

0

Please note that this script does tamper with user permission of your files. While it does not do anything that could result in catastrophic failure of your system, you must accept any and all responsibility for using it.

0

Please sign in to leave a comment.