apt-get install -y mosquitto mosquitto_user="DVES_USER" mosquitto_password="letmein" cat <<-EOF | sudo tee /etc/mosquitto/conf.d/remote.conf # Mosquitto Configuration File # per_listener_settings true listener 1883 protocol mqtt allow_anonymous false password_file /etc/mosquitto/pwfile # Listener configuration #listener 1885 0.0.0.0 #protocol mqtt #allow_anonymous true #password_file /etc/mosquitto/pwfile #listener 9001 #protocol websockets #allow_anonymous true log_type error log_type warning log_type notice log_type information # Authentication settings (optional) # Uncomment the following lines if you want to enable authentication # and specify the authentication plugin and settings. #auth_plugin #auth_opt_ # Access control settings (optional) # Uncomment the following lines if you want to enable access control # and specify the access control plugin and settings. #access_control true #acl_file # Persistence settings (optional) # Uncomment the following lines if you want to enable persistence # and specify the persistence plugin and settings. #persistence true #persistence_location # Logging settings (optional) # Uncomment the following lines if you want to enable logging # and specify the log file and verbosity level. #log_dest file #log_type all #log_timestamp true #log_timestamp_format %Y-%m-%d %H:%M:%S # Other settings (optional) # Uncomment and modify any other settings as per your requirements. # For example, you can set the maximum number of connections, etc. #max_connections 100 EOF cat <<-EOF | sudo tee /etc/mosquitto/pwfile ${mosquitto_user}:${mosquitto_password} EOF sudo mosquitto_passwd -U /etc/mosquitto/pwfile