1#!/bin/bash 2# Copyright (c) Meta Platforms, Inc. and affiliates. 3# All rights reserved. 4# 5# This source code is licensed under the BSD-style license found in the 6# LICENSE file in the root directory of this source tree. 7 8set -ex 9 10# Same as ec2-user 11echo "ci-user:x:1000:1000::/var/lib/ci-user:" >> /etc/passwd 12echo "ci-user:x:1000:" >> /etc/group 13# Needed on Focal or newer 14echo "ci-user:*:19110:0:99999:7:::" >> /etc/shadow 15 16# Create $HOME 17mkdir -p /var/lib/ci-user 18chown ci-user:ci-user /var/lib/ci-user 19 20# Allow sudo 21echo 'ci-user ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/ci-user 22 23# Test that sudo works 24sudo -u ci-user sudo -v 25