i am a noob, but after many tries and errors i managed to copy all my files from an external harddrive into nextcloud with ssh.
First i tried to copy a few files from my local pc to the home directory /home/start9/ of the start9server with the rsync command to check if the command would work. It was succesful, but if i tried to copy the whole external hard drive i would get errors about the destination drive not having enough space.
No space left on device (28)
I wasnt able to resolve this issue, although i had more then enough space on the harddrive of the server.
Later i thought i would try to copy everything in the nextcloud directories. But i did not know where to find these directories. But finaly i found them:
/embassy-data/package-data/volumes/nextcloud/data/nextcloud/data/your_account_at_nextcloud/files/
You can ls
all the way to
/embassy-data/package-data/volumes/nextcloud/data/nextcloud
but after that if you want to ls
into a deeper directory you get:
-bash: cd: data: Permission denied
I solved this problem by elevating myself to root by
sudo -i
now i could go deeper and find the destination directory where i wanted to copy my files to. But using ssh and rsync command on the commandline of my local pc like this:
rsync -avP /path/to/files/to/be/copied/ start9@ADJECTIVE-NOUN.local:/embassy-data/package-data/volumes/nextcloud/data/nextcloud/data/your_account_at_nextcloud/files/
would give me an error as i had no permission to copy to the destination directory. I read about chmod and other commands to change permissions on directories, but that was too difficult for me. I thought i should just elevate myself to root on the server and ls
into the destination directory and use the rsync command from there like this:
rsync -avP --delete user@IP_adres_local_pc:/media/user/external_hard_drive/Documents /embassy-data/package-data/volumes/nextcloud/data/nextcloud/data/your_account_at_nextcloud/files
But this would also not work because i was ssh’ing back from the server to my local pc and my local pc was not enabled to receive ssh connection. So i had to enable that first. So on my local PC commandline i installed:
sudo apt install openssh-server
enable it:
sudo systemctl enable ssh
opening port 22 (in case of firewall or something):
sudo ufw allow ssh
checking the status of it:
sudo systemctl status ssh
So finally the above rync command worked. i checked it in the directory and everything seemed fine. But then if i would log in to nextcloud through the browser i could not detect the newly copied files. All this time, but still not usable if i cant seem to find them through the nextcloud app or browser.
So after searching the internet i understood that nextcloud indexes all the files that are uploaded to the server, but only indexes the files that are uploaded through the ‘official’ channels. These are through the webbrowser, the app or webDAV. ‘uploading’ through ssh is not recognized and therefor not indexed by nextcloud. So nextcloud is not aware that newly copied files are present.
So the solutions is to change the config file of nextcloud which can be found here on the server:
/embassy-data/package-data/volumes/nextcloud/data/nextcloud/config/config.php
by changing the following number 0
into 1
in the following line:
‘filesystem_check_changes’ => 0,
so the new line becomes:
‘filesystem_check_changes’ => 1,
And now nextcloud scans the directories for new files. Hurrah finaly everything worked. All files visible.