'connect to remote server with paramiko without asking for password

I'm using paramiko to write a python script that establishes an ssh connection with a remote-server. Since I use the same username and password every time I initiate a connection, I don't want to ask for the password at any point as it would disrupt my program flow. I can't save the password in plain text either.

Is there a way to automate this authentication?

self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(host, username=user, password=psw, port=22)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source