Step 1: Connect the Ethernet Cable
- Use a standard Ethernet cable to connect the two machines.
- Modern computers don’t require a crossover cable, as most Ethernet ports auto-detect the connection type.
Step 2: Configure IP Addresses
You need to assign static IP addresses to both machines so they can communicate.
On Linux:
-
Open a terminal.
-
Use the following commands to set a static IP address:
sudo ip addr add 192.168.1.1/24 dev eth0 sudo ip link set eth0 up
-
Replace
eth0
with the correct interface name for your Ethernet adapter. You can find it using:ip link
On macOS:
- Go to System Preferences > Network.
- Select Ethernet in the left sidebar.
- Set Configure IPv4 to Manually.
- Enter the following:
- IP Address:
192.168.1.2
- Subnet Mask:
255.255.255.0
- IP Address:
- Click Apply.
Using HTTP Server
Step 3: Use Python’s HTTP Server on Linux
Linux typically has Python pre-installed, which can be used to create a simple HTTP server.
Steps:
On the Linux Machine:
- Open a terminal.
- Navigate to the directory containing the files you want to share:
cd /path/to/share
- Start a Python HTTP server:
python3 -m http.server 8000
- This will make the directory accessible via HTTP on port
8000
.
On the macOS Machine:
- Open a web browser.
- Enter the Linux machine’s IP address and port:
- Browse and download the files directly from the browser.
Using ssh-server
Step 3: Enable File Sharing
On Linux:
-
Install and configure an SSH server to enable file transfers:
sudo apt update sudo apt install openssh-server sudo systemctl start ssh
-
Note the username of the Linux system (you’ll need it later).
On macOS:
No additional setup is required, as macOS has SSH and SCP (Secure Copy Protocol) built-in.
Step 4: Transfer Files
You can transfer files using the scp
command.
From macOS to Linux:
-
Open Terminal on the Mac.
-
Run the command:
scp /path/to/file username@192.168.1.1:/destination/path
- Replace
/path/to/file
with the file you want to transfer. - Replace
username
with the Linux username. - Replace
/destination/path
with the target directory on the Linux machine.
- Replace
From Linux to macOS:
-
Run this command on the Linux machine:
scp /path/to/file username@192.168.1.2:/destination/path
- Replace
username
with your macOS username.
- Replace
Step 5: Verify the Transfer
Check the destination folder on the target machine to ensure the files were transferred successfully.