There are several reasons I want to this, but primarily I want execute smartctl from a script. And hhdtemp and the disks utility don't give the same results as does smartctl. Besides which hddtemp also requires root authorization which I am trying to circumvent.
I have looked at a number of different references including the sudoers man page. It seems pretty straightforward but I can't get it to work. I started by creating a file in /etc/sudoers.d
Code: Select all
#nano /etc/sudoers.d/username
Code: Select all
username ALL=(ALL) NOPASSWD:/usr/sbin/smartctl
Code: Select all
chmod 0440 /etc/sudoers.d/username
Code: Select all
usrname@debian:~$ /usr/sbin/smartctl --all /dev/sda
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-8-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
Smartctl open device: /dev/sda failed: Permission denied
EDIT: Forgot to mention that I am running Bullseye amd64.