> For the complete documentation index, see [llms.txt](https://docs.strongdm.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.strongdm.com/users/connect/local-port-management.md).

# Local Port Management

Local port management allows you to assign custom ports to resources from the CLI. When set, custom ports assigned to resources override the ports defined for those resources in the Admin UI's [Port Overrides](https://docs.strongdm.com/admin/resources/port-overrides.md) section. Custom ports stay assigned to a given resource until they are specifically removed.

{% hint style="warning" %}
The **Auto-Connect Service Accounts** setting (**Settings** > **Security**) is not compatible with local custom ports. Service accounts do not auto-connect as expected when the datasources in question have been assigned custom ports.
{% endhint %}

### Override Local Port Override for a Single Resource

To assign a custom port for a single resource, use the following command:

```shell
sdm connect "<RESOURCE_NAME>" <PORT_VALUE>
```

For example:

```shell
sdm connect "server1" 6543
```

You can run `sdm status "<RESOURCE_NAME>"` to verify that the port is set, like so:

```shell
sdm status "server1"
```

A successful connection returns the resource name, connection status, and port override value, as in the following example.

```shell
     SERVER           STATUS              PORT OVERRIDE       
     server1          connected           6543
```

### Remove Local Port Override for Single Resource

To remove a custom port that was assigned to a resource, use the following command:

```shell
sdm disconnect "<RESOURCE_NAME>" --delete
```

For example:

```shell
sdm disconnect "server1" --delete
```

You can run `sdm status "<RESOURCE_NAME>"` to verify that the local port override was removed, like so:

```shell
sdm status "server1"
```

A successful disconnection returns the resource name, connection status, and original port override value, as in the following example.

```shell
     SERVER           STATUS              PORT OVERRIDE       
     server1          disconnected        18444
```

### Remove Local Port Override for All Resources

To remove custom ports assigned to all resources, use the following command:

```shell
sdm disconnect --delete --all
```

Run `sdm status` to verify any local port overrides are disconnected.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.strongdm.com/users/connect/local-port-management.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
