I am trying to check the BIOS version of a server over SSH, a command that requires root privileges:
ssh remote-server su -c dmidecode
but this of course fails with the error:
standard in must be a tty
How do I make this work? I cannot use sudo, and when I try to log in as root@remote-server, it won't accept the password I use for the 'su' command. I am using RedHat Enterprise Linux 4.
Use
-t
to force ssh to allocate a tty: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
:and make sure
UsePAM
isn't disabled insshd_config
Can't you just log in to the remote server as a standard user and then use sudo?
You could also try quoting the command to be executed by ssh, as in
or