# Ssh Quick Guide

SSH tools in 3D printers are primarily used for the following operations that cannot be performed via the web interface:

1. **Modify system configurations**: Directly edit configuration files or make system settings.
2. **Install software and plugins**: Install and update software via the command line.
3. **View logs and error messages**: Access system logs to troubleshoot issues.
4. **Remote troubleshooting**: Debug issues that cannot be resolved through the web interface.

These operations typically require SSH access, which cannot be accomplished through the web interface.

***

#### A Detailed Guide on SSH Login and Usage for 3D Printers

**1. Install an SSH Client**

* **Windows**:
  * **PuTTY**: PuTTY is a popular SSH client for Windows. Download it [here](https://www.putty.org/).
* **macOS/Linux**:
  * These systems come with an SSH client pre-installed. You can use the `ssh` command directly from the terminal.

**2. Obtain the 3D Printer's IP Address**

Most 3D printers automatically receive an IP address when connected to the local network. You can find this IP address by:

* Checking the network settings on the printer’s control panel or display.
* Logging into your router’s management interface to view the list of connected devices and find the printer’s IP address.

**3. Common SSH Commands**

* Open PuTTY.
* In the "Host Name (or IP address)" field, enter the IP address or hostname of your 3D printer in the format `<user>@<host>`. For example, fly`@192.168.50.87`
* Click the "Open" button.

**PuTTY Security Alert**:

* Since this is your first time connecting, you may see a security warning. It is generally safe to click "Accept" to proceed.
* When prompted, enter your password. It is normal for no characters to appear as you type (Linux systems hide passwords completely).
* password is: `mellow`

Once logged into the 3D printer, use the following commands:

* **Navigate Directories**:
  * `ls`: List files and directories in the current directory.
  * `cd /path/to/directory`: Change to a specified directory. For example, `cd /home/pi` switches to `/home/pi`.
* **View and Edit Files**:
  * `cat filename`: Display the contents of a file. For example, `cat config.txt` shows the file’s content.
  * `nano filename`: Edit a file using the `nano` editor. For example, `nano config.txt` opens `config.txt` in `nano`.
  * `vim filename`: Edit a file using the `vim` editor. For example, `vim config.txt` opens `config.txt` in `vim`.
* **File Transfer**:
  * Use SCP to upload files from your local computer to the 3D printer:

    ```bash
    scp /path/to/local/file username@printer_ip_address:/path/to/destination/
    ```

    This command uploads a local file to the specified directory on the printer.
* **Control the 3D Printer**:
  * Reboot the printer:

    ```bash
    sudo reboot
    ```
  * Shut down the printer:

    ```bash
    sudo shutdown now
    ```
* **Monitor and Troubleshoot**:
  * `top`: View real-time system resource usage, including CPU and memory.
  * `tail -f /path/to/logfile`: View log file updates in real-time. For example:

    ```bash
    tail -f /var/log/octoprint.log
    ```

    This command displays the OctoPrint log in real-time.

**4. Exit the SSH Session**

When finished, exit the SSH session with:

```bash
exit
```

Or press `Ctrl + D` to close the session.
