6.4 KiB
Nextcloud
The docker file:
version: '3.8'
services:
app:
image: nextcloud
restart: unless-stopped
ports:
- 8007:80
volumes:
- nextcloud:/var/www/html
environment:
- POSTGRES_DB=nextcloud
- POSTGRES_USER=nextcloud
- POSTGRES_PASSWORD=zxq123_nextcloud
- POSTGRES_HOST=postgres
networks:
- postgres_network
volumes:
nextcloud:
networks:
postgres_network:
external: true
Database related things:
zxq_db=# CREATE DATABASE nextcloud;
CREATE DATABASE
zxq_db=# CREATE USER nextcloud WITH PASSWORD 'zxq123_nextcloud';
CREATE ROLE
zxq_db=# GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
GRANT
zxq_db=#
Permissions:
Not sure if the below still applies
# Add yourself and www-data to a shared group
### Create a shared group:
sudo groupadd ncshare
### Add both users:
sudo usermod -aG ncshare zaine
sudo usermod -aG ncshare www-data
### Set the folder to that group:
sudo chown -R zaine:ncshare /home/zaine/master-folder
sudo chmod -R 775 /home/zaine/master-folder
<2026-03-25 Wed> fixes:
Up To Date Fixes: We need to add zaine to the www-data group:
sudo usermod -aG www-data zaine
Then we need to make the directories setgid, so that any new files created will have the group www-data:
sudo chown -R zaine:www-data /home/zaine/master-folder
sudo chmod -R 2775 /home/zaine/master-folder # the 2 sets the setgid bit, which means that new files will inherit the group of the directory, which is www-data
Older fixes
So apparently, nextcloud needs to have www-data as the owner of the files, and to do that, we need to run the following command:
sudo chown -R www-data:www-data /home/zaine/master-folder
I modified the build scripts to change permissions back to zaine:zaine when deleting the output folder, then changing it back to www-data:www-data.
One other useful thing may be:
docker exec -u 1000:1000 -it nextcloud-app-1 php occ files:scan --all
# or
docker exec -u 1000 nextcloud-app-1 php occ files:scan --path="zaine/files/master-folder"
One other thing:
i FIXED IT BY doing this:
zaine@zaine-HP-ProDesk-400-G1-SFF [09:47:47] [~/docker-services/nextcloud]
-> % docker exec -it postgres psql -U nextcloud -d nextcloud
psql (17.5 (Debian 17.5-1.pgdg120+1))
Type "help" for help.
nextcloud=> SELECT * FROM oc_file_locks;
nextcloud=> DELETE FROM oc_file_locks;
DELETE 15002
nextcloud=> \q
zaine@zaine-HP-ProDesk-400-G1-SFF [09:49:01] [~/docker-services/nextcloud]
-> % docker exec -it nextcloud-app-1 ls /mnt/master-folder
alimiyyah attachments booking career hurra.txt org_files pdfs projects uni
zaine@zaine-HP-ProDesk-400-G1-SFF [09:49:04] [~/docker-services/nextcloud]
-> % docker exec -u 1000 -it nextcloud-app-1 php occ files:scan --all
Starting scan for user 1 out of 2 (halima)
Starting scan for user 2 out of 2 (zaine)
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 1985 | 12906 | 0 | 522 | 0 | 0 | 00:00:50 |
+---------+-------+-----+---------+---------+--------+--------------+
zaine@zaine-HP-ProDesk-400-G1-SFF [09:49:59] [~/docker-services/nextcloud]
-> %
there is some issue in the nextcloud permissions itself. if i create a file and delete it in windows, i get this error in the client: A
master-folder/hehe.txt
now
The resource you are trying to access is currently locked and cannot be modified. Please try changing it later, or contact your server administrator ...
and if i try to delete it in nextcloud ui (web), it says file cant be deleted
Config
Location is:
sudo nano /var/lib/docker/volumes/nextcloud_nextcloud/_data/config/config.php
Accounts
User is: zaine Pass: Shakkal123!
Legacy stuff
Something I've been trying to reverse proxy ahead of time. Go to https://zserver.zapto.org/nextcloud , you'll be prompted to login with a username and password: Here's your credentials:
Username: halima Password: loser2104!
Once you've logged in, I've set up your account already, so there should be a calendar already there.
To get your phone logged in, there's two ways:
- go to the following address: https://zserver.zapto.org/nextcloud/settings/user/security , scroll to the bottom, under devices and sessions, type in a random name (iphone), and click create new app password. You should then be able to generate a QR code (next to or under the password field), then you can scan that on your iphone app.
- inside the app, type the following URL: https://zserver.zapto.org/nextcloud then follow the instructions.
Im thinking of having this as our shared calendar and file system. The only users are us 2 and its completely off the internet (self-hosted).
network issues resolved by:
docker network connect postgres_network postgres
zaine@zaine-HP-ProDesk-400-G1-SFF [21:00:27] [~/docker-services/nextcloud]
-> % psql -h zserver.zapto.org -p 5432 -U zaine -d zxq_db
Password for user zaine:
psql (14.18 (Ubuntu 14.18-0ubuntu0.22.04.1), server 17.5 (Debian 17.5-1.pgdg120+1))
WARNING: psql major version 14, server major version 17.
Some psql features might not work.
Type "help" for help.
zxq_db=# \c nextcloud
psql (14.18 (Ubuntu 14.18-0ubuntu0.22.04.1), server 17.5 (Debian 17.5-1.pgdg120+1))
WARNING: psql major version 14, server major version 17.
Some psql features might not work.
You are now connected to database "nextcloud" as user "zaine".
nextcloud=# GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
GRANT
nextcloud=# GRANT USAGE ON SCHEMA public TO nextcloud;
GRANT CREATE ON SCHEMA public TO nextcloud;
GRANT
GRANT
nextcloud=# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO nextcloud;
GRANT
nextcloud=# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO nextcloud;
GRANT
nextcloud=#
zaine
M22ZN-fmefj-RdF36-3BMfT-LfWo8
zaine
zxh123!