How to to securely transfer files or folders between two Manjaro PCs over SSH.
To transfer files or folders from one PC to another over SSH from scratch, you'll need to ensure both PCs are properly set up for SSH communication. Here’s a step-by-step guide to get you started, focusing on Manjaro Linux or similar distributions:
1. Install SSH (if not already installed)
First, ensure SSH is installed on both PCs. Manjaro usually comes with SSH pre-installed, but if it doesn't, you can install it using the package manager.
- Open a terminal.
- Update your package list:
sudo pacman -Syu
- Install the OpenSSH package:
sudo pacman -S openssh
2. Start and Enable SSH Service
After installing, you need to start and enable the SSH service to ensure it's running and will start automatically on boot.
- Start the SSH service:
sudo systemctl start sshd
- Enable the SSH service to start on boot:
sudo systemctl enable sshd
3. Configure SSH (Optional)
The default SSH configuration should work fine for most users, but you can customize settings by editing /etc/ssh/sshd_config
. For example, you might want to change the default SSH port (22) to enhance security.
- Edit the SSH configuration file (using
nano
or your preferred text editor):sudo nano /etc/ssh/sshd_config
- Make any desired changes, like altering the
Port
directive to change the SSH port. - Save the file and exit the editor.
- Restart the SSH service to apply changes:
sudo systemctl restart sshd
4. Check the IP Address and Username
You'll need the IP address and username for the remote PC to use scp
or rsync
.
- Find the username: Type
whoami
in the terminal. - Find the IP address: Type
ip addr
to see your IP address. Look for an entry underinet
beside your network interface.
5. Transfer Files or Folders
With SSH set up on both PCs, you can now use scp
or rsync
to transfer files or folders.
- Using
scp
to transfer a folder: Add ther
flag for recursive transfer.scp -r /path/to/local/folder username@remote_host:/path/to/remote/directory
- Using
rsync
for more detailed progress and efficiency:rsync -avzh --progress /path/to/local/folder username@remote_host:/path/to/remote/directory
Replace username@remote_host
with the actual username and IP address or hostname of the remote PC, and adjust the source and destination paths according to your needs.
6. Confirm Transfer
- For
scp
, use thev
flag for verbose output to see the transfer progress. - For
rsync
, the-progress
flag provides detailed progress information.
Security Considerations
- Firewall Settings: Ensure that any firewall on either PC allows connections on the SSH port (default 22, or whatever port you've configured).
- SSH Key Authentication: For added security, consider setting up SSH key-based authentication instead of using passwords.
- Regular Updates: Keep your SSH package and system updated for security patches.
Following these steps will enable you to securely transfer files or folders between two Manjaro PCs over SSH.