I ran into a frustrating situation with my Synology NAS running DSM 7: I was an administrator user who could log into the DSM web interface just fine, but couldn’t use sudo or su - via SSH. Every time I tried, it asked for a password and rejected it—even though I was using the correct admin credentials. I use cert for ssh so I never consider passwords even for this kind of (maintenance) work.
The root cause? I had somehow removed myself from the sudoers configuration while still maintaining admin privileges in DSM. This created a catch-22: I needed sudo access to fix sudo access.
DSM Task Scheduler to the Rescue
Since I couldn’t gain root access through the terminal, I used DSM’s Task Scheduler to run a one-time root command that restored my sudo privileges:
- Logged into DSM web interface (which still worked fine)
- Navigated to Control Panel → Task Scheduler
- Created a new Scheduled Task → User-defined script with these settings:
- User: root (the key detail!)
- Script:
echo "myusername ALL=(ALL) ALL" >> /etc/sudoers
- Ran the task manually (right-click → Run)
- Tested SSH again –
sudo -inow worked perfectly!
On Synology DSM 7, DSM admin privileges and sudo privileges are separate things. You can be locked out of one while maintaining the other. Fortunately, the Task Scheduler running as root provides a backdoor to fix broken sudo configurations without needing terminal root access.
If you find yourself in this situation, remember: the DSM web interface is your friend, and Task Scheduler can execute root commands even when you’re locked out of sudo via SSH.