我的AWS CLI不适用于sudo [英] My AWS CLI didn't work with sudo
本文介绍了我的AWS CLI不适用于sudo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有使用aws cli
的shell脚本,我的脚本将使用sudo(例如:sudo ./test.sh
)
I have shell script that uses aws cli
, my script will be executed with sudo (Ex: sudo ./test.sh
)
但是我收到消息:Unable to locate credentials. You can configure credentials by running "aws configure".
实际上,我同时做了sudo aws configure
和aws configure
Actually, I did config for both sudo aws configure
and aws configure
我做错了什么? 请帮忙. 谢谢!
What did I do wrong? Please help. Thanks!
推荐答案
您可能必须使用-E来运行sudo才能保留由aws cli设置的环境变量.
sudo -E ./test.sh
You might have to run sudo with -E to preserve the environment variables set by aws cli.
sudo -E ./test.sh
这篇关于我的AWS CLI不适用于sudo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文