This articles is published 541 days ago and last updated 541 days ago, some information may be out of date.
Synology DSM Customization: Unlocking the Potential of NAS
About
As you know, Synology NAS devices are based on the Linux kernel, but they have some function limitations that make installing applications not as easy as using package management systems likeapt
,yum
, ordnf
. Also, commands likeusermod
andgroupadd
don't actually exist on Synology NAS.
Sudo without Password (Option)
- Eable SSH on Synology
- Remove the need to enter a password each time
sudo
is used.
Log in to Synology DSM usingssh
with an account that hassudo
permissions.
sudo tee /etc/sudoers.d/$(USER) <<< '$(USER) ALL=(ALL) NOPASSWD: ALL'
$(USER) is the current username, which is up to you.
- Update the permission to read-only.
sudo chmod 400 /etc/sudoers.d/$(USER)
Install Entware on Synology DSM
Entware has been adapted for Synology's DSM as a software repository.
- Create a folder on your HDD
mkdir -p /volume1/@Entware/opt
- Remove
/opt
and mount the Optware folder.
Make sure that the/opt
folder is empty (Optware is not installed). Remove the/opt
folder with its contents in this step.
rm -rf /opt
mkdir /opt
mount -o bind "/volume1/@Entware/opt" /opt
Note: If the bind
command doesn't work, try creating a link instead:
ln -s /volume1/@Entware/opt/ /opt
- Run the installation script depending on the processor (
uname -m
to know).
for armv8 (aarch64) - Realtek RTD129x
wget -O - https://bin.entware.net/aarch64-k3.10/installer/generic.sh | /bin/sh
for armv5
wget -O - https://bin.entware.net/armv5sf-k3.2/installer/generic.sh | /bin/sh
wget -O - https://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
for x64
for armv7
wget -O - https://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
- Create Autostart Task
Create a triggered user-defined task in Task Scheduler.
Goto: DSM > Control Panel > Task Scheduler
Create > Triggered Task > User Defined Script
General
Task: Entware
User: root
Event: Boot-up
Pretask: none
Task Settings
Run Command: (as bellow)
#!/bin/sh
# Mount/Start Entware
mkdir -p /opt
mount -o bind "/volume1/@Entware/opt" /opt
/opt/etc/init.d/rc.unslung start
# Add Entware Profile in Global Profile
if grep -qF '/opt/etc/profile' /etc/profile; then
echo "Confirmed: Entware Profile in Global Profile"
else
echo "Adding: Entware Profile in Global Profile"
cat >> /etc/profile <<"EOF"
# Load Entware Profile
[ -r "/opt/etc/profile" ] && . /opt/etc/profile
EOF
fi
# Update Entware List
/opt/bin/opkg update
- Reboot your NAS.
Install Packages
Install all the packages through opkg
sudo opkg install git git-http wget curl tree iperf3
This installs Git, Git over HTTP, wget, curl, tree, and iperf3 packages using the opkg
package manager with superuser privileges.
Manage Docker Without Using Sudo
Manage Docker on Synology NAS viassh
without requiringsudo
.
- Create a new user group called
docker
.
sudo synogroup --add docker
- Add the user you want to use to this group
sudo synogroup --member docker $USER
- Change the ownership of the
docker.sock
file.
sudo chown root:docker /var/run/docker.sock
Once have completed these steps, log out and back in again to ensure the changes take effect.
Install VIM-PLUG on Synology DSM
- Download
plug.vim
and put it in the "autoload" directory.
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Add a vim-plug section to your
~/.vimrc
.
cat >> ~/.vimrc << EOF
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-commentary'
Plug 'scrooloose/nerdtree'
Plug 'joshdick/onedark.vim'
call plug#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Keyboard mapping to toggle the nerdtree file explorer.
nnoremap <F5> :exec 'NERDTreeToggle' <CR>
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax enable
" Set colorscheme
set background=dark
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Enable status bar color
set t_Co=256
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim Airline themes
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled=1
" Vim Cpp Highlight
let g:cpp_class_scope_highlight=1
let g:cpp_member_variable_highlight=1
let g:cpp_experimental_simple_template_highlight=1
let g:cpp_concepts_highlight=1
EOF
- Reload
.vimrc
and install plugins.
Open vi editor
:PlugInstall
Commands
Command | Description |
---|---|
PlugInstall [name ...] [#threads] | Install plugins |
PlugUpdate [name ...] [#threads] | Install or update plugins |
PlugClean[!] | Remove unlisted plugins (bang version will clean without prompt) |
PlugUpgrade | Upgrade vim-plug itself |
PlugStatus | Check the status of plugins |
PlugDiff | Examine changes from the previous update and the pending changes |
PlugSnapshot[!] [output path] | Generate script for restoring the current snapshot of the plugins |
Conclusion
Entware
, managing Docker without requiringsudo
, and installing packages usingopkg
. This is a useful for users looking to customize on Synology NAS devices.