diff --git a/nixos/modules/virtualisation/ec2-data.nix b/nixos/modules/virtualisation/ec2-data.nix index 036c8c593369..387bb18ab1f2 100644 --- a/nixos/modules/virtualisation/ec2-data.nix +++ b/nixos/modules/virtualisation/ec2-data.nix @@ -34,7 +34,7 @@ with lib; if ! [ -e /root/.ssh/authorized_keys ]; then echo "obtaining SSH key..." mkdir -p /root/.ssh - chown 0700 /root/.ssh + chmod 0700 /root/.ssh if [ -s /etc/ec2-metadata/public-keys-0-openssh-key ]; then (umask 177; cat /etc/ec2-metadata/public-keys-0-openssh-key >> /root/.ssh/authorized_keys) echo "new key added to authorized_keys" @@ -47,7 +47,7 @@ with lib; userData=/etc/ec2-metadata/user-data mkdir -p /etc/ssh - chown 0755 /etc/ssh + chmod 0755 /etc/ssh if [ -s "$userData" ]; then key="$(sed 's/|/\n/g; s/SSH_HOST_DSA_KEY://; t; d' $userData)" diff --git a/nixos/modules/virtualisation/ec2-metadata-fetcher.sh b/nixos/modules/virtualisation/ec2-metadata-fetcher.sh index 5e0a908ee6c3..66a05e7a436f 100644 --- a/nixos/modules/virtualisation/ec2-metadata-fetcher.sh +++ b/nixos/modules/virtualisation/ec2-metadata-fetcher.sh @@ -1,6 +1,6 @@ metaDir=/etc/ec2-metadata mkdir -p "$metaDir" -chown 0755 "$metaDir" +chmod 0755 "$metaDir" rm -f "$metaDir/*" get_imds_token() {