Nvidia-Settings cannot work after ubuntu linked to ssh

Hi,

I have a desktop pc with Nvidia GTX1060 as well as K600. Everything went fine after I installed ubuntu. However, after I set the ssh on the terminal today, I found the command: nvidia-settings cannot work anymore. The error shows:

Unable to init server: Could not connect: Connection refused

ERROR: The control display is undefined; please run nvidia-settings --help for usage information.

Can anyone help me with this? Thanks a lot in advance!