top of page
Search
sob3f7stu

Enable SSH Access On A Synology: The Benefits And Risks



Update september 2019: Thanks to "bogd" in the comments to point out Public Key Authentication is enabled by default even if the settings are commented out in sshd_config. So you should be able to skip this and jump to "Generate an SSH Key"




Enable SSH Access On A Synology



Warning: If you plan on accessing your Synology over the internet, instead of just over the network, I suggest you also enable autoblock once you are finished with this tutorial. I experience more than 1000 sign in attempts from unknown sources, per day.


You will now generate a private and a public key on the local Synology. Later on we will copy the public key to the remote device. The private key should never leave the local device. If someone gets hold of your private key, they can access the remote device.


Because a person with SSH access can do a lot of damage on a linux based system, SSH is very careful with the rights on SSH keys by default. As a security mechanism, SSH will not work without the correct rights assigned.


In this article we will show you how to easily provide private remote access to your Synology NAS drive without needing to open ports or setup a VPN server, darkening your network to third parties by installing Enclave.


If you have opened administrative access ports on your Synology NAS drive to the public Internet (default ports are 5000, 5001 and 22 for SSH) you should re-consider if they really need to be open and close those ports if not. They are the default HTTP and HTTPS web server ports for Synology DSM and allow access to the administration console.


First, you'll need to enable SSH access to your Synology NAS drive. For Enclave to create a virtual network interface, we'll need to ensure that the tun kernel module is installed and enabled on the device. We do this by enabling and connecting into the device via SSH. Open the Control Panel, navigate to Terminal & SNMP and enable the SSH service.


Now create a scheduled task to run this script on start-up: Log in to your Synology NAS drive web interface, go to Control Panel > Task Scheduler and create a new User-defined script as a Triggered Task. Name the task Enable TUN, set the user to be root and the event as Boot-up. Then, in the Task Settings tab enter bash /volume1/enable-tun.sh as the User-defined script and hit OK. To test if the script works, after restarting your NAS log back into SSH and run lsmod grep -w tun to check that the TUN module was successfully re-loaded.


Now we are ready to setup the Enclave container. First, give the container a name, we've used enclave. Also need to be sure to check Execute container using high privilege, this causes DSM to pass the --privileged to Docker, which effectively enables the container to request --cap-add NET_ADMIN (Perform various network-related operations) and --device /dev/net/tun (Allows devices to run inside the container).


Now you've added some connections, be sure to check the DNS forwarding is enabled on any peers which you're connected to so they can access your Synology NAS drive using a friendly DNS hostname like diskstation.enclave.


An alternative to the recommended approach of installing Tailscale from the Synology Package Centeris to install Tailscale using a downloadable Synology package (SPK). A reason you might want to install from an SPK is toaccess new Tailscale features that are not yet released in the Tailscale version that is available from the SynologyPackage Center.


In General Settings, enter a task name, select root as the user that the task will runfor, and select Boot-up as the event that triggers the task. Ensure the task is enabled.


The firewall is disabled by default.However, if you have it enabled, add an exception for the Tailscale subnet, 100.64.0.0/10.In Main menu > Control Panel > Security > Firewall, add a firewall rule in the default profile that allows traffic from the source IP subnet 100.64.0.0 with subnet mask 255.192.0.0.


I already activated ssh in the synology settings but it seems that only the root admin can sonnect to the server using ssh.All solutions involving mount nfs or mount.cifgs are unsuitable because one need root priviledges to execute them and we cannot give root access to all our employees.


Assign NFS Permissions to Shared Folders Before accessing any shared folders with your NFS client, you must first configure the NFS permissions of the shared folder you wish to access. The steps below will guide you through the process of changing NFS permissions of the shared folders on your Synology NAS.


Change the login shell for those users that you want to be able to login via ssh according to -re-enable-scpssh-login-on-synology-dsm-6-0-for-non-admin-users.html. As these settings might be overwritten by the DSM, it is best to login to the NAS as root, and create a script with the following content:


The operating system of a Synology NAS, DiskStation Manager, is a great web-based GUI making it easy for everyone to manage their NAS. However, sometimes it's preferable to access the NAS through SSH instead of the GUI. Logging in with password is fairly simple to activate but in the long run it's often better to use key authorization instead of having to type your (long and secure) password each time.


Because we are using our self-created user(s) for accessing the NAS instead of the admin we need to enable a way to connect the generated key to a user. One way of doing this is enabling the homes for our DSM users, this way each one will have their own "personal space" where we can save user specific files, just like in a normal Linux installation. Enable them under Control Panel > User & Group > User Home.


This will create new shared folders for each of the users in DSM (except the guest user). As default the permissions of the home directories are way too open for storing and managing ssh keys, so we need to restrict them to only allow access for their respective owners.


In the next step we bind mount to the host's /var/lib/zerotier-one created above in order to store ZeroTier's identity. This is not guaranteed to survive DSM updates. I would suggest placing this on an automatically-mounted volume where your other private user data resides. The location you choose to store your identities should be kept secure and never placed on a shared volume that others can access.


Why do you really want to SSH directly into the container? If you can access the host, you can enter the container using docker exec. Never install SSH in a container unless it is really necessary, which usually is not.


The current windows 10 (Version 1803 (OS Build 17134.1)) has SSH built in. With that, just enable SSH from the Control Panel, Terminal & SNMP, be sure you are using an account in the Administrator's group, and you're all set.


ive started hosting a lot of server this week for customer so i might as well get those added to Librenms too, but right now im doing it on an IP address level, which will get confusing once i get added a ton of devices the host synology can ping dns names without a sweat but apparantly the bridge thing here is messing with me again


This setup allows you to access your Synology without using a password by using the SSH Key instead. You can add a passphrase if you would like for added security, but then you will have to enter the passphrase each time you access your NAS. I am not too worried about leaving the passphrase blank here because we are going to be working locally instead of over the internet. You will want to add a passphrase if you are going to be working over the internet.


One of my favourite things about Git is how easy it is to turn any old serverinto a remote for collaboration & backup. Sure there are fully-fledged Git webservices that manage projects, user access, pull requests etc, and these are amust for larger teams.


If creating projects and giving access to users like this bothers you, you mightwant to try Gitolite as a thin layer above this(you control projects and users via a master repo). Personally I need to do thisinfrequently enough that I prefer the directness of the vanilla approach.


I rsync data to my hot backup NAS (which is set up identically)so that in the event of non-disk failure we still have an accessible server.Offsite backup is similarly exactly the same as any other file system.


Once everything has been installed (it could take some time the first go around), you should be able to access Home Assistant at the IP address of your NAS. For example, my NAS is at 192.168.1.3, so I can access Home Assistant by going to :8123. The last part of the address tells the browser to connect to port 8123, which Home Assistant listens to.


First thanks for the great howto. I experience a strange behavior though with zwave. After about 24 hours zwave becomes unavailable. If i restart hass it wont come up and if i then restart the docker Container, all is good again for 24h. Maybe i need to restart docker from synology every 24h?Thanks for your helps.


Among the third-party packages supported on Synology NAS, there is an open source database system MariaDB that can be installed and used, but after the installation is complete, the default is remote that cannot be accessed remotely. This article simply records how to configure remote access in the local area network.


After a while the build might fail with the following error: Error CTC1001 Volume sharing is not enabled. On the Settings screen in Docker Desktop, click Shared Drives, and select the drive(s) containing your project files.


(Note: If you enable both SSH and home folder service, you can drop your SSH key into your home folder at /.ssh/authorized_keys. Just make sure that folder and its children are chmodded to 755, i.e. chmod 755 /var/services/homes/my-nas-user)


=73064 -scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server -up-git-on-a-nas-with-synologys-official-package -git-on-a-synology-nas.html -the-uri-url-for-a-remote-git-repository 2ff7e9595c


1 view0 comments

Recent Posts

See All

Opmerkingen


bottom of page