AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Ssh copy id example12/23/2023 ![]() ![]() ssh/authorized_keys' :~$ ssh 'tcpdump -c 1000 -nn -w - not port 22' | wireshark -k -i - localhost:~$ tar -cvj /datafolder | ssh remoteserver "tar -xj -C /datafolder" localhost:~$ ssh "tar -jcf - /path/to/backup" > 2 localhost:~$ ssh -X remoteserver vmware :~$ rsync -az /home/testuser/data remoteserver:backup/ localhost:~$ torsocks ssh localhost:~$ ssh -i ~/.ssh/my-ec2-key.pem Host my-ec2-public Remoteserver:~# iptables -t nat -A POSTROUTING -s 10.10.10.2 -o enp7s0 -j MASQUERADE localhost:~$ ssh-copy-id localhost:~$ ssh remoteserver "cat /var/log/nginx/access.log" | grep badstuff.php localhost:~$ cat ~/.ssh/id_rsa.pub | ssh remoteserver 'cat >. Remoteserver:~# ip tun0 up localhost:~# route add -net 10.10.10.0 netmask 255.255.255.0 dev tun0 remoteserver:~# echo 1 > /proc/sys/net/ipv4/ip_forward PermitTunnel yes localhost:~# ssh -v -w any localhost:~# ip addr add 10.10.10.2/32 peer 10.10.10.10 dev tun0 Port 2222 localhost:~$ scp mypic.png :/media/data/mypic_2.png sftp localhost:~$ ssh -D 8888 IdentityFile /home/test/.ssh/remoteserver.private_key Localhost:~$ ssh -v -p 22 -C Host remoteserver | | + o o | +-+ # ssh-copy-id -i ~/.ssh/mykey ssh -i ~/.ssh/mykey ssh-copy-id ]hostname brew install ssh-copy-id sudo port install openssh +ssh-copy-id curl -L | sh SSH Examples, Tips & Tunnels The key fingerprint is: SHA256:GKW7yzA1J1qkr1Cr9MhUwAbHbF2NrIPEgZXeOUOz3Us The key's randomart image is: +-+ |.*++ o.o. Your public key has been saved in mykey.pub. Enter file in which to save the key (/home/ylo/.ssh/id_rsa): mykey Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in mykey. # ssh-keygen Generating public/private rsa key pair. | | + o o | +-+ # ssh-copy-id -i ~/.ssh/mykey ssh -i ~/.ssh/mykey ssh-copy-id ]hostname brew install ssh-copy-id sudo port install openssh +ssh-copy-id curl -L | sh Ssh-copy-id for copying SSH keys to servers ![]() We use the $PASS variable to the password to the script, so the script just prints that variable.Previous Post Next Post Ssh-copy-id for copying SSH keys to servers Now the script is supposed to provide the password to ssh-copy-id by printing it to its stdout. We have specified our own script in that variable, so ssh-copy-id will execute just that. That forces ssh-copy-id to run the executable specified in the $SSH_ASKPASS in order to obtain the password. Then you can use the following command to accomplish what you've asked for: PASS="$1" SSH_ASKPASS="/var/tmp/ssh-pass.sh" setsid -w ssh-copy-id -i /root/.ssh/id_rsa -p "$3"Įxplanation: we use setsid -w to disassociate the ssh-copy-id process from the currently used terminal. You can do that as follows: first, create an auxiliary script, say /var/tmp/ssh-pass.sh (actually find a better name than that), with the following contents: #!/bin/sh The solution is to use the $SSH_ASKPASS environment variable. But even if you do it with the correct order, it will still not work because ssh-copy-id (and all other programs from openssh) do not read passwords from their stdin. As pointed out, you had the pipeline backwards.
0 Comments
Read More
Leave a Reply. |