Author Topic: ssh command send to remote host howto by packetlove team  (Read 5839 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
ssh command send to remote host howto by packetlove team
« on: พฤศจิกายน 22, 2019, 06:31:06 AM »
เราสามารถประยุกต์ใช้ ssh command send to remote host ได้นะครับ
ในกรณี เราทำเรื่อง authentication via public key เรียบร้อยแล้ว เราสามารถสั่งให้ เครื่องต้นทาง run ssh command ที่ฝั่ง remote host ได้ดังนี้

ssh -t -p22 testssh2@203.86.x.5 'ls /home'

ก็จะเป็นการ ls /home ที่เครื่อง 203.86.x.5
แล้วเราก็สามารถสั่งให้ไปรัน shell script ในเครื่อง 203.86.x.5 ได้ดังนี้

ssh -t -p22 testssh2@203.86.x.5 '/home/testssh2/testscript.sh'

เท่านี้เองครับผม : )
Support [at] Packetlove [dot] com