Q:

How is the AuthorizedKeysCommand used in SSH? 

I want to use the AuthorizedKeysCommand as a test on my server. 
Steps:
1.  Added the line AuthorizedKeysCommand /etc/ssh/myScript.sh to the end of the file. 
2.  Created a script myScript.sh in the /etc/ssh/ location that contains:  
#! /bin/bash  
echo "Hello world";

This script has permissions 755 and is owned by root with group set to sshd.  

Tried to restart the SSHD daemon by running: sudo systemctl restart sshd 

sshd does not restart and exits.  The error code too is not clear and does not go away until the AuthorizedKeysCommand is removed.   
Where am I going wrong? 
I am running SSH version: OpenSSH_6.6.1p1  OpenSSL 1.0.1e-fips 11 Feb 2013 on a Centos7 server. 

A:

Indeed, an error message would be useful, but I take a wild guess and maybe this happened:

systemd[1]: Started OpenBSD Secure Shell server. 
sshd[23748]: AuthorizedKeysCommand set without AuthorizedKeysCommandUser
systemd[1]: ssh.service: main process exited, code=exited, status=255/n/a

You need to the set the AuthorizedKeysCommandUser parameter as well, otherwise sshd fails to start.  Also, make sure to heed all the other requirements for AuthorizedKeysCommand laid out in sshd_config, e.g. the script needs to be executable too.