NextCloud Android app issues

Issue #1: If you run low on storage while coping photos results are unreliable, which may be expected. Some, perhaps many, files will not be uploaded. And why was I low low on storage? Because the app creates a temp folder with copies of the photos you are copying. I had over 600MB in this tmp folder which filled my storage and caused the app to be unreliable without warning. I’m sure it’s much less of a problem in day to day usage, because a much lower volume of photos are likely to be transferred. However when you just start using the app it doesn’t back up existing photos. So if you need to copy…Share, a large batch of existing photos you may find yourself in this situation.

Issue #2: I selected 17 files using a Android file manager then shared with nextcloud…only 5 were transfered. Tried multiple times always 5. But when I shared same 17 with the Gallery app they all were transfered.

So why didn’t I fill out a bug report? Because every time I filled out information…they wanted more. Finally, when they asked for logs, and told me to make sure I didn’t include sensitive information I gave up, because I’m not going to comb through all that data looking for a needle in a haystack. I’d probably miss something. Anywho…I understand why they ask for it and knowing what I know, I pretty much can work around the problems.

More on NextCloud!

This was an educational, fun and potentially useful project. With all the privacy concerns out there it’s good to have options. It can eliminate services such as Dropbox and Google photos. No agreeing to terms of services to companies who aren’t giving away these free services for free. There’s a cost!

To the best of my knowledge it’s installed correctly. At various testing stages, that hasn’t always been true. I haven’t explored all of it’s abilities and options.

Will I switch over to NextCloud? Is there anything else to consider? Well here are a few thoughts:

  • Is my ISP plan big enough to handle the data I need/want to transmit? Probably not unless I’m prepared wait! Or upgrade at an added expense.
  • What about backups? A single server in one location is not a good plan!
  • Am I as good a server administrator as people who do this for a living? NO!
    I mean even big companies with deep pockets that employ many people to protect their data…get hacked!
  • Will I get hacked? I certainly could…see the point above! The only thing in my favor is I’m a small nobody! Would anybody even bother?

NextCloud move/increase storage!

OK, I think I sucessfully moved my NextCloud data file by following these instructions…
https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170
BTW, having phpMyAdmin available, which I installed on addition to LAMP, makes the MySQL changes much easier.

So far everything looks good!

Also Install imagick, which the NextCloud overview recommended. Surprisingly many steps to get there, many attempts required other things to be installed then finally it had to be manually added to php.ini.

NextCloud cron jobs/Contacts

  • Setup Ubuntu Server cron jobs to…
  • Run rinker.sh [ddns updater] every 10min
  • Run certbot renew [for Let’s Encrypt renew] ever hour. Since the cert doesn’t expire for 90 days, every hour seems like overkill. But I don’t keep server up 24/7. So I want to make sure it’s checked in the window of time I have it up.

Install NextCloud Contacts and synchronized with Thunderbird contacts using cardDAV. The Synchronization had to be repeated multiple times doing chunks because it wouldn’t Synchronize everything at once.

NextCloud…moving/expanding storage

When reinstalling I put the data area on root, but I thought no big deal…I’ll move it later. It’s cloud storage that should be a basic maintenance procedure. But when I started looking into it, article after article says moving data storage is not recommended and it is strongly advised to reinstall to accomplish this. Really? Software who’s primary purpose is to store data doesn’t have an administrator function to easily move or expand [which often involves moving] storage?

It’s early in my research so perhaps these articles are talking about an older version. Surely…don’t call me Shirly… at version 16 there is a way to do this! It seems like a basic expected function for this type of software…IMHO.

I broke NextCloud!

Well I borked NextCloud install trying to update PHP from 7.2 to 7.3. This gave me an excuse to reinstall everything the way I should have the 1st time, I separated the HD partitions of /home from /root. I used clonezilla to create a “clone” of my installation (Ubuntu Server, LAMP and a properly installed NextCloud) that can quickly be recovered in a matter of minutes. It still took me a few hours to reinstall…Ubuntu Server, Static IP address setup, LAMP stack (using tasksel), phpMyAdmin, MySQL password (it installs without one and is needed for the NextCloud Install), proper permissions for the NextCloud Web folder & data folder, the Let’s Encrypt SSL certificate along with all the custom edits needed for this, the NextCloud hardening tweeks it recommends, also enabling the firewall with the proper allows! I’ll be darned if tasksel uninstalled the OpenSSH server again and this time I DIDN’T unselect it. If I was going to screw up the installation now was a good time because the last install was fresh in my memory because it was very recent.

NextCloud DDNS update and server hardening

Create cron job to update my DDNS with my dynamic IP address, (so far my IP address hasn’t changed since I started using the DDNS)…
1) crontab -e (this is the crontab edit command)
2) add the following line (without double quotes) at the bottom of the file to run the script every 10 minutes, “*/10 * * * * /path to script/rinker.sh >/dev/null 2>&1”
rinker.sh is the script that ChangeIP provided to update the IP address. The script creates /var/log/changeip.log with the status.

There could be many reasons I can’t reach my server. But if it’s due to my ISP changing my IP address, I should be able to access it again within 10 minutes.

Hardening my NextCloud server

I previously said I thought I was basically finished setting up NextCloud.
Well surprise…surprise. The NextCloud Administrator account has an “overview” section that looks at your server and Flags potential problems and makes useful recommendations!

The following solution may specifically help someone getting the message…
The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds
and used certbot to install the Let’s Encrypt SSL certificate. If you want to skip the boring details just jump down to Solution.

I can’t tell you how many times I googled trying to find a solution.
In my case, YMMV, I enhanced the problem for myself by following a Digital Ocean document describing “How To Set Up Apache Virtual Hosts on Ubuntu”.
Digital Ocean is known for creating great documentation and the fault lies with me for assumptions I made.
So starting there just created so many problems.
However in my defense this problem was repeated time and time again in googles search’s. Many people had problems with this!

I created a /etc/apache2/sites-available/myserver.conf file and added the following 3 lines…

<IfModule mod_headers.c>
Header always set Strict-Transport-Security “max-age=15552000; includeSubDomains; preload” </IfModule>

Then enabled it with: a2ensite myserver.conf
I then restarted apache.

No luck!

I added it to /var/www/http/nextcloud/.htaccess

No luck!

I googled and googled and edited and reedited!

Solution
Finally I added the <IfModule> code shown above to /etc/apache2/sites-available/000-default-le-ssl.conf which I believe was created by Let’s Encrypt certbot…duh!…and it worked!
In hind site it makes sense (isn’t that always the way) because that’s where the SSLcerts are defined. So I didn’t need to create ANY config files, I just needed to edit the one, I assume that certbot created.

NextCloud on Android

Have been using the NextCloud app on my Android phone. It can auto backup photos to your server starting when you install it. It doesn’t backup existing photos! However from the Android Gallery app you can press the Share icon [that ‘<‘ looking thing] at the top of screen and select all or some pics, then ‘Share’ at the bottom of the screen, then choose NextCloud to backup existing photos to your server.

NextCloud Live!

  • Signed up with ChangeIP for their free dynamic DNS service. I have to manually update my IP…which is fine…and I prefer, for now! I’m more interested in playing with it right now. I’m not ready to rely on it at this time. They have instructions on how to update the IP address from the server on their site which I will explore later.
  • Having a dynamic DNS allowed me to use Let’s Encrypt, for secure access to my NextCloud server which I successfully accessed with the Linux appimage client and the Android app.

I did have one problem externally SSHing into server using the Dynamic DNS.

bill@billb-MS-7B79 ~ $ ssh user@????dynamic-dns.net
ssh: connect to host ????.dynamic-dns.net port 22: Connection refused
bill@billb-MS-7B79 ~ $

This was because I forgot to port forward that port an my physical router. Doing that fixed the problem!