When doing this check:
$ /usr/sbin/sshd -t
Getting:
Could not load host key: /etc/ssh_host_rsa_key
Could not load host key: /etc/ssh_host_dsa_key
But when doing same check with sudo
all is good:
$ sudo /usr/sbin/sshd -t
$
Does anyone know why does this happen, what’s wrong with my standard user and how to fix it?
Best Answer
There is nothing wrong; you are attempting to run
sshd
(SSH daemon) as a non-privileged user.For example, I am on Mac OS X 10.9.5 (Mavericks) and get the same exact “error” when running
/usr/sbin/sshd -t
:Which is to be expected since
sshd
is the SSH daemon—note thed
afterssh
—that would run as a SSH server on the system listening and waiting for remote SSH login requests. So it would always need root/sudo
permissions to work.So this is not an “error” but rather expected behavior when attempting to run a system daemon like
sshd
as a non-privileged user.Perhaps you are trying to run
ssh -t
? As the man page for thessh
-t
option explains:Which basically allows you to run a command remotely from your current terminal and have the output displayed locally as if it ran on your local machine. So—as this page explains—if you wanted to run
ls
on a remote machine without actually fully logging in you could run this command:The output of
ls
would show up on your screen and thessh
connection would close immediately after that command completed.