2020年12月25日 星期五

ssh 建立反向連線

remote client(在NAT後) : 

   command : ssh -NfR 9002:localhost:22 user@server.domain.name

  # xxx => any key in

  #server.domain.name => server domain name or ip address


Server(global address) : 

  command : ssh -p 9002 localhost

  #login localhost port 9002 .. 建立連線到remote client


ssh 免key password 

  command : 

    client$ ssh-keygen

    client$ ssh-copy-id server_id@server.domain.name

   client$  ssh server_id@server.domain.name

   #ssh-copy-id時需要輸入password. 之後登入不用password