Note: I recently purchased a Synology DiskStation DS411j & I’m putting up posts about things I figure out. This is part of that series.

In a previous post—SSH into your Synology DiskStation with SSH Keys—I covered how to log in to your DiskStation using SSH keys instead of a password. Then I told you how to change the default port SSH uses in order to add an additional layer of obfuscation. Once you’ve done all that, you can enter this on the command line of your computer to SSH to your DiskStation:

$ ssh admin@IP:PORT

Like this:

$ ssh admin@192.168.1.200:12345

However, I’m lazy. Let’s make this easier & definitely quicker.

Edit ~/.ssh/config on your local machine & add the following lines:

# YourNAS (Synology DS411j)
Host mynas
HostName 192.168.1.200
Port 12345
User admin

Save the file (I’ll explain what it means in a moment) & then you can SSH in to your Synology DiskStation like this:

$ ssh mynas

And you’re in! You don’t have to specify a user, an IP address, or port. Muuuuch easier!

Here’s what the file means:

  • # YourNAS (Synology DS411j): A commented line that describes the machine to which you’re SSHing in to
  • Host mynas: The name you want to use as the name for your server. Whatever you specify here is what you put after the ssh on the command line.
  • HostName 192.168.1.200: The IP address of your Synology DiskStation; if you want to use this file to access your NAS over the Internet, you could instead specify a domain name.
  • Port 12345: The port number for your Synology DiskStation (you learned how to specify the port number in Change the SSH port you use to log in to a Synology DiskStation)
  • User admin: The username you’re using to log in.

You can have as many entries as you’d like in your config file, one for each server, or each login to each server. Using an SSH config file is the way to go if you want to make your life easier. Try it—you will definitely like it.