Fixing bad ACL permission on my Synology NAS
The Issue
Yesterday, I created a new administrator account for my Synology NAS. For easier management, just like usual, I copied my SSH key into the NAS by calling the ssh-copy-id
command. Strangely, that didn’t work. And it kept asking me to enter my password every time I log in. This thing had never happened before.
The Diagnosis
Thankfully, I had another backup Synology NAS, which could be the control group for diagnosing. I tried to create a new administrator account on that machine and verified that this problem only happened to my current NAS.
I enabled the SSH verbose mode ssh -v
to connect both of my machines and compare their output. I immediately noticed the difference.
Problem NAS
1 | debug1: Next authentication method: publickey |
Healthy NAS
1 | debug1: Next authentication method: publickey |
Looks like the server didn’t accept my SSH key. But that should never happen as I double-checked the authorized_key
file on both of my NAS, as well as the file permissions and owner, which were identical.
I would like to check the server log as well. So I started an SSH debug server by calling sudo /bin/sshd -d -p 2222
to try to get the server log. At that time, I finally located the cause of this problem.
Problem NAS
1 | debug1: temporarily_use_uid: 1034/100 (e=0/0) |
Healthy NAS
1 | debug1: temporarily_use_uid: 1026/100 (e=0/0) |
So there were some problems with the ACL permissions. I did check my file permissions on the NAS web GUI, it seems normal and flawless.
During the research, I came across this article https://community.synology.com/enu/forum/17/post/111114, realizing that deleting an account could cause this issue. I did remove an unused admin user right before then. So I tried to call ls -el
through SSH to check my file permissions. Finally, The reason was clear. There was an unknown user!
1 | user1@Problem-NAS:~/.ssh$ ls -el |
1 | user@Healthy-NAS:~/.ssh$ ls -el |
Somehow this unknown user didn’t show up on the GUI. I can only confirm it through SSH. That’s why I didn’t notice it in the first place.
The Solution
Coming from the instinct of a Software Engineer, I believe I can fix this by resetting the permissions list. I don’t want to do that through SSH. Instead, I do that on the Synology Web UI.
- Go to the File Station. Right-click the
homes
shared folder. SelectProperties
. - Go to the Permission tab and click
Create
. Arbitrary choose a user and assign permissions. (e.g. I assignedTraverse folders/Execute files permission
for userEveryone
) - Click
Done
to save and exit thePermission Editor
window and clickSave
to exit theProperties
Window. - Enter the
Properties
window again. Delete the newly created permission and save.
Updating the permission list on the root shared folder will apply to all the containing files, as permissions are inherited by default.
For me, I have to repeat these steps on most of my shared folders as I also found the unknown user in other locations. I guess I messed up the ACL permissions sometime in the past.
Reference
https://community.synology.com/enu/forum/17/post/111114
https://kb.synology.com/en-uk/DSM/help/FileStation/privilege?version=7
https://community.synology.com/enu/forum/17/post/101650nu/forum/17/post/101650