【環境配置】本地配置sublime text以及和遠端linux設定sftp
工具:
sublime text 2(mac版)
遠端linux(centos 7系)
securCRT(for mac)
【本地安裝並配置securCRT(for mac)】
關於配置:
1、解決終端連線伺服器短時間自動斷開連線的問題:
修改伺服器sshd_config檔案,直接修改 /etc/ssh_config檔案
將 #ServerAliveCountMax 3
#ServerAliveInterval 0
的註釋去掉,並且 ServerAliveInterval 0 改為 ServerAliveInterval 5
引數備註 :
(1)ServerAliveCountMax 3 :表示伺服器發出請求後客戶端沒有響應的次數達到一定值, 就自動斷開. 正常情況下, 客戶端不會不響應.
(2)ServerAliveInterval 0 :指定了伺服器端向客戶端請求訊息的時間間隔, 預設是0, 不傳送.
而ServerAliveInterval 5表示每5秒向伺服器傳送一次,這樣就保持長連線了。
2、securCRT設定終端顏色
參考部落格:https://blog.csdn.net/yulei_qq/article/details/47733327
【sublime text 2(mac版)的安裝配置】
(1)安裝:https://www.sublimetext.com/2 對應的外掛install package安裝命令:https://packagecontrol.io/installation#st2
(2)想在本地mac的sublime上同步遠端linux的程式碼,一種方法使用sublime自帶的sftp/ftp外掛,另一種方法是使用samba。本文下來介紹如何使用使用sublime自帶的sftp/ftp外掛:需要在本地sublime配置以及遠端linux配置兩部分:
第一部分:配置遠端linux主機(我的是centos 7系)
step1:安裝vsftp
yum -y install vsftpd
step2:修改配置檔案
vi /etc/vsftpd/vsftpd.conf
保證下面3項為YES
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
step3:設定vsftpd開機啟動
systemctl enable vsftpd.service
step4:啟動並檢視vsftpd服務狀態,systemctl啟動服務成功不會有任何提示,綠色的active表示服務正在執行
systemctl start vsftpd.service
systemctl status vsftpd.service
第二部分:在本地sublime配置
step1: 外掛安裝
用Package Control安裝外掛
按下Ctrl+Shift+P調出命令面板
輸入install 調出 Install Package 選項並回車,然後輸入sftp,下拉列表中會出現一些相關的外掛,選中sftp進行安裝就行。外掛安裝過程可以檢視Sublime左下角的狀態列的資訊。
step2:基本連線
外掛安裝完成以後,需要進行配置。選選單欄中的File->SFTP/FTP->Set up Server。這樣就會開啟一個配置檔案:
{ // The tab key will cycle through the settings when first created // Visit http://wbond.net/sublime_packages/sftp/settings for help // sftp, ftp or ftps "type": "sftp", "save_before_upload": true, // 支援ctrl + s自動同步到伺服器 "upload_on_save": true, // 支援ctrl + s 自動同步到伺服器 "sync_down_on_open": false, "sync_skip_deletes": false, "sync_same_age": true, "confirm_downloads": false, "confirm_sync": true, "confirm_overwrite_newer": false, "host": "ip", "user": "user", "password": "passwd", //"port": "22", "remote_path": "/home/admin/", "ignore_regexes": [ "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json", "sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/", "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini" ], //"file_permissions": "664", //"dir_permissions": "775", //"extra_list_connections": 0, "connect_timeout": 30, //"keepalive": 120, //"ftp_passive_mode": true, //"ftp_obey_passive_host": false, //"ssh_key_file": "~/.ssh/id_rsa", //"sftp_flags": ["-F", "/path/to/ssh_config"], //"preserve_modification_times": false, //"remote_time_offset_in_hours": 0, //"remote_encoding": "utf-8", //"remote_locale": "C", //"allow_config_upload": false, }
我們需要配置一些遠端連線的基本資訊,如上圖。遠端IP、使用者名稱、密碼、開啟目錄。配置完成以後儲存檔案。
在選選單欄中的File->SFTP/FTP->Browse Server 就可以看到自己配置的遠端連線資訊了,然後選中連線即可。然後就可以瀏覽遠端伺服器中的檔案了。
step3:同步資料夾
先在本機mac下建立一個資料夾(最好使用英文),使用Sublime開啟。
此時,右鍵左側sidbar中這個檔案圖示,選擇SFTP/FTP: SFTP > Map to Remote…
然後會開啟一個.json的配置檔案。我們需要在這個檔案中配置連線需要的資訊。同上面的配置。
儲存檔案,右鍵檔案圖示,SFTP > Download Folder,就可以把遠端資料夾的檔案下載到同步的資料夾中了。以此類推,我們可以進行檔案上傳、同步等操作。
將 #ServerAliveCountMax 3
#ServerAliveInterval 0
的註釋去掉,並且 ServerAliveInterval 0 改為 ServerAliveInterval 5
引數備註 :
(1)ServerAliveCountMax 3 :表示伺服器發出請求後客戶端沒有響應的次數達到一定值, 就自動斷開. 正常情況下, 客戶端不會不響應.
(2)ServerAliveInterval 0 :指定了伺服器端向客戶端請求訊息的時間間隔, 預設是0, 不傳送.
而ServerAliveInterval 5表示每5秒向伺服器傳送一次,這樣就保持長連線了。
2、securCRT設定終端顏色
參考部落格:https://blog.csdn.net/yulei_qq/article/details/47733327
【sublime text 2(mac版)的安裝配置】
(1)安裝:https://www.sublimetext.com/2 對應的外掛install package安裝命令:https://packagecontrol.io/installation#st2
(2)想在本地mac的sublime上同步遠端linux的程式碼,一種方法使用sublime自帶的sftp/ftp外掛,另一種方法是使用samba。本文下來介紹如何使用使用sublime自帶的sftp/ftp外掛:需要在本地sublime配置以及遠端linux配置兩部分:
第一部分:配置遠端linux主機(我的是centos 7系)
step1:安裝vsftp
yum -y install vsftpd
step2:修改配置檔案
vi /etc/vsftpd/vsftpd.conf
保證下面3項為YES
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
step3:設定vsftpd開機啟動
systemctl enable vsftpd.service
step4:啟動並檢視vsftpd服務狀態,systemctl啟動服務成功不會有任何提示,綠色的active表示服務正在執行
systemctl start vsftpd.service
systemctl status vsftpd.service
第二部分:在本地sublime配置
step1: 外掛安裝
用Package Control安裝外掛
按下Ctrl+Shift+P調出命令面板
輸入install 調出 Install Package 選項並回車,然後輸入sftp,下拉列表中會出現一些相關的外掛,選中sftp進行安裝就行。外掛安裝過程可以檢視Sublime左下角的狀態列的資訊。
step2:基本連線
外掛安裝完成以後,需要進行配置。選選單欄中的File->SFTP/FTP->Set up Server。這樣就會開啟一個配置檔案:
{ // The tab key will cycle through the settings when first created // Visit http://wbond.net/sublime_packages/sftp/settings for help // sftp, ftp or ftps "type": "sftp", "save_before_upload": true, // 支援ctrl + s自動同步到伺服器 "upload_on_save": true, // 支援ctrl + s 自動同步到伺服器 "sync_down_on_open": false, "sync_skip_deletes": false, "sync_same_age": true, "confirm_downloads": false, "confirm_sync": true, "confirm_overwrite_newer": false, "host": "ip", "user": "user", "password": "passwd", //"port": "22", "remote_path": "/home/admin/", "ignore_regexes": [ "\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json", "sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/", "\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini" ], //"file_permissions": "664", //"dir_permissions": "775", //"extra_list_connections": 0, "connect_timeout": 30, //"keepalive": 120, //"ftp_passive_mode": true, //"ftp_obey_passive_host": false, //"ssh_key_file": "~/.ssh/id_rsa", //"sftp_flags": ["-F", "/path/to/ssh_config"], //"preserve_modification_times": false, //"remote_time_offset_in_hours": 0, //"remote_encoding": "utf-8", //"remote_locale": "C", //"allow_config_upload": false, }
我們需要配置一些遠端連線的基本資訊,如上圖。遠端IP、使用者名稱、密碼、開啟目錄。配置完成以後儲存檔案。
在選選單欄中的File->SFTP/FTP->Browse Server 就可以看到自己配置的遠端連線資訊了,然後選中連線即可。然後就可以瀏覽遠端伺服器中的檔案了。
step3:同步資料夾
先在本機mac下建立一個資料夾(最好使用英文),使用Sublime開啟。
此時,右鍵左側sidbar中這個檔案圖示,選擇SFTP/FTP: SFTP > Map to Remote…
然後會開啟一個.json的配置檔案。我們需要在這個檔案中配置連線需要的資訊。同上面的配置。
儲存檔案,右鍵檔案圖示,SFTP > Download Folder,就可以把遠端資料夾的檔案下載到同步的資料夾中了。以此類推,我們可以進行檔案上傳、同步等操作。