From 824a9068e5d45714a6c984f7be7012873b56b5d4 Mon Sep 17 00:00:00 2001 From: Jing Hua Date: Thu, 2 Nov 2023 11:08:31 +0800 Subject: [PATCH] update readme --- README.md | 8 +------- SSH_SERVER_SETUP.md | 50 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 SSH_SERVER_SETUP.md diff --git a/README.md b/README.md index e4072f2..f969b68 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,7 @@ 3. Set up bridge for connecting to VM 1. Option 1: Install [xdotool](https://github.com/jordansissel/xdotool) on VM 2. Option 2: Install [mouse](https://github.com/boppreh/mouse/) -4. Set up SSH server on VM: https://averagelinuxuser.com/ssh-into-virtualbox/ - 1. `sudo apt install openssh-server` - 2. `sudo systemctl enable ssh --now` - 3. `sudo ufw disable` (disable firewall - safe for local network, otherwise `sudo ufw allow ssh`) - 4. `ip a` - find ip address - 5. ssh username@ - 6. On host, run `ssh-copy-id @` +4. Set up SSH server on VM | [Guide](./SSH_SERVER_SETUP.md) 5. Install screenshot tool (in vm) 1. `sudo apt install imagemagick-6.q16hdri` 2. `DISPLAY=:0 import -window root screenshot.png` diff --git a/SSH_SERVER_SETUP.md b/SSH_SERVER_SETUP.md new file mode 100644 index 0000000..83c5507 --- /dev/null +++ b/SSH_SERVER_SETUP.md @@ -0,0 +1,50 @@ +# SSH Server Setup Guide + +- [Linux](#linux) +- [Windows](#windows) + +## Linux + + + +1. `sudo apt install openssh-server` +2. `sudo systemctl enable ssh --now` +3. `sudo ufw disable` (disable firewall - safe for local network, otherwise `sudo ufw allow ssh`) +4. `ip a` - find ip address +5. ssh username@ +6. On host, run `ssh-copy-id @` + +## Windows + +To SSH into a Windows machine and control it using the terminal, you need to set up an SSH server on the Windows machine and then connect to it from an SSH client. Microsoft has integrated an OpenSSH server and client in Windows 10 and later, which makes this process more straightforward. Here's how you can do it: + +> Make sure that your windows account has a password + +### Setting Up SSH Server on Windows + +1. **Enable OpenSSH Server:** + + - Open **Settings** → **Apps** → **Optional Features**. + - Scan the list to see if OpenSSH Server is installed. If it's not, click on **Add a feature**, then find **OpenSSH Server**, and click **Install**. + +2. **Start the SSH Service:** + + - Open **Services** from the Start menu. + - Find the **OpenSSH SSH Server** service, right-click it, and select **Properties**. + - Set the startup type to **Automatic** and then start the service. + +3. **Configure the Firewall (if necessary):** + + - In most cases, Windows Firewall will automatically allow SSH connections. However, if you have a third-party firewall or if connections are being blocked, you may need to manually open port 22 (default SSH port). + +4. **Add ssh key to windows** + + - Add the public ssh key to `C:\ProgramData\ssh\administrators_authorized_keys` and `~/.ssh/authorized_keys` + +### Connecting to the Windows Machine from SSH Client + +1. **From a Linux/Mac Client:** + + - Open the terminal. + - Use the command `ssh username@windows-ip-address`. Replace `username` with the Windows account username and `windows-ip-address` with the IP address of the Windows machine. + - Accept the fingerprint (if it's the first time connecting) and enter the password when prompted.