Posted: Fri 03 May 2019, 04:33 Post subject:
A script to fix Directory Permissions
On puppy new directories are created typically as:
and folder read and execute permissions are given to typically user and group. This scheme won't work if either:
1. A user is not in group sport or;
2. The group permission of the folder is root.
So one can run into issues if a folder in either LD_LIBRARY_PATH, PATH or /etc doesn't have both read and execute permission for the folder. If for some reason this occurs (I had issues on TazPup64), here is a script to fix it:
#IFS=: read -r -d '' -a path_array < <(printf '%s:\0' "$MANPATH")
CONFIG_DIRS="/etc:" #For some reason we need a caracter to end the aray.
for path_list_name in LD_LIBRARY_PATH PATH CONFIG_DIRS; do
while IFS=\0 read -r -d '' a_path; do
if [ -d "$a_path" ] && \
[ "`stat -c '%U %G' $(_ $a_path)`" = "root root" ]; then
chmod 775 $a_path
done < <(echo "`eval $(_ echo '$'$path_list_name)`" | tr ':' '\0' )
I would have thought that you'd want to restrict spot more. Opening up all of those folders like that to spot also opens up potential setuid access and potentially as good as invalidates running internet apps/browser as spot. ???
The problem is if spot doesn't have exec premission to the etc folder then spot can't do commands like "whoami" because then spot can't read /etc/passwd.
An alternative would be to have spot use a different folder than /etc and either copy, hard-link (or maybe symlink?) what is needed. I'm not sure whether or not one would need to use the chroot command to do this or not.
If I knew the exact setup I would then I could create a second script to restrict the above folders and create alternative folders for non-root users.
I suppose if things were really broken I might want to do that but it was only the directory permissions that were broken for me. That said even if I needed to also fix the files, I probably wouldn't use chmod -R because I might not want to do the same thing for each file.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum