G. Vandemoortele wrote: | I've configured elog with some commands running a shell :
Preset R-Date = $shell(/usr/bin/date +"%Y/%m/%d %H:%S")
; for testing :
Preset $text = $shell(whoami && set)
Preset $text = Some fixed text
That worked well when elog was started by root (and falling to user elog),
but later, I moved all the elog tree to /home/my_name/.elog,
(I'd like to start it only when I'm logged, it's only for personnal data)
changed all the attributes/permissions ($chown -R my_name:my_group .elog)
and none of these commands still works ! I use the -x option to allow
shell substitution.
More surprisingly, even the fixed text doesn't work (???) |
First of all, you could use
Preset R-Date = $date
instead of the shell command. Secondly, the command
Preset $text = $shell(whoami && set)
is wrong. Replace it by
Preset text = $shell(whoami && set)
without the "$".
G. Vandemoortele wrote: | By the way, I also seen that it is necessary to set Usr and Grp to "elog"
via the config file even when it's started by root, because otherwise,
you always get the strings 'Falling back to default group "elog"' and
Falling back to default user "elog" in the output of the shell substitutions. |
There is a good reason for that. If you run elogd as root, this can open a dangerous hole into your system. If there would be any bug in elog, an attacker could gain root access easily. By falling back to a non-root user, the damage can be minimized. As a precaustion, elog falls back to Usr and Grp "elog" if that setting is missing in the config file.
When you run elog under your user name, this fallback is not necessary. Why you got the message 'Falling back' is a mystery to me. I tried to reproduce that, so I run under a non-root account with following config:
[global]
port = 1234
[demo]
Attributes = Subject
Preset Subject = $shell(date +"%Y/%m/%d %H:%S")
and correctly got the date in the "Subject" field with ELOG V2.6.1-1640. |