I have a user (zabbix) with shell set to /sbin/nologin. The user's home is /var/lib/zabbix and I inserted alias curl='curl -k' into ~zabbix/.bashrc. However it does not work when I (for testing purpose) issuesudo -u zabbix curl https://HOST-WITH-INVALID-ISSUER-CERTIFICATE, it returns null.Actually, the command curl https://HOST-WITH-INVALID-ISSUER-CERTIFICATE will execute remotely via zabbix-server <--> zabbix-agent interaction.
How to define alias for non interactive/non login shell?
bash;alias
Instead of an alias, use a .curlrc file in ~zabbix. This contains command line arguments to be added to the curl command when it is run.# --insecure being the more readable synonym for -k$ echo insecure >> ~zabbix/.curlrc