SSH to remote server using ansible

Given that you do not use Paramiko for ssh (transport = ssh), Ansible will fully use your ~/.ssh/config. Therefore you can globally define all connection rules in your ssh configuration. If for some reason you want Ansible to not use your default ssh config but provide an separate configuration, you can define this in your … Read more

python paramiko ssh

There is something wrong with the accepted answer, it sometimes (randomly) brings a clipped response from server. I do not know why, I did not investigate the faulty cause of the accepted answer because this code worked perfectly for me: import paramiko ip=’server ip’ port=22 username=”username” password=’password’ cmd=’some useful command’ ssh=paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(ip,port,username,password) stdin,stdout,stderr=ssh.exec_command(cmd) outlines=stdout.readlines() … Read more

SSH connection with Java

Use JSch import com.jcraft.jsch.*; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; /** * @author World */ public class SSHReadFile { public static void main(String args[]) { String user = “john”; String password = “mypassword”; String host = “192.168.100.23”; int port = 22; String remoteFile = “/home/john/test.txt”; try { JSch jsch = new JSch(); Session session = … Read more

.ssh/config: “Bad configuration option: UseKeychain” on Mac OS Sierra 10.12.6

Try to specify another option, namely IgnoreUnknown like below: Host * IgnoreUnknown UseKeychain UseKeychain yes You can find more info about this here. If you already have an IgnoreUnknown value, use comma separated values Host * IgnoreUnknown AddKeysToAgent,UseKeychain AddKeysToAgent yes UseKeychain yes If you have multiple Host configs that use the UseKeychain option, make sure … Read more

git clone with HTTPS or SSH remote?

GitHub have changed their recommendation several times (example). It appears that they currently recommend HTTPS because it is the easiest to set up on the widest range of networks and platforms, and by users who are new to all this. There is no inherent flaw in SSH (if there was they would disable it) — … Read more