First-boot Script Examples

To modify the default cluster node images provided by Aspera, enter a first-boot script into the Firstboot Script field when launching a node. For more information on first-boot scripts, see Customizing Cluster Nodes Using the Custom First-boot Scripts.

For examples of common first-boot scripts, see the examples below.

Print a Test Message

The following script prints a test message to check that the first-boot scripts are running:

#!/bin/bash

echo "Cluster Manager first-boot scripts are running."

Create Node API User

Create a Node API User (xfer2) that can be used to monitor your clusters using IBM Aspera Console. Use the following first-boot script (replacing node_api_password with the desired password) when launching a new cluster:
#!/bin/bash

echo "/opt/aspera/bin/asnodeadmin -a -u xfer2 -x root -p node_api_password --acl-set impersonation" >> /opt/aspera/atcm/bin/configure-node-users.sh
Note: For more information about the Node API User in Console, see the IBM Aspera Console Admin Guide.

Creating a New Default System User to Use with Access Keys

The cluster connects to cloud storage using access keys, which provide a more secure and flexible alternative to authenticating with the Aspera node user or system user. For more information about access keys, see Access Key Overview.

Aspera recommends creating a new system user to use with all access keys. To create this system user, use the first-boot script and replace username with the desired name of your default user:

#!/bin/bash

SYSTEM_USER=username

function createUser() {
  local user=$1
  groupadd -f aspusers
  adduser -s /bin/aspshell -G aspusers ${user}
  pushd /home/${user}
    mkdir -p .ssh
    cp -f /opt/aspera/var/aspera_id_dsa.pub .ssh/authorized_keys
    chown -R ${user}:${user} .ssh/
    chmod 755 .ssh/
    chmod 644 .ssh/authorized_keys
  popd
}

createUser "$SYSTEM_USER"

echo "
/opt/aspera/bin/asnodeadmin -d -u \"\$3\"
/opt/aspera/bin/asnodeadmin -a -u \"\$3\" -x \"$SYSTEM_USER\" -p \"\$4\"" >> /opt/aspera/atcm/bin/configure-node-users.sh