Once logged into your server via SSH then enter the command passwd as follows:
1. sudo passwd root
2. Type your password for 2 times & you are done
3. Now you can login as root user by typing su , it will ask you for password again type your root password & now you are logged in as root user.