LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Cannot get a response from server as I get a Unauthorised message (https://www.linuxquestions.org/questions/linux-networking-3/cannot-get-a-response-from-server-as-i-get-a-unauthorised-message-824037/)

barnrygravel 08-04-2010 01:29 AM

Cannot get a response from server as I get a Unauthorised message
 
Have a Java program which simply connects to a server and gets back the response from the website.

When I use it under Windows environment it runs fine and i receive a Response Code: 200, , Response Message: OK
but in UNIX i get Response Code 401, Response Message Unauthorized

In Unix I tried to ping the website using the ping command.

ping <website>
<website> is alive

I use putty to connect to a Unix m/c.
I don't have any permissions to install any programs so could not install any s/w so i could check if i were able to reach the website.

Is it a Proxy Server related issue ?
If yes how do i configure it ?

sem007 08-04-2010 11:01 AM

HI barnrygravel Wel-come to LQ,

sorry but i am confuse....

Quote:

Have a Java program which simply connects to a server and gets back the response from the website.

When I use it under Windows environment it runs fine and i receive a Response Code: 200, , Response Message: OK
but in UNIX i get Response Code 401, Response Message Unauthorized
ok.. How your program connect to server? It only check connectivity or connect to specific service like ftp,mysql, etc....

Quote:

I use putty to connect to a Unix m/c.
I don't have any permissions to install any programs so could not install any s/w so i could check if i were able to reach the website.
Do you require to install this program?

How you run your program?

eantoranz 08-04-2010 11:12 AM

I honestly don't know what you are doing... but anyway... what's the permissions settings for ping?

do this and tell us the output:

Code:

ls -l $( which ping )

barnrygravel 08-05-2010 01:12 AM

Hi sem007,

Thanks for the warm welcome! Sorry did not post clearly.

Quote:

ok.. How your program connect to server? It only check connectivity or connect to specific service like ftp,mysql, etc....
Program is basically designed just to connect to the website's server or for that matter any m/c corresponding to a URL and get some acknowledgement from it so that we know that we are successfully able to communicate with the website . In order to determine the status a Response Code is collected from the server. Program uses HTTP & HTTPS protocols.

Ideally the Response code 200 is expected(http://www.w3.org/Protocols/HTTP/HTRESP.html)

This happens in case its run on windows but when the same program is run on Unix a Response code 401 (Unauthorized) is returned.



Quote:

Do you require to install this program?

How you run your program?
Putty (http://www.putty.org/) is a program which I have installed on the windows m/c in order to connect to the Unix m/c.

Can simply login to Unix using Putty after specifying the required credentials.

To compile & run the Java Program the usual commands javac and java are used.Had tried to use some Proxy settings (as I thought it might be because of it) too but was unable to do so.

barnrygravel 08-05-2010 01:28 AM

Hi eantoranz,

Thanks for the reply.

Quote:

do this and tell us the output:

Code:
ls -l $( which ping )
I believe I have Read & Execute permissions

Code:

snv891!abmittal:~/test [107]> ls -l $( which ping )
Illegal variable name.
snv891!abmittal:~/test [109]> which ping
/usr/sbin/ping
snv891!abmittal:~/test [110]> ls -l /usr/sbin/ping
-r-sr-xr-x  1 root    bin        47932 Sep 30  2004 /usr/sbin/ping

Let me know if this is what you wanted.

eantoranz 08-05-2010 01:36 AM

That's not what I wanted.... I though you were using bash.

Can you get the ls -l for ping, wherever it is?

eantoranz 08-05-2010 01:36 AM

Nevermind... I just saw it.

barnrygravel 08-05-2010 11:13 PM

So what could be the problem ?

LVsFINEST 08-06-2010 04:10 AM

If you're getting HTTP response codes back, ping is definitely not the utility being called, if any, so there's no problem there. And since you're actually getting a valid HTTP response back, I don't think the problem is with your java app either.

Does the URL you're checking require authentication? Or is there a "very defensive security policy" on the webserver? Those are about the only two reasons for getting a 401:

http://www.checkupdown.com/status/E401.html

So either you typo'ed the credentials on your linux java app, or there is some security feature on the web server denying the linux version.


All times are GMT -5. The time now is 04:11 AM.