# SSH in Your Container

{% hint style="warning" %}
Edgegap does not recommend having SSH service accessible in your production deployments.
{% endhint %}

### Modifying your Dockerfile

We will build the docker container using a different Docker `Dockerfile` in this version.

We will need to install the OpenSSH service and enable it Create a User and a password to connect to your server.

In a container running on **Alpine**, merge the following:

```dockerfile
RUN apk --update add --no-cache openssh bash
RUN sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config
RUN echo "tester:$ecureP@ss" | chpasswd

EXPOSE 22
```

In a container running on **Ubuntu**, add the following:

```dockerfile
RUN apt-get update
RUN apt-get install openssh-server sudo -y

RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000
RUN echo 'tester:$ecureP@ss' | chpasswd

EXPOSE 22
```

In your entrypoint, you will need to add the following command:

```sh
service ssh start
```

We suggest testing the deployment locally, using the docker run command to test the server start.

Once tested, you can push your new version on the container repository.

### On Edgegap

We suggest having a version called `-dev` or something that would make sense in your service. By doing so, you will have the option to do some tests and log into your container easily using the Edgegap infrastructure.

1. Create a new version of your app, adding the `Expose TCP Port 22`
2. Create a deployment using the new version you just created
3. Once you have the service running (Ready), look in your deployment information. You will see the external port mapping of port 22.
4. You can use Putty and connect using the FQDN of the deployment or Ip & the port mapping used
5. The username and password that you configured.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.edgegap.com/docs/tools-and-integrations/container/ssh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
