Trong bài viết này chúng ta sẽ tìm hiểu về cách Copy Files giữa Windows và Server Linux.
Các ví dụ bên dưới mình sử dụng CentOS 7 làm server.
1. Thiết lập phía Server
- Update OS
sudo yum update
- Install OpenSSH
sudo yum –y install openssh-server
- Start OpenSSH
sudo systemctl start sshd
- Check Status
sudo systemctl status sshd
Kết quả như hình
- Enable OpenSSH
sudo systemctl enable sshd
2. Thiết lập phía Windows
Download PuTTY tại link: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
3. Tiến hành copy
- Copy Files từ Windows đến Server
Mở Terminal trên windows và chạy câu lệnh:
c:\pscp c:\folder\file.txt [email protected]:/home/folder/file.txt
Câu lệnh trên để copy file.txt nằm trong folder ổ C trên windows đến ip 123.456.7.89
- Copy Files từ Server về Windows
c:\pscp [email protected]:/home/folder/file.txt "C:\File"
- Ngoài ra để Copy một folder ta có thể thêm thuộc tính
-r
vào câu lệnh:
c:\pscp -r [email protected]:/home/folder "C:\File"
Vậy là xong. Done!