Skip to content

rusdmv/texlive-ssh-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ubuntu TeX Live + SSH + code-server Docker Image

This repository contains a Dockerfile for a development container based on ubuntu:24.04 with:

Included Components

  • Base image: ubuntu:24.04
  • Core tools: bash, curl, wget, git, tar, perl, xz-utils, ca-certificates
  • Admin: sudo
  • SSH: openssh-server
  • Editor server: code-server
  • Preinstalled code-server extension: James-Yu.latex-workshop (LaTeX Workshop)
  • TeX distribution: TeX Live + tlmgr update --self and tlmgr update --all
  • Project workspace volume: /workspace/tex-projects

Build Arguments

  • SSH_USERNAME (default: tex)
    • Linux user created for SSH and sudo
  • SSH_PASSWORD (default: password)
    • Password set for SSH_USERNAME and used by code-server

Example build with custom args:

docker build \ --build-arg SSH_USERNAME=tex \ --build-arg SSH_PASSWORD=password \ -t texlive-ssh-vscode .

Runtime

code-server uses the same password as SSH_PASSWORD (configured at build time).

Example run:

docker run -d \ --name texlive-ssh-vscode \ -p 2222:22 \ -p 8080:8080 \ -v "$PWD/my-tex-project:/workspace/tex-projects" \ texlive-ssh-vscode

Docker Compose

A small compose setup is included in docker-compose.yml.

  • Service name: container
  • Container name: texlive-ssh-code
  • Host project folder: ./my-tex-project
  • SSH build args:
    • SSH_USERNAME (default tex)
    • SSH_PASSWORD (default password, also used by code-server)

Start:

mkdir -p my-tex-project docker compose up -d --build

Stop:

docker compose down

Use custom SSH credentials for build:

SSH_USERNAME=myuser SSH_PASSWORD=mypassword docker compose up -d --build

Project Volume

  • Container path: /workspace/tex-projects
  • Dockerfile sets:
    • WORKDIR /workspace/tex-projects
    • VOLUME ["/workspace/tex-projects"]
  • code-server starts in this directory, so mounted TeX projects are editable immediately.

Example (Linux/macOS):

docker run -d \ --name texlive-ssh-vscode \ -p 2222:22 \ -p 8080:8080 \ -v "$PWD/my-tex-project:/workspace/tex-projects" \ texlive-ssh-vscode

Default Access

  • SSH user: tex
  • SSH password: password
  • SSH port (host): 2222 (when mapped as shown above)
  • code-server URL: http://localhost:8080
  • code-server password: same as SSH password (SSH_PASSWORD)

SSH login:

ssh tex@localhost -p 2222

Privilege Model

  • SSH_USERNAME is added to the sudo group.
  • System changes can be made through SSH_USERNAME using sudo (root privileges via sudo):
sudo whoami

Expected output: root

How Startup Works

Container command runs /usr/local/bin/start-sshd.sh, which:

  1. Creates /run/sshd
  2. Generates SSH host keys (ssh-keygen -A)
  3. Starts code-server as user tex on 0.0.0.0:8080
  4. Runs sshd in foreground (/usr/sbin/sshd -D -e)

SSH Configuration Notes

The image sets:

  • PasswordAuthentication yes
  • UsePAM yes
  • PermitRootLogin no
  • AllowUsers <SSH_USERNAME>

Important: AllowUsers effectively restricts SSH logins to the configured SSH_USERNAME (default: tex).

TeX Live Notes

TeX Live is installed from:

  • https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz

After installation:

  • tlmgr update --self
  • tlmgr update --all

TeX binaries are symlinked into /usr/local/bin so tools like pdflatex are available in PATH.

Quick Validation Checklist

docker build -t texlive-ssh-vscode . docker run -d --name texlive-ssh-vscode -p 2222:22 -p 8080:8080 -v "$PWD/my-tex-project:/workspace/tex-projects" texlive-ssh-vscode ssh tex@localhost -p 2222 id sudo -k && sudo whoami

Then open http://localhost:8080 in a browser.

Security Reminder

Default credentials are for development/testing only. For real use:

  • Change SSH password
  • Set a strong SSH_PASSWORD
  • Consider key-based SSH auth instead of password auth
  • Consider tightening sshd_config for your environment

Releases

No releases published

Packages

 
 
 

Contributors