Git Product home page Git Product logo

Comments (3)

matt335672 avatar matt335672 commented on August 16, 2024 1

Thanks for feeding back @qbqaf - that's great information.

from xrdp.

matt335672 avatar matt335672 commented on August 16, 2024

I don't use Docker, but I think this is likely to be down to a bunch of stuff missing from the PAM stack in the Docker image. GNOME needs a lot of stuff starting in the PAM session, including the systemd --user daemon.

I'd recommend trying to get the normal user working first with ssh. When you can log in with ssh and systemctl --user status gives you a sane response you should have enough in place to start GNOME and xrdp.

from xrdp.

qbqaf avatar qbqaf commented on August 16, 2024
FROM ubuntu:24.04

RUN apt update && apt upgrade -y
RUN apt install -y software-properties-common
RUN apt install -y curl git fuse openssh-server nano
RUN apt install -y net-tools
RUN apt install -y neovim
RUN apt install -y unzip build-essential
RUN apt install -y ripgrep
RUN apt install -y xclip

ENV DEBIAN_FRONTEND=noninteractive \
    DISPLAY=:0.0

# Install GUI
RUN apt upgrade -y
RUN apt install -y ubuntu-gnome-desktop

# Install dotnet
RUN apt update
RUN apt install -y dotnet-sdk-8.0
RUN dotnet tool install --global csharp-ls

# Configure SSH
RUN mkdir /var/run/sshd
RUN echo 'root:123' | chpasswd && passwd -d root
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PermitEmptyPasswords no/PermitEmptyPasswords yes/' /etc/ssh/sshd_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

# Copy font from /FiraMono
RUN mkdir /usr/share/fonts/opentype/FiraMono -p
COPY /FiraMono/*.otf /usr/share/fonts/opentype/FiraMono/

# Install kickstart
COPY kickstart.nvim/ /home/user/.config/nvim/

# Edit .bashrc to display contents of startup.sh
RUN echo "export EDITOR=/usr/bin/nvim" >> /home/user/.bashrc
COPY startup.sh /home/user/startup.sh
RUN echo "sh /home/user/startup.sh" >> /home/user/.bashrc

# Install kickstart.nvim.override
RUN nvim --headless . +PlugInstall +qall
COPY kickstart.nvim.override/ /home/user/.config/nvim/
RUN nvim --headless . +PlugInstall +qall

# Install VNC deps
RUN apt install -y \
    supervisor

ENV USER=user

# Create .Xauthority file
RUN touch /home/user/.Xauthority

# Setup supervisor
RUN mkdir -p /etc/supervisor/conf.d
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Theming (Breeze as default)
RUN apt install -y gnome-themes-extra
RUN gsettings set org.gnome.desktop.interface gtk-theme Adwaita
RUN gsettings set org.gnome.desktop.wm.preferences theme Adwaita

# Install firefox and get rid of snapd
RUN add-apt-repository -y ppa:mozillateam/ppa && \
    apt-get -y update && \
    apt-get -y upgrade && \
    apt-get -y purge snapd ;\
    apt-get -y install firefox-esr && \
    apt-get clean

RUN \
  apt-get install -y \
    xrdp check tigervnc-standalone-server xorgxrdp libpam0g-dev && \
  apt-get autoremove -y && \
  systemctl enable xrdp.service

# Install the workaround for:
# - https://github.com/neutrinolabs/xrdp/issues/1684
# - GNOME Keyring asks for password at login.
RUN cd /tmp && \
  wget 'https://github.com/matt335672/pam_close_systemd_system_dbus/archive/f8e6a9ac7bdbae7a78f09845da4e634b26082a73.zip' && \
  unzip f8e6a9ac7bdbae7a78f09845da4e634b26082a73.zip && \
  cd /tmp/pam_close_systemd_system_dbus-f8e6a9ac7bdbae7a78f09845da4e634b26082a73 && \
  make install && \
  rm -fr /tmp/pam_close_systemd_system_dbus-f8e6a9ac7bdbae7a78f09845da4e634b26082a73

RUN useradd -m user
RUN usermod -a -G xrdp user
RUN usermod -a -G root user
RUN adduser xrdp ssl-cert
RUN chmod 777 /etc/xrdp/key.pem
RUN chown :xrdp /etc/xrdp/key.pem
RUN chmod 777 /etc/xrdp/cert.pem
RUN sed -i 's/port=3389/port=tcp:\/\/:3389/g' /etc/xrdp/xrdp.ini
RUN apt install -y dbus-x11

# Expose SSH and RDP ports
EXPOSE 22 3389

RUN echo 'user:useruser' | chpasswd

COPY ./build/ubuntu-run.sh /usr/bin/
RUN mv /usr/bin/ubuntu-run.sh /usr/bin/run.sh
RUN chmod +x /usr/bin/run.sh

# Start systemd
RUN systemctl enable ssh
RUN systemctl enable xrdp.service
RUN systemctl enable supervisor
ENTRYPOINT ["/lib/systemd/systemd"]

This is my final dockerfile that ended up working. Using systemd as the entrypoint and just relying on the services to work did the trick ;)

from xrdp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.