Knowledge Base Article
Nessus Agent Offline or link error 401
ISSUE
When using the # /opt/nessus_agent/sbin/nessuscli agent status command, you get the following error:
[error] [agent] Link failed with error 401: You need to log in to perform this request
CAUSE
You may receive this error if the Nessus Agent was once linked to a Manager (Nessus Manager or Tenable.io), but that Manager no longer considers the Agent as linked. This occurs when an agent is unlinked from the Manager, either by manual unlinking or from the, "Unlink inactive agents" setting, if enabled. Unlinking from the Manager does not communicate to the Agent that it is being unlinked. You may also see the agent offline in the Nessus Manager User Interface.
RESOLUTION
To resolve this issue, you may need to unlink and re-link the Nessus Agent, from the Agent host.
Linux
From a root-level command prompt, run the following commands:
# service nessusagent stop
# /opt/nessus_agent/sbin/nessuscli agent unlink (--force)
# /opt/nessus_agent/sbin/nessuscli agent link --key=<key> --host=<host> --port=<port>
# service nessusagent start
Windows
As an administrator, from a command prompt, run the following commands:
Based on your operating system, use either C:\Program Files\Tenable\Nessus Agent or C:\ProgramData\Tenable\Nessus Agent.
> net stop "Tenable Nessus Agent"
> "C:\Program Files\Tenable\Nessus Agent\nessuscli" agent unlink (--force)
> "C:\Program Files\Tenable\Nessus Agent\nessuscli" agent link --key=<key> --host=<host> --port=<port>
> net start "Tenable Nessus Agent"
Mac OS
From a command prompt, run the following commands:
$ sudo launchctl stop com.tenablesecurity.nessusagent
$ /Library/NessusAgent/run/sbin/nessuscli agent unlink (--force)
$ /Library/NessusAgent/run/sbin/nessuscli agent link --key=<key> --host=<host> --port=<port>
$ sudo launchctl start com.tenablesecurity.nessusagent
To verify connection to managing host, you can performing a nessuscli agent status in the command line/terminal of the agent target.
More on that here: https://docs.tenable.com/nessus/Content/NessusCLIAgent.htm
If unlinking and re-linking your agent does not resolve this issue, check your firewall settings or your certificates.
ADDITIONAL RESOURCES
For a complete list of Nessus and Nessus Agent nessuscli commands and syntax, refer to the Nessus Command Line Reference Guide.
For a Chinese translation of this article, log in to Tenable Community and see the Attachment section of this article.
Note: As a reminder, Tenable only provides support in English.