24

After some automatic updates (or being hacked?) I have many things broken and a huge problem to resolve them since I can't login as root anymore.

  • ssh admin: login success
  • su root: permission denied (probably not the same password)

What I have tried:

  • read log: but permission denied
  • use 'synopass' and empty password: failed
  • use synouser: permission denied
  • change password of admin hoping it will update the root password: failed.
  • check the root user in /etc/passwd: he is ok (with ash)
  • restart all the server: failed

I have no idea what is going on. Any advice?

2
  • sudo su works and solve the problem but the situation is not clear. Mar 27, 2016 at 12:46
  • In /etc/shadow we can see "root:*:" so I suppose we can't login in root directly anymore and we have to use sudo. DSM release notes just speak about ssh but... ok ^^ Apr 4, 2016 at 5:46

5 Answers 5

17

Your Synology probably upgraded to DSM6, in which security has been hardened... In DSM6 you can no longer use root for SSH, but you can use any other member account of the administrators group. Mind that you now need to sudo when logged in using SSH.

See the DSM6 release notes!

2
  • 1
    I knew that we could not ssh as root (I checked the ssh conf). What I don't understand is why we can't "su root" ? I mean, we can, but the root password is not the same as admin anymore and I have no idea what it is. Mar 29, 2016 at 13:50
  • This answer has the reason and will be complete if merged with @JulienGrimal answer that has the solution. Also, the "See release notes" statement will be great if it's linked.
    – gmo
    Jan 8, 2017 at 19:09
32

If your synology is in DSM6 and you're logged with a user part of administrator group, you can do :

sudo -i

enter your root/admin password

or even sudo su - (it works to)

now you're root tadaaa

3
8

In DSM Version 6 you can still login as root when using RSA keys. Therefore just copy your public key as admin to your Synolgy:

$ cat ~/.ssh/id_rsa.pub | ssh admin@192.168.1.10 'umask 077; cat >>/tmp/authorized_keys'

After that login to your Synology as admin and become root:

$ ssh admin@192.168.1.10
admin@192.168.1.10's password:
admin@My-Synology:/$ sudo -i
Password: 

No create the .ssh directory for root, move your key and change the owner of that file:

root@My-Synology:~# mkdir -m0700 /root/.ssh
root@My-Synology:~# mv /tmp/authorized_keys /root/.ssh/
root@My-Synology:~# chown root:root /root/.ssh/authorized_keys

After that you can login to your Synology as root without having to enter the password.

3
  • Does this expose any security concern? Jul 2, 2018 at 3:49
  • This does not expose security problems. Since you are using a public and private key combination. It only causes security issues is they manage to get the private key Oct 8, 2020 at 23:50
  • perfect, this is what i was looking for works for ssh. doesn't work for SFTP - is there away to make that work? Feb 12 at 0:40
0

You can also just SSH using rsa keys, then you can SSH as root, even after installing DSM6, without making any additional changes.

0

If you're still with DSM Version 5, you might have logged in as admin instead of root. This makes a difference, even though root and admin share the same password.

To solve, do

ssh root@synology.local

with using the admin password.

This will log you in as root, with root access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.