Post #371,081
2/8/13 11:55:22 AM
|
weird browser behavior
redhat linux bash script
#!/bin/bash
# the following line tells the browser what type of content we are sending
echo "Content-type: text/html"
# set up the title and indexing information for the page
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<title>chinese food eat here</title>'
echo '</head>'
echo '<body>'
echo ' '
#
echo "/usr/bin/ssh -tt machine1 sudo -u foo ps -ef | grep stuff "
# below line needs a -tt to get the sudo to work
/usr/bin/ssh -tt machine1 sudo -u foo ps -ef | grep stuff 2>&1
echo "/usr/bin/ssh tx-app01 sudo -u msft_webapp ps -ef | grep bulksettlement 2>&1 "
# the below line has an older sudo does not need -tt
/usr/bin/ssh machine2 sudo -u foo ps -ef | grep more stuff 2>&1
echo '</body>'
echo '</html>'
exit 0
chmod 775 script.cgi
run it from the command line returns the value from a ps -ef for both machines
hit it over apache2.2 only the second ps -ef returns any content
machine that bash lives on 2.6.32.29-0.3-default 64bit suse
machine1 2.6.32-220.17.1.el6.x86_64 redhat
machine2 2.6.16.60-0.39.3-smp suse
any ideas? same behavior in chrome firefox and exploder
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,083
2/8/13 1:43:00 PM
|
checked apache logs, nothing there
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,094
2/8/13 5:19:15 PM
|
machine1 not happy with the Apache user's ssh keys?
If you haven't already tried, su a shell to the Apache user's account, then try the failing ssh command with an added -v (or two, three)
|
Post #371,101
2/8/13 6:53:56 PM
|
ssh is not failing at command line
same user is running apache and owns and runs the script.
Got an exact duplicate of redhat vm and it works there, it seems that standard out is acting funny
if I create a variable in the script called
FOO="machine1 ps -ef | grep stuff"
ssh -tt $FOO
it displays in the browser, fekkin annoying
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,105
2/8/13 7:10:58 PM
|
Re: ssh is not failing at command line
Make sure you set a TERM environment variable in the script or crontab.
Otherwise it'll balk.
--
greg@gregfolkert.net
PGP key 1024D/B524687C 2003-08-05
Fingerprint: E1D3 E3D7 5850 957E FED0 2B3A ED66 6971 B524 687C
|
Post #371,150
2/9/13 6:09:32 PM
|
will try that monday
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,201
2/11/13 8:36:51 AM
|
didnt work
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,203
2/11/13 9:50:33 AM
|
DIDJA try a couple different ones...
that were valid for the system?
--
greg@gregfolkert.net
PGP key 1024D/B524687C 2003-08-05
Fingerprint: E1D3 E3D7 5850 957E FED0 2B3A ED66 6971 B524 687C
|
Post #371,204
2/11/13 11:33:40 AM
|
xterm. vt100. wy60,
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,206
2/11/13 1:18:56 PM
|
Okies..m I'm out.
I have another shell script on a really really old machine (1998) that won't run from cron...
I've never been able to fix it to run from cron period. Its MUCH along the same lines yours looks.
--
greg@gregfolkert.net
PGP key 1024D/B524687C 2003-08-05
Fingerprint: E1D3 E3D7 5850 957E FED0 2B3A ED66 6971 B524 687C
|
Post #371,227
2/11/13 7:00:26 PM
|
If you have control over machine1
Turn up logging on sshd (or run it in debug mode)? That at least cuts Apache's handling of any ssh client error output out of the loop.
|
Post #371,252
2/12/13 8:44:03 AM
|
ssh -vv
gives me great detail on the terminal, gives me nothing on the browser, Faking it with variables works but its still annoys me
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|
Post #371,284
2/12/13 6:56:54 PM
|
I meant the other end
i.e. turn up logging on the target of the ssh connection if you can.
|
Post #371,289
2/12/13 9:02:45 PM
|
Could try that, thanks
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free American and do not reflect the opinions of any person or company that I have had professional relations with in the past 57 years. meep
|