update readme

This commit is contained in:
Jing Hua
2023-11-02 11:08:31 +08:00
parent a3706004d0
commit 824a9068e5
2 changed files with 51 additions and 7 deletions

View File

@@ -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@<ip_address>
6. On host, run `ssh-copy-id <username>@<ip_address>`
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`

50
SSH_SERVER_SETUP.md Normal file
View File

@@ -0,0 +1,50 @@
# SSH Server Setup Guide
- [Linux](#linux)
- [Windows](#windows)
## Linux
<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@<ip_address>
6. On host, run `ssh-copy-id <username>@<ip_address>`
## 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.