I have a webapp (nginx, gunicorn, python) that receives git post hooks and triggers a command line tool (ruby, capistrano). Everything is run via a user named
deployer. The command line tool runs very well and can connect via ssh to remote servers.
When the webapp triggers it, it can't connect via ssh. A password is required. I think I know how to circumvent it (i had a similar problem with cronjobs here: Server gets killed due to increasing number of ssh-agent processes) but somehow the user is empty in the webabb.
Given this script:
#!/bin/bash echo "$(whoami)"
When I run
deployer@tools:/srv/deployment$ ./test > test.txt then test.txt contains "deployer" and the file
test.txt is owned by deployer:deployer.
When I run the very same command from within my webapp then test.txt is empty (only containing a line break) but owned by deployer:www-data (as expected and configured in gunicorn).
How is that even possible and what may I do about that?