0

In AWS EC2, I am using Centos 7, I observe strange behaviour where a binary for Hashicorp Vault CLI (/usr/local/bin/vault) is available during boot to commands I run in user data. It is also available for users normally. However, if I run sudo -i it is not available. If I run sudo su - root, then it is available!

Why would a command be available in user data as root, but not if I try to login as root using sudo -i?

2
  • What do you mean by "available"? What happens when root runs /usr/local/bin/vault? Commented Apr 9, 2021 at 7:04
  • 2
    Because you're ending up with a different $PATH between sudo -i and sudo su - root. sudo -i is instructing sudo to behave as if it's a login, sudo su - root is instructing su to behave that way. Read the man page for each command to understand the behavior. Commented Apr 9, 2021 at 7:31

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.