網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
簡(jiǎn)介
-
SSH
,Secure Shell,安全外殼協(xié)議,用于遠(yuǎn)程登錄會(huì)話(huà) -
SFTP
,Secret File Transfer Protocol,安全文件傳送協(xié)議,用于同步文件
Windows 連接遠(yuǎn)程服務(wù)器進(jìn)行 Linux 環(huán)境下的 Python 開(kāi)發(fā)需要結(jié)合 SSH 和SFTP
安裝
安裝 PyCharm Professional
PyCharm Community 沒(méi)有該選項(xiàng),無(wú)法配置 SSH Interpreter
登陸遠(yuǎn)程服務(wù)器
ssh user@host [-p port]
查看是否開(kāi)啟 SSH 服務(wù)
service sshd status
如果顯示 Loaded: not-found (Reason: No such file or directory) 或 sshd: unrecognized service,則需要安裝
sudo apt-get install openssh-server
如果顯示 Active: inactive (dead),則需要啟動(dòng)
sudo /etc/init.d/ssh restart
只要 SSHD 服務(wù)啟動(dòng)了,SFTP便可使用
Tools → Deployment → Configuration…
+ → SFTP → New server name 隨意填(如 user@host:port) → 取消勾選 Visible only for this project → SSH configuration → + → 根據(jù) SSH 信息對(duì)應(yīng)填上 → Test Connection
SFTP 這里 Test Connection → Autodetect
File → Settings → Project: xxx → Python Interpreter → 設(shè)置 → Add… → SSH Interpreter → Existing server configuration
配置 Python 解釋器和同步文件夾,是否用 sudo 權(quán)限看情況勾選
初試
main.py
print(__file__)
可能需要手動(dòng)同步:Tools → Deployment → Upload to…
快捷鍵:Ctrl + Alt + Shift + X
遇到的坑
1. EOF while reading packet
需要啟動(dòng) SSHD 服務(wù)
2. sudo: unable to resolve host xxx: No such file or directory
sudo vim /etc/hosts
添加
127.0.0.1 localhost xxx
3. vim /etc/hosts 報(bào)錯(cuò) “/etc/hosts” E166: Can’t open linked file for writing
查看真實(shí)路徑
readlink /etc/hosts
或者把文件刪了
4. Can’t get remote credentials for deployment server xxx@xxx:xx password
沒(méi)填 sudo 的密碼,可以重新配,直接 SSH Interpreter → New server configuration
原文鏈接:https://xercis.blog.csdn.net/article/details/122682487
相關(guān)推薦
- 2022-07-28 詳解Python?Flask框架的安裝及應(yīng)用_python
- 2022-05-13 Missing essential plugin: org.jetbrains.androidPle
- 2024-02-28 自定義類(lèi)模擬BufferedReader的readLine()功能
- 2022-12-12 python?使用?with?open()?as?讀寫(xiě)文件的操作方法_python
- 2022-06-22 C語(yǔ)言樹(shù)與二叉樹(shù)基礎(chǔ)全刨析_C 語(yǔ)言
- 2022-07-24 .Net創(chuàng)建型設(shè)計(jì)模式之建造者、生成器模式(Builder)_基礎(chǔ)應(yīng)用
- 2022-10-06 react?路由權(quán)限動(dòng)態(tài)菜單方案配置react-router-auth-plus_React
- 2022-06-21 C語(yǔ)言程序的編譯與預(yù)處理基礎(chǔ)定義講解_C 語(yǔ)言
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支