ssh
How to copy a directory from local machine to remote machine
Easiest way is scp scp -r /path/to/local/storage user@remote.host:/path/to/copy rsync is best for when you want to update versions where it has been previously copied. If that doesn’t work, rerun with -v and see what the error is.
Can I forward env variables over ssh?
You can, but it requires changing the server configuration. Read the entries for AcceptEnv in sshd_config(5) and SendEnv in ssh_config(5). update: You can also pass them on the command line: ssh foo@host “FOO=foo BAR=bar doz” Regarding security, note than anybody with access to the remote machine will be able to see the environment variables passed … Read more
How to make ssh-add read passphrase from a file?
Depending on your distribution and on the version of ssh-add you may be able or not to use the -p option of ssh-add that reads the passphrase from stdin in this way: cat passfile | ssh-add -p keyfile If this is not working you can use Expect, a Unix tool to make interactive applications non-interactive. … Read more
ssh connection stop at “debug1: SSH2_MSG_KEXINIT sent” [closed]
I just had this happen to me on a XEN host. I had duplicated this host from another, and as is common practice, I deleted the host keys in /etc/ssh after doing this, thinking that new ones would be generated later. But this never happened, and sshd happily started up with no host keys. When … Read more
Docker image push over SSH (distributed)
If you want to push docker images to a given host, there is already everything in Docker to allow this. The following example shows how to push a docker image through ssh: docker save <my_image> | ssh -C user@my.remote.host.com docker load docker save will produce a tar archive of one of your docker images (including … Read more
Ansible SSH ERROR connection in localhost
Ansible by default tries to connect through ssh. For localhost you should set the connection to local. You can define this when calling the playbook: ansible-playbook playbook.yml –connection=local Define it in your playbook: – hosts: local connection: local Or, preferable, define it as a host var just for localhost/127.0.0.1. Create a file host_vars/127.0.0.1 relative to … Read more
rsync through ssh tunnel [closed]
Try this one-liner: rsync -av -e “ssh -A root@proxy ssh” ./src root@target:/dst
ssh: check if a tunnel is alive
Netcat is your friend: nc -z localhost 6000 || echo “no tunnel open”
Ansible copy ssh key from one host to another
This does the trick for me, it collects the public ssh keys on the nodes and distributes it over all the nodes. This way they can communicate with each other. – hosts: controllers gather_facts: false remote_user: root tasks: – name: fetch all public ssh keys shell: cat ~/.ssh/id_rsa.pub register: ssh_keys tags: – ssh – name: … Read more