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 เมษายน 10, 2013, 10:38:48 pm
-
###SSH Tunnel
ssh golfreeze@ssh_server -L 3389:PC_client:3389
###FTP via SCP with strang PORT
scp -P 2020 edit.txt golf@serverip:/home/golf/.
-
##generate rsa-public-key at client PC.
#ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
#less /root/.ssh/id_rsa.pub
add to SSH-SERVER as
#vi /home/user/.ssh/authorized_keys
ssh-rsa yourkey
-
เราสามารถใช้คำสั่ง ssh วิ่งไปรัน command ใน remote host เครื่องอื่นได้ เพื่อลดระยะเวลาการ shell หรือต้องการแก้ไขปัญหาแบบเร่งด่วน
โดยมีข้อแม้ว่า ต้องทำการแอด key ลงใน remote host ใน user ที่จะสั่งไปทำงานให้เรียบร้อยก่อน
ตัวอย่างเช่น เราจะรัน command จากเครื่อง 10.20.10.9 เพื่อสั่งให้เครื่อง 10.20.10.10 ไปเปิดไฟล์ packetlove.txt ขึ้นมาแสดง
#ssh -n 10.20.10.10 -lpacketlove -p22 'cd move_server_2016 ;ls -lah ;cat packetlove.txt'
สามารถนำไปประยุกต์ใช้งานได้ตามความเหมาะสมนะครับผม : )