So I am changing all of the question so you can understand my purpose:
I have this script.sh:
$HADOOP_HOME/sbin/start-dfs.sh
$HADOOP_HOME/sbin/start-yarn.sh
cd /home/hadoop/apache-hive-3.1.1-bin/
hiveserver2 &
sudo /opt/hue/build/env/bin/hue runserver &
I want it to be run automatically when ubuntu boots and I login to second user hadoop.
PROBLEM:
This script should be executed by user hadoop. This hadoop user has a password. Ubuntu boots on another user by default.
How should I do please? Newbie alert!