Uppercase Hostname stops working after Reboot
Overview
For SFTP Gateway version 2.001.03
and prior, there's an issue
where SFTP users can no longer log in after the VM is rebooted.
The web admin UI stops working as well.
This can happen if the VM name includes uppercase letters. But the problem doesn't show up until after the first reboot.
This article goes over the solution, as well as an explanation of why this happens.
This issue is fixed in version 2.001.04
.
Solution
SSH into the VM, and run the commands:
sudo su
hostnamectl --pretty
This will give you the original mixed-case hostname (this should be identical to the Virtual Machine Name).
Next, edit the file /etc/hosts
, and append this hostname to the line:
127.0.0.1 localhost ... ... <pretty_hostname>
Save and quit.
To confirm that SFTP Gateway is working properly, run the following commands:
ldappassword=$(sudo grep ldap.password /opt/sftpgw/application.properties | cut -d"=" -f2)
ldapsearch -D cn=admin -w $ldappassword
You should see the contents of your LDAP database output to the screen.
Explanation
The Create a VM wizard lets you use uppercase letters for the Virtual Machine Name.
The problem is that Linux has two versions of the hostname:
- Pretty hostname: This is the same as the Virtual Machine Name
- Static hostname: This is an all-lowercase version of the Pretty hostname
If you set the Virtual Machine Name to something with uppercase letters:
Rob-VM
SFTP Gateway will self-configure on first launch with Rob-VM
as the hostname.
The LDAP database and self-signed certificates will also use Rob-VM
.
But after the first reboot, the hostname command will give you a different value (all-lowercase),
based on the static hostname
:
rob-vm
Since Linux is case-sensitive, SFTP Gateway will no longer be able to find the LDAP database (since it's changed to all-lowercase).
The solution (listed in the previous section) is to add the original mixed-case hostname to this file:
/etc/hosts
SFTP Gateway should now be able to find the LDAP database through local DNS resolution.