It is convenient to add the root privilege of hadoop user directly in sudo vi /etc/sudoers.
添加:用户名 ALL=(ALL) ALL
As a result, the following error is prompted when using sudo next:
sudo: /etc/sudoers 可被任何人写
sudo: 没有找到有效的 sudoers 资源,退出
sudo: 无法初始化策略插件
The permissions of sudoers have been changed, just change it back.
pkexec chmod 0440 /etc/sudoers