Description

When trying to ZTP a EX4650 using a Python script, error about "nobody" user is seeing.

Symptoms

The Python script works fine when running manually but when attempting ZTP with the script, the following errors are seeing:

 

Traceback (most recent call last):

File "../../../../../../../../src/dist/python-add-ons/junos-eznc/lib/jnpr/junos/device.py", line 1261, in open

File "../../../../../../../../src/dist/python-add-ons/ncclient/ncclient/manager.py", line 160, in connect

File "../../../../../../../../src/dist/python-add-ons/ncclient/ncclient/manager.py", line 150, in connect_ioproc

File "../../../../../../../../src/dist/python-add-ons/ncclient/ncclient/transport/third_party/junos/ioproc.py", line 51, in connect

ncclient.transport.errors

.

PermissionError

:

user "nobody" does not have access privileges.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/var/tmp/tmp_opzDrpEZ/tmp-op-script.mdEc3F/ztp.py", line 140, in <module>

main()

File "/var/tmp/tmp_opzDrpEZ/tmp-op-script.mdEc3F/ztp.py", line 105, in main

device.open(normalize=True)

File "../../../../../../../../src/dist/python-add-ons/junos-eznc/lib/jnpr/junos/device.py", line 1302, in open

jnpr.junos.exception

.

ConnectError

:

ConnectError(host: None, msg: user "nobody" does not have access privileges.)

 

error: op script failed: /var/tmp/tmp_opzDrpEZ/tmp-op-script.mdEc3F/ztp.py

Solution

To execute a Python event script under the access privileges of a specific user, configure the "python-script-user username" statement at the [edit event-options event-script file filename] hierarchy level. If you do not configure the python-script-user statement for a Python event script, Junos OS executes the script using the access privileges of the generic, unprivileged system account "nobody".

 

Please follow the steps on the following link, and try to run the script again after configuring your user: https://www.juniper.net/documentation/us/en/software/junos/automation-scripting/topics/concept/automation-enabling-an-event-script.html

 

Other reference link:https://www.juniper.net/documentation/us/en/software/junos/automation-scripting/topics/task/automation-op-script-checksum.html

Modification History

2024-03-13 : Article Created