0

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?

bpgergo
  • 177
  • 1
  • 6
  • What is the output of `\ls -l /path/to/mycommand`? – Paulo Tomé Mar 19 '20 at 15:50
  • added the actual command – bpgergo Mar 19 '20 at 15:55
  • 1
    Pro-tip: [there's no reason to use `sudo su`](https://unix.stackexchange.com/questions/218169/). Does it work if you do `sudo -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 of `export`. – terdon Mar 19 '20 at 16:09

0 Answers0