> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/general/virtualization/transfer-files-from-windows-to-ubuntu-vm.md).

# Transfer files from Windows to Linux VM

Need to copy a file from a windows hope to a linux vm? We got you!

## Setup Linux

### Ubuntu

First, install Openssh on the vm:

```bash
sudo apt-get install openssh-server openssh-client
```

### RHEL

Install the SSH server package `openssh` by using the `dnf` commands

```bash
# Install Package
sudo dnf install openssh-server

# Start the sshd daemon and set to start after reboot
sudo systemctl start sshd
sudo systemctl enable sshd

# Confirm that the sshd daemon is up and running:
sudo systemctl status sshd

# Open the SSH port 22 to allow incoming traffic:
sudo firewall-cmd --zone=public --permanent --add-service=ssh
sudo firewall-cmd --reload

# Optionally, locate the SSH server man config file /etc/ssh/sshd_config and perform custom configuration.
# Every time you make any change to the /etc/ssh/sshd_config configuration file reload the sshd service to apply changes:
sudo systemctl reload sshd
```

***

### &#x20;Setup Windows

### Install WinSCP from <https://winscp.net/downloads.php>

Get the IP of Linux VM:

```bash
ifconfig
```

<figure><img src="https://1889614651-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYLrtG_g25xt3AUhomb%2Fuploads%2FFocNqTnkIODktzSpYCqL%2Fimage.png?alt=media&amp;token=690e11ee-f153-4363-a659-de875414b07d" alt=""><figcaption></figcaption></figure>

Launch WinSCP, and setup the necessary details of the HostName = IP, username, pass

<figure><img src="https://1889614651-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYLrtG_g25xt3AUhomb%2Fuploads%2Fs8WcLCNTTEVcaUMGhfNF%2Fimage.png?alt=media&amp;token=d594f7c3-93e6-458b-8258-92900c9c1584" alt=""><figcaption></figcaption></figure>

Accept the ssh key

<figure><img src="https://1889614651-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYLrtG_g25xt3AUhomb%2Fuploads%2FB5v5CWvEypIwGD60J7jV%2Fimage.png?alt=media&amp;token=2ed787d1-edc3-423c-9378-efe52f26fcd7" alt=""><figcaption></figcaption></figure>

Navigate, Drag & Drop

<figure><img src="https://1889614651-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYLrtG_g25xt3AUhomb%2Fuploads%2F8MRGCxLpAHAPoVo4gZB9%2Fimage.png?alt=media&amp;token=a5140a81-5769-4e43-8dd9-1dc4d9fbfa5e" alt=""><figcaption></figcaption></figure>
