UnamSanctam / UnamWebPanel

MIT License
180 stars 58 forks source link

SQLite appropriate permission #415

Closed DerXanRam closed 1 month ago

DerXanRam commented 1 month ago

Hello man. I hosted this webpanel on VPS with ubuntu 22.04 . I installed nginx,php7.4 ,php7.4-fpm and php7.4-sqlite and when i test it, it says

The SQLite database file (/var/www/html/db/unamwebpanel.db) is not writable, please give the file appropriate write permissions.

I tried to give different read write permission but no luck. please help

UnamSanctam commented 1 month ago

You need to change the permissions of the /var/www/html/db/unamwebpanel.db file so that it is writable. It really depends on what user you run Nginx under, if the user ownership and everything is correct then these commands should be enough:

sudo chmod 664 /var/www/html/db/unamwebpanel.db
sudo chmod 755 /var/www/html/db
DerXanRam commented 1 month ago

sudo chmod 664 /var/www/html/db/unamwebpanel.db

I try the command u gave me and it isn't working. I restarted nginx and php7.4-fpm after the command. Also i installed all of the them where i logged as a root user. For details, here are the permission info of the directory and the db file

directory's permission drwxr-xr-x 2 root root 4096 Sep 24 21:38 /var/www/html/db

unamwebpanel.db file permission -rw-rw-r-- 1 root root 6193152 Sep 24 21:38 /var/www/html/db/unamwebpanel.db

UnamSanctam commented 1 month ago

It's likely because of the correct ownership not being configured on all files, can you run this command to see what user is running Nginx and maybe php-fpm? ps -eo user,group,comm | grep nginx ps -eo user,group,comm | grep php-fpm

DerXanRam commented 1 month ago

ps -eo user,group,comm | grep nginx

root     root     nginx
www-data www-data nginx

ps -eo user,group,comm | grep php-fpm

root     root     php-fpm7.4
www-data www-data php-fpm7.4
www-data www-data php-fpm7.4
UnamSanctam commented 1 month ago

Then try changing ownership of the database files to the www-data user (it's the user that your Nginx workers run as):

sudo chown www-data:www-data /var/www/html/db/unamwebpanel.db
sudo chown www-data:www-data /var/www/html/db
DerXanRam commented 1 month ago

sudo chown www-data:www-data /var/www/html/db

It worked now. Thanks a lot 🙏