SSD temp with conky

If you don't want to have hddtemp running in daemon mode all the time, you could also run hddtemp as an external command instead. However, hddtemp needs to be run as root:

$ hddtemp /dev/sda
/dev/sda: open: Permission denied
$ sudo hddtemp /dev/sda
/dev/sda: ST3500418AS: 35°C

So, you will first need to give your user permission to run the command. Run visudo and add this line to the sudoers file (change linofex to your actual username):

linofex  ALL=NOPASSWD:/usr/sbin/hddtemp

That should let you run sudo hddtemp without needing to enter a password.

Now, replace the line from your conkyrc file with:

${alignr 10}${color}SSD M500 Crucial 120GB Temp ${color1}${exec sudo hddtemp /dev/sda | awk '{print $NF}'}

You need to first start hddtemp as a background daemon with the commmand:

 hddtemp -d /dev/sda

${hddtemp ...} is a conky built-in object. It connects to 127.0.0.1:7634 by default to get the disk temperatures. You therefore need to start, independently, the hddtemp daemon which listens on this port and replies with the information.

An alternative is to use ${exec hddtemp /dev/sda} which runs hddtemp on each window update, and does not need a daemon.


If you just want the temperature, pipe the output into awk to get the next-to-last field (in my case) ie $(NF-1), or the last field $NF in your case:

${exec hddtemp /dev/sda|awk '{print $NF}'}

Another solution is to permit hddtemp with:

sudo chmod +s /usr/sbin/hddtemp

Then (based on your example), in your conkyrc file the item will become:

${execi 1 hddtemp /dev/sda|sed 's%/dev/sda: %%' }

This will give you just Crucial_CT120M500SSD1: 39°C.