How to solve convert pdf to jpg not authorized error on Ubuntu 18.04 command line

Find this line in /etc/{ImagemagickFolder}/policy.xml

[pastacode lang=”markup” manual=”%3Cpolicy%20domain%3D%22coder%22%20rights%3D%22none%22%20pattern%3D%22PDF%22%20%2F%3E” message=”” highlight=”” provider=”manual”/]

Replace with this line

[pastacode lang=”markup” manual=”%3Cpolicy%20domain%3D%22coder%22%20rights%3D%22read%7Cwrite%22%20pattern%3D%22PDF%22%20%2F%3E” message=”” highlight=”” provider=”manual”/]