Kind of embarassing, but the ridiculously easy 'programming' is certainly forcing me to learn lots about Linux. I suspect this is another such instance.
I am writing a simple script to check to see if a device has a proper 2 way connection to the internet. It is used in a hotel space and many times it gets connected behind the HSIA and requires auth to get connected and it costs way too much time for the installers to figure out and yes, I realize how ridiculous that sounds unto itself. Anyway, I want them to be able to run a simple script that will:
check for a file and delete it if it exists
do a simple wget to a known URL
evaluate the result
post a message saying yea or nay to the 2-way connection being clear or not
All of this stuff works great from the command line, but I am putting it all into a simple gui. Our installers are not computer people as a rule. Running this stuff via the gui is causing permissions issues I cannot figure.
echo "Content-type: text/html<html><head><title>HSIA Auth test</title></head><body>"
if [ -f "$FILE" ]
if [ "$output" = "" ]; then
echo "<pre>The current WAN connection is NOT a proper 2-way open connection!!</pre>"
output2 = `/bin/grep Passed authtestok.html`
if [ "$output2" = "<html><head></head><body>HSIA Authorization test Passed!</body></html>" ]; then
echo "<pre>The current WAN connection IS a proper 2-3way open connection!!</pre>"
When I run this, I get a permission error on the write:
Cannot write to `authtestok.html' (Permission denied).
If I run the same command from the command line, it downloads the file. When I run the program with the file already present from the command line run instance I get a delete error, permissions again.
/bin/rm: cannot remove `authtestok.html': Permission denied
I stuck a whoami into the script and it output wwwrun. Looked familiar. Yes, it is the user added as part of the thttpd config.
# cat /etc/thttpd.conf
So, to do some testing, I go to the command line and do a su - wwwrun. No good. This is not a user that you can switch to or log in as, etc. This makes sense because I never added it.
At this point, I am muddled. I cannot possibly believe this is not some permissions 101 sort of thing. Unfortunately, I cannot find anything that is helping me via good ol' google. I've paid for this service for years and have asked half a dozen questions. Figured I would try here. A pointer to the proper documentation would suit me fine, so long as it specifically deals with this sort of thing and not just some Linux tome...