Using secret-tool and sshpass for SSH password authentication
🚨 Note: Use with caution! Instead of password authentication, a SSH key with passphrase is the clean solution! Always prefer SSH keys over password authentication!
However, if for some reason you still want to use pure password authentication, this is the best way to do it.
The password is not stored in plain text, but i a keyring manager.
First store your password in a keyring using secret-tool:
echo -n 'YOUR_PASSWORD' | secret-tool store --label='example.org account' service example.org username YOUR_USER
Here's now how to establish the SSH connection:
sshpass -p "$(secret-tool lookup service example.org username YOUR_USER)" ssh YOUR_USER@example.org