this command fails when it is being run by a user that is different from myuser and having sudo rights:
sudo su - -c "export KAFKA_OPTS=-Djava.security.auth.login.config=/etc/kafka/conf/kafka_jaas.conf;/usr/hdp/current/kafka-broker/bin/kafka-configs.sh --zookeeper hostname1:2181,hostname2:2181,hostname3:2181 --alter --entity-type topics --entity-name topicname1 --add-config max.message.bytes=5" kafka
when logged in as kafka, this succeeds:
export KAFKA_OPTS=-Djava.security.auth.login.config=/etc/kafka/conf/kafka_jaas.conf;/usr/hdp/current/kafka-broker/bin/kafka-configs.sh --zookeeper hostname1:2181,hostname2:2181,hostname3:2181 --alter --entity-type topics --entity-name topicname1 --add-config max.message.bytes=5
Usually the su wrapped command works as well, I have a special case where it does not work. How can this be possible?
\ls -l /path/to/mycommand
? – Paulo Tomé Mar 19 '20 at 15:50sudo su
. Does it work if you dosudo -u kafka "KAFKA_OPTS=-Djava.security.auth.login.config=/etc/kafka/conf/kafka_jaas.conf;/usr/hdp/current/kafka-broker/bin/kafka-configs.sh --zookeeper hostname1:2181,hostname2:2181,hostname3:2181 --alter --entity-type topics --entity-name topicname1 --add-config max.message.bytes=5"
? Note the absence ofexport
. – terdon Mar 19 '20 at 16:09