Comment to 'UNA 15.0.0-A1 is now available. Anyone tried it yet ?'
  • f you need to set the correct permissions for UNA CMS, run this command:

    #!/bin/bash
    # Move into the 'una' directory
    cd una
    
    # Change the owner of all files and folders to 'www-data' (the default web server user)
    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 (because it’s an executable file)
    sudo chmod +x ./plugins/ffmpeg/ffmpeg.exe
    
    # Show confirmation message
    echo "Permissions successfully set."
    

    If that doesn’t work, try this more permissive version:

    #!/bin/bash
    # Move into the 'una' directory
    cd una
    
    # Change the owner of all files and folders to 'www-data'
    sudo chown -R www-data:www-data .
    
    # Set permissions for all directories to 775:
    # 7 = read (4) + write (2) + execute (1) for the owner
    # 7 = read (4) + write (2) + execute (1) for the group
    # 5 = read (4) + execute (1) for others
    sudo find . -type d -exec chmod 775 {} \;
    
    # 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
    sudo chmod +x ./plugins/ffmpeg/ffmpeg.exe
    
    # Show confirmation message
    echo "Permissions successfully set."
    

    Explanation of the permission numbers:

    In Linux, file permissions are represented by a three-digit number:

    • The first digit is for the owner
    • The second digit is for the group
    • The third digit is for others (everyone else)

    Each digit is a combination of:

    • 4 = read permission
    • 2 = write permission
    • 1 = execute permission

    You add them together to get the desired permissions.

    Examples:

    • 7 = 4 (read) + 2 (write) + 1 (execute) = read, write, execute
    • 6 = 4 (read) + 2 (write) = read, write
    • 5 = 4 (read) + 1 (execute) = read, execute
    • 4 = read only

    Permissions we’re using:

    • 755 for directories:
    • Owner can read/write/execute
    • Group can read/execute
    • Others can read/execute
    • Why? So the web server can access directories, and users can navigate them, but only the owner can write to them.
    • 775 for directories (alternative if group write is needed):
    • Owner and group can read/write/execute
    • Others can read/execute
    • This is slightly more open for collaborative setups.
    • 644 for files:
    • Owner can read/write
    • Group and others can only read
    • Prevents unauthorized users from modifying files while allowing the web server to read them.
    • +x for executables like ffmpeg.exe:
    • Makes the file executable for the owner, group, and others
    • Required for scripts or binaries that need to run.

    ⚠️ Why not use 777?

    • 777 = read/write/execute for everyone (owner, group, others)
    • It’s insecure because anyone can modify or delete your files.
    • Okay for local testing, but a terrible idea for live public servers.

    Have fun!