Skip to content

Instantly share code, notes, and snippets.

@csmr
Created April 8, 2024 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csmr/cb34fdcdbe611c363e5b7af5f62af1b4 to your computer and use it in GitHub Desktop.
Save csmr/cb34fdcdbe611c363e5b7af5f62af1b4 to your computer and use it in GitHub Desktop.
Debian desktop bash installer example
#!/bin/bash
# Install desktop environment
apt-get update && \
apt-get install -y xfce4 firefox thunderbird libreoffice gimp
# Set timezone
echo "America/Los_Angeles" > /etc/timezone && \
dpkg-reconfigure -f noninteractive tzdata
# Configure locale
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure -f noninteractive locales
# Create user account
useradd -m -s /bin/bash user && \
echo "user:password" | chpasswd && \
usermod -aG sudo user
# Copy SSH authorized keys
mkdir -p /home/user/.ssh && \
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwINnRY0c3lq6CD1Lx75KqrJMEz8C/f9onzrqc8f8c+nWp/g+gjU4JILCkqOZblzM3h6rOJm+e8J1k8cYbf0tLTvLEaxfSnxQe9h2r9g+Y3/GPOHJhdl5NMGtW8uFA5fBqihR7qJdyEmTvphzDq0YVgBbyU9k+we6oKFQDY6rbDfrX73Tp1LlYROyKC4UD6h+L+WpCp+s9cFJE6EnD1wK2Mqj+DxXzBKkE3Y5e7QN0QAzWKg93bKNA1ujK5yHE3VaUwEgw2oKfTQXVZRrF6l1g6iIy3RODgzyPPbJ3/WLX/D3l8S4iUu0cAwEAAQ== user@laptop" > /home/user/.ssh/authorized_keys && \
chown -R user:user /home/user/.ssh && \
chmod 700 /home/user/.ssh && \
chmod 600 /home/user/.ssh/authorized_keys
# Disable root login
sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' /etc/ssh/sshd_config
# Start the Xfce desktop environment
su - user -c "startxfce4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment