execute su -c over ssh
Use -t
to force ssh to allocate a tty:
ssh -t -t remote-user su -c dmidecode
You might also consider allowing root to ssh directly. If you're using public key authentication, this may be more secure as you won't be passing a password around. If you decide to do this, consider blocking root logins from anywhere except your trusted IP addresses by putting the following in /etc/security/access.conf
:
+ : root : 10.20.30.40
- : root : ALL EXCEPT LOCAL
and make sure UsePAM
isn't disabled in sshd_config