Category Archives: Network

Adding https to my home web server

My downstairs web server is currently running Ubuntu 20.04, PHP 7.4, Apache 2.4 and WordPress 5.5. WordPress and Chrome have been nagging me about upgrading to https for some time. Initially I looked at it from the WordPress perspective but of course I self-host WordPress, together with a few other websites, so the solution has more to do with Apache than with WordPress. And so I found this excellent tutorial: How To Secure Apache with Let’s Encrypt on Ubuntu 20.04.

At Step 4 you run the Certbot software to obtain the SSL certificate and optionally add redirects to the Apache config files.

“Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access”.

I wasn’t sure if my WordPress installation was ready to fly yet without http, so I said no. I would check if https was working ok and do the Apache redirects myself later. As it turned out I didn’t have to do the redirects manually. If you run Certbot again (you may as well install a new certificate) then say yes to the question about redirects.

The https installation worked but afterwards I noticed that the WordPress Site Health plugin was complaining about a few things, including:

  • The REST API encountered an error
  • Your site could not complete a loopback request

I spent a lot of time googling this problem. It is a common problem with many possible causes and fixes, none of which worked.

The second problem I noticed was that https was working from within my home network but not from outside. I assumed this problem related to the changes I had made to ufw and I spent far too long editing that. I also thought that Certbot may have mucked up my Apache config files. But of course neither problem had anything to do with Certbot or the tutorial. Eventually I realized I had forgotten to open up port 443 on my home router! This instantly solved both problems.

Entering TCP/IP details into our HP LaserJet 4M

To get our old HP printer to work at home I need to configure it as a network printer with a fixed IP address. Entering the IP into the printer using its control panel is tricky if you don’t have instructions to follow. Here are some:


https://www.printertechs.com/other-instructions/network-printing-tutorial/152-entering-ip-address

Here it is from somewhere else:


https://forums.anandtech.com/threads/network-printer.2221658/

The syslog (LG) can be set to 0.0.0.0

Wrong user connecting to samba share

Our home network includes 2 servers in the basement. Both run Ubuntu 10.04 (Lucid) server. The older is primarily used as a web server. The newer is used mainly for NAS. When I’m completely happy with the new server I’ll add a web server, transfer our websites, then retire the old server. Both run Samba 3.4.7

The Samba server on the new server worked fine but I was using quick and dirty shares like this:

[storage]
force user = root
writeable = yes
path = /storage
write list = steven

Using ‘force user = root’ is pretty sloppy but it works if I am the only user and I can’t be bothered sorting out linux permissions on the server. After a few days I needed to fix up the samba permissions so our other windows PCs could access the samba shares for file sharing and backing up. So I needed to:

  • make sure the unix users have the correct directory and file permissions
  • the corresponding samba users exist and have the same passwords
  • the Windows hosts and users are set up correctly
  • that is, Linux user <=> Samba user <=> Windows user

All went ok except for one thing: one of the other PCs always (or mostly) connected to the samba server as me. This was a problem because I wanted write access for myself for all the samba shares but I wanted the other PC to have read only access to some of the shares (videos, music etc) but write access to others (eg backup). The samba log reported that the correct host was connecting but the incorrect user. If I deleted my Samba user then the PC would connect to the correct Samba user. Then when I recreated my samba user the PC would again connect as me, which is the incorrect user for that PC.

I tried many fixes, such as

  • created new windows users on various windows PCs – all were able to access the samba shares
  • reinstalled Samba and changed the password backend from smbpasswd to tdbsam
  • at the same time I was sometimes having trouble browsing the shares from all Windows boxes so I disabled the WINS server and instead configured all network IPs manually using hosts/lmhosts files.

At last today I figured it out. Of course the problem was with Windows rather than with Samba or Linux. At some stage I must have logged in to my samba user from the other PC and windows remembered that username and password. Despite numerous restarts and logouts and occassionally connecting to the correct samba user (when mine was not available) windows remembered my username and used it when possible. The solution was “to delete stored user names and passwords“.