Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.12.3 available

The official documentation can be found on https://wiki.ocsinventory-ng.org. Read it before asking your question.

Linux agent - 401 authorization required [closed]

I have OCS deployment with mostly WIndows machines, but recently I needed to add some Linux stations to the OCS database. Windows agents work without any issues. I have  a problem with Linux machines. It was tested on Debian Jessie and Mint 17.3, the results are exactly the same. I have user and password set in config file. I also tried add --user and --password options on the command line. Log is as follows:

root@admin-lap:~# ocsinventory-agent --debug --user=XXX --password=XXX
[debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 2.1.1
[debug] Log system initialised (Stderr)
[debug] --scan-homedirs missing. Don't scan user directories
[debug] Accountinfo file: /var/lib/ocsinventory-agent/https:__ocs.XXX.XXX.XXX:445_ocsinventory/ocsinv.adm
[debug] OCS Agent initialised
[debug] Turns hooks on for /etc/ocsinventory-agent/modules.conf
[debug] Calling handlers : `start_handler'
[debug] Compress::Zlib is available.
[debug] Calling handlers : `prolog_writer'
[debug] sending XML
[debug] sending: <?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <DEVICEID>admin-lap-2016-04-29-13-13-17</DEVICEID>
  <QUERY>PROLOG</QUERY>
</REQUEST>
[error] Cannot establish communication : 401 Authorization Required

On the Apache side it looks like that:

lin-vserv apache2 # tail -f ssl_access_log
xxx.xxx.5.111 - - [29/Apr/2016:13:08:00 +0200] "POST /ocsinventory HTTP/1.1" 401 467
xxx.xxx.5.111 - ocs [29/Apr/2016:13:08:00 +0200] "POST /ocsinventory HTTP/1.1" 200 215
xxx.xxx.148.73 - - [29/Apr/2016:13:08:26 +0200] "POST /ocsinventory HTTP/1.1" 401 467
xxx.xxx.148.73 - ocs [29/Apr/2016:13:08:26 +0200] "POST /ocsinventory HTTP/1.1" 200 215
xxx.xxx.188.90 - - [29/Apr/2016:13:08:31 +0200] "POST /ocsinventory HTTP/1.1" 401 467
xxx.xxx.188.90 - ocs [29/Apr/2016:13:08:32 +0200] "POST /ocsinventory HTTP/1.1" 200 247
xxx.xxx.5.188 - - [29/Apr/2016:13:10:55 +0200] "POST /ocsinventory HTTP/1.1" 401 467
xxx.xxx.188.186 - - [29/Apr/2016:13:10:59 +0200] "POST /ocsinventory HTTP/1.1" 401 467
xxx.xxx.188.186 - ocs [29/Apr/2016:13:10:59 +0200] "POST /ocsinventory HTTP/1.1" 200 249

5.188 is Linux machine, as You can see it logs somewhat differently than Windows machines.

On the agent side Perl and its libraries are from distribution repos.

Am I doing something wrong or is this a bug somwhere?
closed with the note: Problem solved
in OCS Inventory NG agent for Unix by (130 points)
closed by

2 Answers

0 votes
Hi,

Could you please post apache error.log file content?

Regards

Frank
by (90.2k points)
Unfortunately there's no sign of any activity regarding these connections in apache error logs.
Have you try to put your login information like this : --user='login' --password='password' ?
Yes, I've tried that. No matter if it's in config file or at the command line - effect is the same.
+1 vote

I had the same problem but found out it was due to missing realm name.

in z-ocsinventory-server.conf

....

        AuthType Basic
        AuthName "OCS Inventory agent area"
        AuthUserFile "/etc/apache2/.htpasswd"

....

and on client i had to add:

realm="OCS Inventory agent area"
user=someuser
password=somepassord

cheers

by (160 points)
That's it!

Thank You very much!

Cheers
 
Powered by Question2Answer
...