A página de manual para sshd_config
informa claramente o que é esperado do comando para fazer e gerar:
AuthorizedKeysCommand
Specifies a program to be used to look up the user's public keys. The program must be owned by root, not writable by group or others and specified by an absolute path.
Arguments to AuthorizedKeysCommand may be provided using the following tokens, which will be expanded at runtime: %% is replaced by a literal '%', %u is replaced by the username being authenticated, %h is replaced by the home directory of the user being authenticated, %t is replaced with the key type offered for authentication, %f is replaced with the fingerprint of the key, and %k is replaced with the key being offered for authentication. If no arguments are specified then the username of the target user will be supplied.
The program should produce on standard output zero or more lines of
authorized_keys
output (see AUTHORIZED_KEYS insshd(8)
). If a key supplied by AuthorizedKeysCommand does not successfully authenticate and authorize the user then public key authentication continues using the usual AuthorizedKeysFile files. By default, no AuthorizedKeysCommand is run.
Então, sim, o date
e o echo
que você tentou escrever em seu comando provavelmente foram ignorados como saída de lixo / inválido. Se você deseja que isso autorize seu usuário, você precisa de um script para produzir a chave pública no formato esperado (consulte a página de manual para sshd
para obter mais informações).