2025-03-16 00:52:32 +07:00
2025-03-16 00:45:13 +07:00
2025-03-16 00:45:13 +07:00
2025-03-16 00:52:32 +07:00
2025-03-16 00:52:32 +07:00

Remote Desktop Setup on DigitalOcean

Overview

This project automates the deployment of a remote desktop environment on a DigitalOcean droplet using Terraform. It configures a Ubuntu 20.04 server with XFCE4, X2Go server for remote access, and a preconfigured user account.

Features

  • Deploys a DigitalOcean droplet in the sgp1 region.
  • Sets up a secure root password and a random password for the user gabriel.
  • Installs XFCE4 as the desktop environment.
  • Installs and configures X2Go for remote desktop access.
  • Automatically provisions a 2GB swap file.

Prerequisites

Deployment Steps

1. Configure Terraform

Edit deploy.tf and insert your DigitalOcean API token:

provider "digitalocean" {
  token = "your_digitalocean_api_token"
}

2. Initialize Terraform

Run the following command to initialize Terraform and download the required providers:

terraform init

3. Apply the Configuration

To deploy the droplet, execute:

terraform apply -auto-approve

Terraform will:

  • Create a DigitalOcean droplet.
  • Generate secure passwords for root and gabriel.
  • Run setup.sh to configure the system.

4. Retrieve Access Credentials

After the deployment, retrieve the droplet IP and passwords:

terraform output

Expected output:

droplet_ip = "xxx.xxx.xxx.xxx"
root_password = (sensitive value)
gabriel_password = (sensitive value)

5. Connect to the Droplet

Using SSH:

ssh root@<droplet_ip>

Use the root password retrieved from Terraform.

Using X2Go:

  1. Download and install X2Go Client.
  2. Set up a new session with:
    • Host: <droplet_ip>
    • Login: gabriel
    • Session Type: XFCE
  3. Use the password retrieved from Terraform.
  4. Connect to the remote desktop environment.

Cleanup

To destroy the droplet and clean up resources, run:

terraform destroy -auto-approve

Security Considerations

  • The generated passwords are sensitive and should be handled securely.
  • Remove the stored password file (/home/gabriel/.password.txt) after first login.
  • Consider setting up SSH keys for better security.

Troubleshooting

  • Ensure the droplet is running: terraform show
  • Check X2Go server logs: sudo systemctl status x2goserver
  • Verify SSH authentication is enabled: cat /etc/ssh/sshd_config | grep PasswordAuthentication

License

This project is open-source and can be modified as needed.

Description
No description provided
Readme 28 KiB
Languages
Shell 52.9%
HCL 47.1%