# 3.1 File transfer with SSH

We've already installed openssh-server on your VMs. Therefore, you can copy your files to your VM through SSH using the following command on your own PC:

```
ssh -p <port_number> student@projgw.cse.cuhk.edu.hk
```

where `port_number` should be 13000 + your machine number. e.g. if you have 30a machine, the port should be 13030.

You can exit by `crtl+d` .

You may be prompted with "Are you sure you want to continue connecting (yes/no/\[fingerprint])? ye&#x73;**"**. Just type "yes" and then input your password to login.

Similarly, you can use  `scp` to transfer files between VM and your local PC.

Transfer the file from local to remote:

```
scp -P <port_number> user@hostname:\folder\filename student@projgw.cse.cuhk.edu.hk:c:\folder\filname
```

From remote to local:

```
scp -P <port_number> student@projgw.cse.cuhk.edu.hk:c:\folder\filname user@hostname:\folder\filename
```

where `user@hostname` is your local PC.

If you want to transfer a folder, you may need to add `-r` after the `scp`.

For more information about the `scp` , you can check `man scp` or online [materials](https://www.geeksforgeeks.org/scp-command-in-linux-with-examples/).
