# ユーザーデータ

ユーザーデータまたはCloud-initは、起動後にベアメタルGPUサーバーを自動的に設定します。これらのスクリプトは通常、サーバーの初期設定に使用され、初回起動時に実行されます。

ユーザーデータを使用したサーバーのデプロイでは、プロビジョニング中に任意のコマンドを実行し、サーバーの様々な側面を変更できます。

ユーザーデータスクリプトで実行可能な操作の例を以下に示します：

#### ユーザーの作成と基本パッケージのインストール

```
// #cloud-config  
users:  
  - name: cloud_user  
    ssh_authorized_keys:  
      - ssh-rsa AAAAB3Nz... user@domain  
    sudo: "ALL=(ALL) NOPASSWD:ALL"  
    groups: sudo  
    shell: /bin/bash  
packages:  
  - git  
  - htop  
```

このスクリプトの機能:&#x20;

1. cloud\_user というユーザーを作成します。&#x20;
2. 安全なリモートログインを許可するSSHキーを追加します。&#x20;
3. git（バージョン管理ツール）やhtop（システムモニター）などのパッケージをインストールします。&#x20;

テスト方法:&#x20;

ログインするには、以下の形式のコマンドを使用します:&#x20;

```
ssh -i /.ssh/id_rsa maas_user@10.192.226.195 
```

さらに、htopを実行したりgitコマンドを試したりしてテストできます。&#x20;

#### 複数ユーザー向けSSHキーの設定&#x20;

```
#cloud-config 
users: 
- default 
- name: user1 
ssh_authorized_keys: 
- ssh-rsa AAAAB3Nz... user1@domain 
- name: user2 
ssh_authorized_keys: 
- ssh-rsa AAAAB3Nz... user2@domain 
```

このスクリプトの機能:&#x20;

1. デフォルトユーザーを設定します。&#x20;
2. 安全なログインのために、ユーザー1とユーザー2をそれぞれのSSH鍵と共に作成します。&#x20;

#### Dockerのインストール&#x20;

```
#cloud-config 
packages: 
- docker.io 
runcmd: 
- systemctl enable docker 
- systemctl start docker 
```

このスクリプトの動作:&#x20;

1. マシンに Docker をインストールします。&#x20;
2. Dockerを有効化および起動し、マシン起動時に常に動作するようにします。&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ai-docs.fptcloud.com/ai-factory-guideline-jp/fpt-gpu-cloud/metal-cloud/chtoriaru/cccess-servers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
