File Transfer Between Machines-Users

Guide to Easy File Transfer!

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)

Windows (Local Computer) β†’ Ubuntu (Remote Machine)

βœ”οΈ 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.

  • 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

Ubuntu (remote machine) -> Windows (local computer)

βœ”οΈ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.

macOS (local computer) β†’ Ubuntu (remote machine)

  • 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

Ubuntu (remote machine) β†’ macOS (local computer)

  • 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.

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

Unix

Open a terminal and run the following command to install:

nix-env -i croc

Ubuntu

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

macOS (requires Homebrew)

Open a terminal and run the following command to install:

brew install croc

Windows (requires scoop, choco, or winget)

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:

1 // # If using scoop
2 // scoop install croc
3 // 
4 // # If using choco
5 // choco install croc
6 // 
7 // # If using winget
8 // winget install schollz.croc

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.

Sending a File

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:

Code is : [code]

The recipient should enter this code to receive the file.

Receiving a File

croc [code generated when sending the file]

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

Example

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% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ|

Last updated