The connection and control of the equipment is carried out via the SSH protocol. The connection must be made under a user with sudo privileges, or under the root user (not recommended).
On the connected equipment, you need to create a sudo user.
Using the dpisu user as an example:
adduser dpisu
passwd dpisu
Defaults:dpisu !requiretty Defaults secure_path = /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin dpisu ALL=(ALL) NOPASSWD: ALL
Pay attention to the contents of the config and the dpisu login, which occurs 2 times. If you are setting up a user with a different login, specify the login in the config instead of dpisu. With this config, you disable the requirement to ask for a password and the requiretty requirement when switching to sudo mode.
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers