简体   繁体   English

S3FS无法将AWS ID和密钥识别为环境变量

[英]S3FS not recognizing AWS ID and secret as environment variables

Using S3FS v1.83 (and v1.84), I source environment variables from a file in a script I've written to use the s3fs command. 使用S3FS v1.83(和v1.84),我从编写的脚本中使用s3fs命令从文件中获取环境变量。 Unfortunately S3FS does not see the AWS key and secret environment variables even though they're in the environment. 不幸的是,即使S3FS在环境中,它们也看不到AWS密钥和秘密环境变量。 I'm using CentOS 7.5 with the latest package updates. 我正在使用具有最新软件包更新的CentOS 7.5。

Passing them in as variables on the command line works, exporting them works too, but not sourcing a file. 在命令行中将它们作为变量传递时起作用,将它们导出也可以起作用,但不提供文件。

BUCKET_NAME=[bucketname]
MOUNT_LOCATION=[mountlocation]
AWSACCESSKEYID=XXXXXXXXXX
AWSSECRETACCESSKEY=XXXXXXXXX                                                     

After sourcing the file, in my script I just call s3fs with the bucket name and mount location. 在获取文件之后,在我的脚本中,我只是使用存储桶名称和安装位置调用s3fs。 Here is a snippet of the script: 这是脚本的片段:

CONFIG_FILE_LOCATION=/root/.aws_backup_config
if [ -a $CONFIG_FILE_LOCATION ]; then
   source $CONFIG_FILE_LOCATION
else                                                                                                                                                                                                                                     
   echo "AWS Backup configuration does not exist at
$CONFIG_FILE_LOCATION"                                                                                                                                                              
   exit 1                                                                                                                                                                                                                           
fi                                                                                                                                                                                                                                       
echo "Mounting S3 bucket at $MOUNT_LOCATION"                                                                                                                                                                                                 
echo $AWSACCESSKEYID
echo $AWSSECRETACCESSKEY

#Mount the S3 Bucket at MOUNT_LOCATION
s3fs $BUCKET_NAME $MOUNT_LOCATION
S3FS_RC=$?                                                                                                                                                                                                                               
if [ $S3FS_RC != 0 ]; then
     echo "Failed to mount bucket! Something isn't configured correctly! Check server messages log."

What seems to be the issue? 似乎是什么问题?

s3fs does not uses ENV to recognize credentials. s3fs不使用ENV识别凭据。 They should be stored in : 它们应存储在:

echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs 回显ACCESS_KEY_ID:SECRET_ACCESS_KEY> $ {HOME} /。passwd-s3fs

chmod 600 ${HOME}/.passwd-s3fs chmod 600 $ {HOME} /。passwd-s3fs

s3fs does support AWSACCESSKEYID and AWSSECRETACCESSKEY credentials but a regression prevented its use. AWSACCESSKEYID确实支持AWSACCESSKEYIDAWSSECRETACCESSKEY凭据,但由于回归而无法使用。 1.85 will include a fix for this issue. 1.85将包含针对此问题的修复程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM