1. 程式人生 > >利用ssh傳輸文件-服務器之間傳輸文件

利用ssh傳輸文件-服務器之間傳輸文件

password rman tor 從服務器 rep ecdsa war may activiti

在linux下一般用scp這個命令來通過ssh傳輸文件。

1、從服務器上下載文件
scp username@servername:/path/filename /var/www/local_dir(本地目錄)

例如scp [email protected]:/var/www/test.txt 把192.168.0.101上的/var/www/test.txt 的文件下載到/var/www/local_dir(本地目錄)

2、上傳本地文件到服務器
scp /path/filename username@servername:/path

例如scp /var/www/test.php [email protected]:/var/www/ 把本機/var/www/目錄下的test.php文件上傳到192.168.0.101這臺服務器上的/var/www/目錄中

3、從服務器下載整個目錄
scp -r username@servername:/var/www/remote_dir/(遠程目錄) /var/www/local_dir(本地目錄)

例如:scp -r [email protected]:/var/www/test /var/www/

4、上傳目錄到服務器
scp -r local_dir username@servername:remote_dir
例如:scp -r test [email protected]:/var/www/ 把當前目錄下的test目錄上傳到服務器的/var/www/ 目錄

實踐:

[root@localhost home]# scp -r root@255.255
.255.255:/home/remote /home/local The authenticity of host 255.255.255.255 (255.255.255.255) cant be established. ECDSA key fingerprint is SHA256:53QDqcS8qtxst2SbSc1OfqfEknmi4WcFBdPCq41aNLQ. ECDSA key fingerprint is MD5:25:fa:25:22:39:e5:72:88:1e:2f:64:5d:fa:ac:df:2c. Are you sure you want to continue
connecting (yes/no)? yes Warning: Permanently added 255.255.255.255 (ECDSA) to the list of known hosts. Authorized users only. All activities may be monitored and reported. Password: // 輸入遠程服務器255.255.255.255的密碼即可

註:目標服務器要開啟寫入權限。

利用ssh傳輸文件-服務器之間傳輸文件