Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用CloudFormation自动创建linux用户密码_Linux_Amazon Web Services_Amazon Ec2_Command Line Interface_Amazon Cloudformation - Fatal编程技术网

使用CloudFormation自动创建linux用户密码

使用CloudFormation自动创建linux用户密码,linux,amazon-web-services,amazon-ec2,command-line-interface,amazon-cloudformation,Linux,Amazon Web Services,Amazon Ec2,Command Line Interface,Amazon Cloudformation,我正在使用CloudFormation创建一台EC2Linux机器,我可以将RDP导入其中。我正在运行所需的安装命令,如下所示: "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "commands" : {

我正在使用CloudFormation创建一台EC2Linux机器,我可以将RDP导入其中。我正在运行所需的安装命令,如下所示:

"Metadata" : {
            "AWS::CloudFormation::Init" : {
                "config" : {
                    "commands" : {
                        "step_a" : {
                             "command" : "install some stuff..."
                        },
                        "step_g" : {
                            "command" : "sudo yum groupinstall \"Gnome Desktop\" -y"
                        },
                        "step_h" : {
                            "command" : "sudo passwd centos"
                        },
                        "step_i" : {
                            "command" : "configure firewall to allow rdp..."
                        }
                    }
                }
            }
        }
如您所见,在步骤h中,我想为默认centos用户设置密码。当需要用户输入时,如何自动返回默认密码值?也许有更好的办法解决这个问题


任何帮助都将不胜感激

有几种方法可以在没有提示的情况下设置用户密码。其中一些可以找到或作为例子

但是,要考虑的潜在问题是如何在模板中提供密码?用纯文本硬编码?这是安全问题。使用
NoEcho
将其作为模板参数传递?这更好,但不可重复,而且容易出错。使用SSM参数存储或AWS机密管理器?这可能是最好的选择,但需要额外的设置