
# this works to ssh to cabinpi3 and then to cabin@kjp.dyndns.org
# rsa key were made on this vm and cbinpi3 so do not need to enter passwords

#ssh -p 3640 pi@10.10.10.251  #works do not need password

# todo share folder(s) pccam with this vm; write rsync command

# this works
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 bash <<EOF#
#dir
#rmdir testing
#echo ""
#echo ""
#dir
#exit
#EOF

# this works, need to give s3 cabin's password; get at terminal: cabin@s3:~> 
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344

#ssh -p 3640 pi@10.10.10.251 # works get terminal at cabinpi3
#rsync -a -e "ssh -p 3640" ./testrsynctos3.sh pi@10.10.10.251:    # this works to copy one file to cabinpi3

# mounting via ssh
#sshfs -p 3640 pi@10.10.10.251:/ /home/karl/sshmount  # this mounts cabinpi3 / to /home/karl/sshmount
# to umount
#fusermount -u /home/karl/sshmount  # this works to umount

#ssh -p 3640 -t pi@10.10.10.251 "ssh -p 443 cabin@kjp.dyndns.org"  # get terminal cabin@s3 but have to give cabin's password
#ssh -p 3640 -t pi@10.10.10.251 "ssh -p 443 public@kjp.dyndns.org"  # get terminal public@s3 but have to give public's password
#ssh -p 3640 -t pi@10.10.10.251 "ssh -p 443 nbupublic@kjp.dyndns.org"  # get terminal nbupublic@s3 but have to give nbupublic's password

# ref: larkinweb.co.uk/computing/mounting_file_systems_over_two_ssh_hops.html
# do Not need to run the next two lines in a separate terminal!
#ssh -p 3640 -f pi@10.10.10.251 -L 2222:kjp.dyndns.org:443 -N
#sshfs -p 2222 cabin@localhost:/ /home/karl/sshmount

# the following two lines work to mount nbupublic@s3 via ssh tunnel to /home/karl/sshmount
ssh -p 3640 -f pi@10.10.10.251 -L 2222:kjp.dyndns.org:443 -N
sshfs -p 2222 nbupublic@localhost: /mnt/s3_PUBLIC/      #/home/karl/sshmount

# to umount: fusermount -u /home/karl/sshmount
# or: umount /home/karl/sshmount
# killing the tunnel:
# ps ax | grep "ssh_command" | awk '{print $1}' | xargs -i kill {} 2>/dev/null
# if after umounting & killing the tunnel, re-run the above ssh & sshfs commands get:
# bind [127.0.0.1]:2222: Address already in use
# channel_setup_fwd_listener_tcpip: cannot listen to port: 2222
# Could not request local forwarding.
# but get request for password & if enter password, everything works




#sshfs : /home/karl/sshmount -o ssh_command='ssh -p 3640 pi@10.10.10.251'  # this does not work

#sshfs -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 /home/karl/sshmount
#sshfs -p 3640 -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 /home/karl/sshmount
#sshfs -p 3640 -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org /home/karl/sshmount
#sshfs : /home/karl/sshmount -o ssh_command='ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344'
#sshfs : /home/karl/sshmount -o ssh_command='ssh -p 3640 -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344'
#sshfs : /home/karl/sshmount -o ssh_command='ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344'


#rsync -a -e ./testrsynctos3.sh ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L ./testrsynctos3.sh 1111:192.168.0.8:44344

#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 # works - ssh to cabin@s3
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:443   # works - ssh to cabin@s3
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:443  # new window ssh -p 44344 localhost connects asks for #password cabin allinatos3 cabinpi3 passwords do not work; ssh -p 1111 localhost does not work
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org  # works get ssh to cabin@s3


  #this works to get ssh to cabin@s3 and Blueiris_clips directory



# testing
#rsync -a -e "ssh -p 3640" ./testrsynctos3.sh 44344:pi@10.10.10.251:443 allinatos3@kjp.dyndns.org:  #does not work
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 # works get terminal cabin@s3
#ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 'mkdir test20210826' #don't know where made the directory
#bash -c "ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344 'dir && dir'"
#'cd Blueiris_clips'  #this works to get ssh to cabin@s3 and Blueiris_clips directory

#ssh -p 3640 pi@10.10.10.251 # works get terminal at cabinpi3
#sync -a -e "ssh -p 3640" ./testrsynctos3.sh -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344:    

#ssh -p 3640 pi@10.10.10.251 -L 44344:allinatos3@kjp.dyndns.org:443 -L 44344:192.168.0.8:80  # DOES NOT WORK
#ssh -p 3640 pi@10.10.10.251 -L 44344:allinatos3@kjp.dyndns.org:80   # does not work



#rsync -a -e "ssh -p 44344" ./testrsynctos3 ssh -p 3640 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org:

#rsync -a -e 1111  "ssh -p 3640 -tt -L 44344:localhost:1111 pi@10.10.10.251 ssh -p 443 cabin@kjp.dyndns.org -L 1111:192.168.0.8:44344" ./testrsynctos3.sh cabin@localhost

