Rocky ssh

Perfect — installing and enabling SSH (OpenSSH) on your Rocky Linux 10 VM is the best and most reliable way to enable copy/paste and file transfer between your Hyper-V host and guest.

Here’s a step-by-step setup that will get SSH working quickly and securely 👇


🧩 Step 1: Install OpenSSH Server

Log into your Rocky Linux VM console and run:

sudo dnf install -y openssh-server

This installs both the SSH client and server components.


⚙️ Step 2: Enable and Start the SSH Service

Enable the SSH service to start on boot and launch it immediately:

sudo systemctl enable --now sshd

Verify it’s running:

sudo systemctl status sshd

You should see:

Active: active (running)

🔥 Step 3: Allow SSH Through the Firewall

Rocky Linux uses firewalld by default, so open port 22:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload

You can confirm with:

sudo firewall-cmd --list-all

🖥️ Step 4: Find the VM’s IP Address

Run:

ip addr show

Look for an interface like eth0 or ens33 — note the IP (e.g. 192.168.122.45).


💻 Step 5: Connect from Your Windows Host

On your Windows machine, open PowerShell or Command Prompt and connect:

ssh youruser@192.168.122.45

Replace youruser with your Rocky username and the IP with your VM’s.

You’ll be asked to accept the host fingerprint and enter your password.

✅ You can now copy & paste text into your SSH terminal using:

  • Ctrl + Shift + C / Ctrl + Shift + V in PowerShell
  • Right-click → Paste in Windows Terminal or PuTTY

📁 Step 6: Transfer Files Between Host and VM

You can use SCP or WinSCP for files.

From PowerShell:

scp C:\localfile.txt youruser@192.168.122.45:/home/youruser/

Or install WinSCP — drag-and-drop works perfectly and uses SSH under the hood.


🧠 Optional: Harden SSH

For better security:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo nano /etc/ssh/sshd_config

Then:

  • Change PermitRootLogin no
  • Ensure PasswordAuthentication yes (or use key-based auth later)
  • Restart SSH: sudo systemctl restart sshd

Summary

TaskCommand
Install SSHsudo dnf install -y openssh-server
Enable + Startsudo systemctl enable --now sshd
Allow in Firewallsudo firewall-cmd --permanent --add-service=ssh && sudo firewall-cmd --reload
Check IPip addr show
Connect from hostssh user@<vm-ip>
Copy filesscp file user@<vm-ip>:/path/

Would you like me to include setup for key-based SSH authentication (so you can connect and copy files without entering a password every time)?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top