Hi there,
I have a slightly complicated security problem, I was wondering if anyone can point out some suggestions.
I have a JSP page running on Redhat that will execute a shell script. The shell script contains the following code:
Basically what the code does is that it uploads a shell script to a different box and then ssh to that box to execute that shell script with some arguments. This code is currently owned by “user1” on my Redhat and is working just fine when evoked from the command line (I have setup private/public ssh keys between user1 and differenthost with no password required, so that I don’t have to hardcode the pw).
My problem is, when this code is invoked from JSP, I get a permission denied error. I finally found out the reason for this and it was because JSP is running as the “Apache” user and it has no right to ssh to differenthost. A direct workaround will be to have this shell owned by the “Apache” user and setup a public/private key for “Apache”, but this will create a big security risk.
I was wondering if someone can point out any suggestions how I should go about setting the permission for my scenario.
Thanks,
I have a slightly complicated security problem, I was wondering if anyone can point out some suggestions.
I have a JSP page running on Redhat that will execute a shell script. The shell script contains the following code:
Code:
#!/bin/sh
scp schedule.sh user1@differenthost:~/schedule.sh
ssh user1@differenthost <<END_SCRIPT
./schedule.sh $1 $2
exit
END_SCRIPT
exit 0
Basically what the code does is that it uploads a shell script to a different box and then ssh to that box to execute that shell script with some arguments. This code is currently owned by “user1” on my Redhat and is working just fine when evoked from the command line (I have setup private/public ssh keys between user1 and differenthost with no password required, so that I don’t have to hardcode the pw).
My problem is, when this code is invoked from JSP, I get a permission denied error. I finally found out the reason for this and it was because JSP is running as the “Apache” user and it has no right to ssh to differenthost. A direct workaround will be to have this shell owned by the “Apache” user and setup a public/private key for “Apache”, but this will create a big security risk.
I was wondering if someone can point out any suggestions how I should go about setting the permission for my scenario.
Thanks,