Skip to content

Commit a90258a

Browse files
committed
feat: ssh working
1 parent b2f1a37 commit a90258a

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

Dockerfile

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,23 @@ RUN apt-get install -y \
2222
sudo \
2323
wget \
2424
xorgxrdp \
25-
xrdp && \
25+
xrdp \
26+
openssh-server && \
2627
apt remove -y light-locker xscreensaver && \
2728
apt autoremove -y && \
2829
rm -rf /var/cache/apt /var/lib/apt/lists
2930

31+
# SSH setup: create host keys, allow password auth
32+
RUN mkdir -p /var/run/sshd && \
33+
sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config && \
34+
sed -i 's/^#PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config && \
35+
sed -i 's/UsePAM yes/UsePAM no/' /etc/ssh/sshd_config
36+
37+
3038
COPY ubuntu-run.sh /usr/bin/
3139
RUN mv /usr/bin/ubuntu-run.sh /usr/bin/run.sh
3240
RUN chmod +x /usr/bin/run.sh
3341

3442
# Docker config
35-
EXPOSE 3389
43+
EXPOSE 3389 22
3644
ENTRYPOINT ["/usr/bin/run.sh"]

docker-compose.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ services:
33
build:
44
context: .
55
container_name: ubuntu-rdp
6+
cap_add:
7+
- CAP_AUDIT_WRITE
68
ports:
79
- "3389:3389"
8-
# The CMD is in the Dockerfile, but you can override if needed:
9-
# command: ["/usr/sbin/xrdp", "--nodaemon"]
10+
- "2222:22"

ubuntu-run.sh

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ start_xrdp_services() {
1212
xrdp-sesman && exec xrdp -n
1313
}
1414

15+
start_ssh_services() {
16+
service ssh restart
17+
wait
18+
}
19+
20+
1521
stop_xrdp_services() {
1622
xrdp --kill
1723
xrdp-sesman --kill
@@ -34,6 +40,9 @@ usermod -aG sudo admin
3440

3541
echo -e "This script is ended\n"
3642

43+
echo -e "starting sshd services...\n"
44+
start_ssh_services
45+
3746
echo -e "starting xrdp services...\n"
3847

3948
trap "stop_xrdp_services" SIGKILL SIGTERM SIGHUP SIGINT EXIT

0 commit comments

Comments
 (0)