Direkt zum Inhalt

Devbits

Kleine Code-Schnipsel aus unserem Alltag mit Drupal, PHP und DevOps: Problem, Lösung, Code.

22.01.2026 | Marc Hitscherich

Fix SSH warning "Remote host identification has changed" after server move.

If you have moved to a new server and want to access it with SSH via domain name, you will get the warning "Remote host identification has changed" due to changed SSH fingerprints in your `~/.ssh/known_host` file.

# Remove all old entries for my.example.com
ssh-keygen -R my.example.com

# Scan all supported fingerprints from the new server and insert them in your known_hosts file
ssh-keyscan my.example.com >> ~/.ssh/known_hosts

Issue:

If you have moved to a new server and want to access it with SSH via domain name, you will get the warning "Remote host identification has changed" due to changed SSH fingerprints in your `~/.ssh/known_host` file.

The code snippet addresses the challenge of updating SSH fingerprints in the known_hosts file for a server, particularly in cases where the server's keys have been changed, or there are discrepancies with the existing entries.

Solution:

Remove all old entries from the `~/.ssh/known_host` file and insert the new fingerprint(s). Hint: Only do this if you are sure that the new server is under your control.

This code snippet provides a solution to update the SSH fingerprints in the known_hosts file. It first removes any old entries related to a specific hostname (my.example.com) using the ssh-keygen command with the -R option. Then, it scans and appends all supported fingerprints from the new server to the known_hosts file using the ssh-keyscan command.

18.12.2025 | Michael Böker

How to add a password field to an entity as the Field_UI has none to offer

You want to add a password field to an entity via the field_ui. It does not work, and – as a reminder to recurring devs – is not supposed to work. The UI is switched off in the core definition.

/**
 * Defines the 'password' entity field type.
 *
 * @FieldType(
 *   id = "password",
 *   label = @Translation("Password"),
 *   description = @Translation("An entity field containing a password value."),
 *   no_ui = TRUE,
 * )
 */

Issue:

You want to add a password field to an entity via the field_ui. It does not work, and – as a reminder to recurring devs – is not supposed to work. The UI is switched off in the core definition.

Solution:

If you need a password field, first evaluate the necessity to save a password in the database – this might create a serious security risk. 

If your project requires it anyway, you either have to create a custom widget for a textfield or use the module Password field.