Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => command , shell script ,tool , crontab => Topic started by: golfreeze on พฤศจิกายน 22, 2019, 06:31:06 AM

Title: ssh command send to remote host howto by packetlove team
Post by: golfreeze 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