# Opening up a custom port for SSH after install

**URL:** <https://discourse.mailinabox.email/t/opening-up-a-custom-port-for-ssh-after-install/55>\
**Category:** Help with Setup/Upgrade\
**Created:** [September 13, 2014, 11:36am UTC](https://discourse.mailinabox.email/t/opening-up-a-custom-port-for-ssh-after-install/55 "2014-09-13T11:36:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pryley](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/p/f14d63/32.png) [@pryley](https://discourse.mailinabox.email/u/pryley)\
**Post date:** [September 13, 2014, 11:36am UTC](https://discourse.mailinabox.email/t/opening-up-a-custom-port-for-ssh-after-install/55/1 "2014-09-13T11:36:27Z")

</div>

I use a custom port for SSH.

After installing Mail-in-a-Box I was no longer able to SSH into my server as the firewall was blocking the port.

Thankfully I’m using DigitalOcean and was able to use their virtual console to SSH into the server and `sudo ufw allow 1330; reload ssh` to reopen the port.

So if you are using a custom port to connect with SSH, make sure you open up the port after installing Mail-in-a-Box before you exit the session and close the terminal.

---

<div class="post-metadata">

**Author:** ![JoshData](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/joshdata/32/2153_2.png) [@JoshData](https://discourse.mailinabox.email/u/JoshData)\
**Post date:** [September 13, 2014, 12:33pm UTC](https://discourse.mailinabox.email/t/opening-up-a-custom-port-for-ssh-after-install/55/2 "2014-09-13T12:33:06Z")

</div>

Was this a Digital Ocean option or did you modify the box before starting the setup?

---

<div class="post-metadata">

**Author:** ![pryley](https://discourse.mailinabox.email/letter_avatar_proxy/v4/letter/p/f14d63/32.png) [@pryley](https://discourse.mailinabox.email/u/pryley)\
**Post date:** [September 13, 2014, 12:48pm UTC](https://discourse.mailinabox.email/t/opening-up-a-custom-port-for-ssh-after-install/55/3 "2014-09-13T12:48:30Z")

</div>

No I modified the box first.

The first thing I always do when spinning up a new droplet is to add a bit of security to the box:

```
adduser ubuntu
usermod -a -G www-data ubuntu

vi /etc/sudoers
	ubuntu ALL=(ALL:ALL) ALL

vi /etc/ssh/sshd_config
	Port 1330
	PermitRootLogin no
	PasswordAuthentication no
	UseDNS no

reload ssh
```

---

<div class="post-metadata">

**Author:** ![JoshData](https://discourse.mailinabox.email/user_avatar/discourse.mailinabox.email/joshdata/32/2153_2.png) [@JoshData](https://discourse.mailinabox.email/u/JoshData)\
**Post date:** [September 20, 2014, 12:27pm UTC](https://discourse.mailinabox.email/t/opening-up-a-custom-port-for-ssh-after-install/55/4 "2014-09-20T12:27:10Z")

</div>

Thanks. It should now automatically open that port too:

> <https://github.com/mail-in-a-box/mailinabox/commit/dd91553689b4a02d090800ef6bdbb658181f641f>
