-
Save as a file if you need further help to restore UNA permissions
set_permissions.sh
#!/bin/bash # Filename: set_permissions.sh # Move into the 'una' directory cd una || { echo "Directory 'una' not found!"; exit 1; } # Change the owner of all files and folders to 'www-data' sudo chown -R www-data:www-data . # Set permissions for all directories to 755: # 7 = read (4) + write (2) + execute (1) for the owner # 5 = read (4) + execute (1) for the group # 5 = read (4) + execute (1) for others sudo find ./ -type d -exec chmod 755 {} \; # Set permissions for all files to 644: # 6 = read (4) + write (2) for the owner # 4 = read (4) for the group # 4 = read (4) for others sudo find ./ -type f -exec chmod 644 {} \; # Give execute permission to ffmpeg.exe (since it's an executable) sudo chmod +x ./plugins/ffmpeg/ffmpeg.exe # Go back to the previous directory cd .. # Set this script's owner to 'root' and permissions to 755 # If you want, replace 'root' below with your SSH username sudo chown root:root set_permissions.sh sudo chmod +x set_permissions.sh # Display confirmation message echo "Permissions successfully set. Script permissions preserved."
How to use:
- Create the file:
vim set_permissions.sh
- Press
i
to enter Insert mode. - Paste the code from above.
- Save and close:
- Press
ESC
- Type
:wq
- Press
Enter
Final steps:
- Make the script executable:
sudo chmod +x set_permissions.sh
- Run it anytime to restore your file and folder permissions:
./set_permissions.sh
What this script does:
- Sets the correct ownership (
www-data:www-data
) and permissions for youruna/
project. - Makes sure
ffmpeg.exe
stays executable. - Preserves its own permissions as
root:root
with755
, so it’s always ready to use safely.
Directory Structure
your_project/ ├── set_permissions.sh ← This script is here └── una/ ← The UNA CMS directory
Happy coding!