1

I'm trying to run Logstalgia, I think it's pretty awesome, and want to try it out. For security reasons I've disabled root login from my servers. My current user doesn't have access to the log files and I'd like to keep it that way.

Is there a way to execute a command similar to this:

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

But sudo after it logs in, but before executing the tail?

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.