How to View Detailed permissions for Stash directory
目的
Stash can encounter errors if the System User that runs the Stash service doesn't have sufficient permissions over the Stash Home and Stash Installation directories. This can occur for example if Stash is started as root resulting in certain files being created that the Stash system user will not have permission over.
This is a known issue which is described here - SpringMVC dispatcher could not be started
ソリューション
In linux based systems we can check these permissions by using the tree
command with some extra options added at the root of the Stash Home Directory and the Stash Installation Directory (where Stash was installed and started from);
tree -pufg
This command will give a detailed output of the directory structure and its permissions - specifically the full output of the directory in a tree like structure listing the owning user, group and the permissions specific to the directory/file.
The output will look similar to the below;
We can either print this output to a file and then search for entries with the root
user or other users that shouldn't have the privileges.
Preferably we can also pipe in the grep command to search for the user as below;
tree -pufg | grep "root "
This will return all results that have root followed by a space. We add the space to ensure we don't pick up any unwanted files that may be named root.
Once you have identified that an unwanted user has permissions to a file or directory we can recursively change the owner of the whole directory by running;
chown -R atlstash:atlstash *
Ensure you are at the root of the Stash Home Directory and the Stash Installation Directory when you run this command as it will change the change the owner of everything recursively