# File Transfer Between Machines-Users

**To transfer files between Machines and Users:**

✔️ All RUAI machines are based on Ubuntu OS. When transferring files between your local computer and a rented machine, **you need to use the terminal.**

✔️ This guide covers the usage of `scp` and `croc`.

***

## 1. Using SCP for File Transfer

### 1. Windows (Local Computer) ↔︎ Ubuntu (Remote Machine)&#x20;

<mark style="background-color:blue;">**Windows (Local Computer) → Ubuntu (Remote Machine)**</mark>&#x20;

✔️ For Windows 10, ensure that the OpenSSH Client is enabled.

* Navigate to **\[Settings] → \[Apps & Features] → \[Optional Features]** to verify if OpenSSH is installed.

✔️ Then, open a terminal (CMD) or PowerShell and use the `scp` command to transfer files or directories to the remote destination.

* The format for sending is as follows:

```
scp -P [machine development environment port] [path of file to send (can be dragged and dropped)] [username]@machine.runyour.ai:[remote machine storage path]
```

-To fill in the \[] placeholders, click the \[Open Development Environment] button on the rented machine to retrieve SSH connection information.

<figure><img src="/files/ub9ejEBSWMhIHf0PpAsC" alt=""><figcaption></figcaption></figure>

* When sending a file:

```
scp -P 30002 C:\image\image.zip ruai@machine.runyour.ai:/home/ruai
```

* When sending a folder:

```
scp -r -P 30002 C:\image\image.zip ruai@machine.runyour.ai:/home/ruai
```

<mark style="background-color:blue;">**Ubuntu (remote machine) -> Windows (local computer)**</mark>

✔️To retrieve files or folders from a remote machine to your own computer, simply reverse the command.

* Format for sending

```
scp -P [remote machine port] [username]@machine.runyour.ai:[remote file or folder path] [location to save on your computer]
```

* When retrieving a file:

```
scp -P 30002 ruai@machine.runyour.ai:/home/ruai/image.zip C:\image
```

* When retrieving a folder:

```
scp -r -P 30002 ruai@machine.runyour.ai:/home/ruai/image.zip C:\image
```

### 2. mac OS(My Computer)  ↔︎ **Ubuntu (remote machine)**

Check the development environment before file transfer.

<figure><img src="/files/ub9ejEBSWMhIHf0PpAsC" alt=""><figcaption></figcaption></figure>

<mark style="background-color:blue;">**macOS (local computer) → Ubuntu (remote machine)**</mark>

* Format for sending:

```
scp -P [remote machine port] [path of the file to send (drag and drop to display the path)] [username]@machine.runyour.ai:[remote machine destination path]
```

* Example for sending a file:

```
scp -P 30002 /Document/image/image.zip ruai@machine.runyour.ai:/home/ruai
```

* Example for sending a folder:

```
scp -r -P 30002 /Document/image/image.zip ruai@machine.runyour.ai:/home/ruai
```

<mark style="background-color:blue;">**Ubuntu (remote machine) → macOS (local computer)**</mark>

* Format for sending:

```
scp -P [remote machine port] [username]@machine.runyour.ai:[remote file or folder path] [location to save on your computer]
```

* Example for retrieving a file:

```
scp -P 30002 ruai@machine.runyour.ai:/home/ruai/image.zip /Document/image
```

* Example for retrieving a folder:

```
scp -r -P 30002 ruai@machine.runyour.ai:/home/ruai/image.zip /Document/image
```

***

## 2. Croc CLI Tool for File Transfer

Croc is a CLI-based tool for easily transferring data between two computers.&#x20;

It utilizes relay for data transfer and applies end-to-end encryption.

It supports cross-platform compatibility (Windows, Linux, macOS) and allows for multi-file transfers.

### 1. Installation

<mark style="background-color:green;">**Unix**</mark>&#x20;

Open a terminal and run the following command to install:

```
nix-env -i croc
```

#### <mark style="background-color:green;">Ubuntu</mark>

Open a terminal and run the following command to install:

```
wget https://github.com/schollz/croc/releases/download/v10.0.10/croc_v10.0.13_Linux-64bit.tar.gz
tar -xvf croc_v10.0.13_Linux-64bit.tar.gz
cp ./croc /usr/local/bin
```

<mark style="background-color:green;">**macOS (requires Homebrew)**</mark>&#x20;

Open a terminal and run the following command to install:

```
brew install croc
```

<mark style="background-color:green;">**Windows (requires scoop, choco, or winget)**</mark>&#x20;

For this guide, we'll use scoop for installation. First, run Windows PowerShell as an administrator and execute the following two commands sequentially to install scoop:

```
1 // Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

2 // Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
```

Then proceed to install croc:

<pre><code><strong>1 // # If using scoop
</strong>2 // scoop install croc
3 // 
4 // # If using choco
5 // choco install croc
6 // 
7 // # If using winget
8 // winget install schollz.croc
</code></pre>

### 2. How to Use

Open a terminal and connect to the remote machine.

Both the sender and receiver should open their terminals and execute the following commands based on their roles.

<mark style="background-color:green;">**Sending a File**</mark>

```
croc send [path to the file to be sent (you can set the path by dragging and dropping the file)]
```

Executing the above command will display a generated code in the terminal:&#x20;

```
Code is : [code]
```

The recipient should enter this **code** to receive the file.

<mark style="background-color:green;">**Receiving a File**</mark>

```
croc [code generated when sending the file]
```

Enter the code generated during the file transmission to receive the file.

<mark style="background-color:green;">**Example**</mark>

**Sender** **- Sending a file** (execute from your local computer or remote machine's terminal)

```
1 // > croc send C:\image\image.zip
2 // Sending 'image.zip' (25182 B)
3 // # Code is generated.
4 // Code is: 0406-milk-parker-small
5 // On the other computer run
```

**Receiver** **- Retrieving a file** (execute from your local computer or remote machine's terminal)

```
1 // > taster@machine-runyourai-1:~$ croc 0406-milk-parker-small
2 // Accept 'image.zip' (25182 B)? (Y/n) // Press Enter
3 //
4 // ...
5 // image.zip 100% |████████████████████|
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://runyourai.gitbook.io/eng-runyourai/tutorial/file-transfer-between-machines-users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
