Monday, March 21, 2016

Feed in your ssh password into Linux SSH command to login automatically

I needed to login to a linux server automatically, but without using Shared RSA Key. I needed to simulate a human being typing password, but to do that automatically so I can use it inside my shell scripts.

Surprisingly this solution was difficult to find on Google. I would like to share this simple technique in hope this will save somebody long research time.

This is an alternative solution from login into SSH using Shared RSA Key technique which is much more secure and the recommended method.

WARNING: This method exposes your ssh login / password! (use with caution)

Install sshpass if you don't have it yet:

apt-get update
apt-get install sshpass

Example shell script:

#!/bin/bash

sshpassword=mypassword

sshpass -p $sshpassword ssh 192.168.1.1 "ls -l"

iPhone Mail IMAP setup with iRedMail Server not working via SSL (SOLVED)

Enable port 993 IMAPs to get iPhone Mail app to work with IMAP against iRedMail (dovecot) server.


I have a iredmail server fully working with many IMAP clients (Outlook, Mac Mail, Thunderbird, etc...), however I have been battling getting it to work on IOS / iPhone Mail IMAP client.

After hours of toiling and googling, I found the solution (or issue). The secret is to enable port 993 (IMAP SSL / IMAPs) protocol in my firewall NAT rules. Meaning I had to port forward port 993 also for IMAPs. I guess this is because the iPhone does not support IMAP SSL TLS with STARTSSL using only port 143.

I hope this clue help save time for somebody else.