Как запустить Logstalgia, если root-вход отключен и у пользователя ssh нет доступа к журналам?

306
trueCamelType

Я пытаюсь запустить Logstalgia, я думаю, что это довольно круто, и хочу попробовать это. По соображениям безопасности я отключил root-вход с моих серверов. У моего текущего пользователя нет доступа к файлам журналов, и я бы хотел сохранить его таким.

Есть ли способ выполнить команду, подобную этой:

ssh -i myKey myName@192.168.1.2 tail -f /var/log/apache2/my.log | logstalgia --sync 

Но sudo после входа в систему, но перед выполнением хвоста?

1

1 ответ на вопрос

1
Jakuje

You can set up your root login using keys only and limit the key to run this only command, which mitigates the most of the dangers. You would create the key and store it on the server root's authorized_keys file with modifier like this:

command="tail -f /var/log/apache2/my.log",no-pty,no-port-forwarding ssh-rsa AAAAB3Nza...LiPk== 

And change the option in sshd_config to PermitRootLogin forced-commands-only

The other way round, as you suggest is to use sudo, but you would need also to modify sodoers file to achieve appropriate results -- also allow only this command for your user and probably use option without password to be able to automate things.

Похожие вопросы