使用scp從windows拷貝文件到linux
1、先安裝ssh服務
linux默認未安裝ssh服務,第一次使用前需在linux執行以下命令安裝:
1、先安裝ssh服務
linux默認未安裝ssh服務,第一次使用前需在linux執行以下命令安裝:
sudo apt install openssh-server
2、從本地 Windows 拷貝文件到遠程 Linux:
windows11已帶scp命令
scp C:\Users\YourName\document.txt username@192.168.1.100:/home/username/documents/
3、從遠程 Linux 拷貝文件到本地 Windows:
下面的命令在windows終端執行:
scp username@192.168.1.100:/var/log/syslog C:\Users\YourName\Desktop\
4、拷貝整個目錄(使用 -r 遞歸參數):
scp -r C:\Users\YourName\project_folder username@192.168.1.100:/home/username/
注:
檢查是否存在ssh服務
# 檢查 sshd 服務是否正在運行
systemctl status sshd
# 或者(取決于發行版)
systemctl status ssh
如Active顯示為active說明ssh服務已啟動。

浙公網安備 33010602011771號