Home directory - Restricted in aws transfer family using cloud formation template

0

Hi,

For adding a user with a home directory mapping, I tried the below stack template.

However, the home directory was not created after stack was run. It was in restricted mode.

If we only do to edit user configuration manually we can uncheck restricted.

I want to implement this mode in yaml template.

Please help me to do better.

GoldcoastTvodUser:
    Type: 'AWS::Transfer::User'
    Properties:
      HomeDirectoryMappings:
        - Entry: /
          Target: /goldcoast-tvod
      HomeDirectoryType: LOGICAL
      Policy:
        'Fn::Sub': |
          {
            "Version": "2012-10-17",
            "Statement": {
              "Sid": "AllowFullAccessToBucket",
              "Action": "s3:*",
              "Effect": "Allow", 
              "Resource": [
                "arn:aws:s3:::goldcoast-tvod",
                "arn:aws:s3:::goldcoast-tvod/*"
              ]
            }
          }
      Role:
        'Fn::Sub': 'arn:aws:iam::${AWS::AccountId}:role/TransferManagementRole'
      ServerId:
        'Fn::GetAtt': TransferServer.ServerId
      SshPublicKeys:
        - >-
          ssh-rsa
          AAAAB
      UserName: GoldcoastTvodUser

1 個回答
1
已接受的答案

If you change the HomeDirectoryType to PATH, it'll remove the restricted.

      HomeDirectory: "/goldcoast-tvod"
      HomeDirectoryType: "PATH"

P.S. although it's only a public SSH key, you might want to remove it from your question.

AWS
專家
Raphael
已回答 1 年前
  • Hi,

    Thanks much i have removed my public key and let me try your update and let you the working status.

    Thanks,

  • Hi,

    Thank you for the answer and YES! that was the fix.

    GoldcoastTvodUser: Type: 'AWS::Transfer::User' Properties: HomeDirectory: "/goldcoast-tvod" HomeDirectoryType: "PATH"

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南