Skip to content

Commit

Permalink
Set root password and allow root ssh login
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Waring committed Jan 23, 2024
1 parent f5ad7b6 commit 47ac029
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ COPY startup.sh $HADOOP_HOME/startup.sh
COPY jupyter_password.exp /jupyter_password.exp
COPY hadoop_config /usr/local/hadoop/etc/hadoop
COPY ssh_config/config /root/.ssh/
COPY ssh_config/sshd_root_login.conf /etc/ssh/sshd_config.d/
COPY root_password.exp /root_password.exp

RUN chmod 755 -R $HADOOP_HOME
RUN mkdir /code
Expand Down Expand Up @@ -84,6 +86,6 @@ ENV JUPYTER_PORT=8888

RUN pip install snakebite-py3 protobuf==3.20.*

EXPOSE 9870 9864 9868 8088 9000 8042 4040 8888
EXPOSE 22 9870 9864 9868 8088 9000 8042 4040 8888

ENTRYPOINT bash /usr/local/hadoop/startup.sh
9 changes: 9 additions & 0 deletions root_password.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set timeout -1
spawn passwd
match_max 100000
expect -exact "New password: "
send -- "$::env(ROOT_PASSWORD)\r"
expect -exact "\r
Retype new password: "
send -- "$::env(ROOT_PASSWORD)\r"
expect eof
1 change: 1 addition & 0 deletions ssh_config/sshd_root_login.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PermitRootLogin yes
3 changes: 3 additions & 0 deletions startup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

echo "Setting root password..."
expect /root_password.exp

echo "Starting SSH daemon..."
service ssh start

Expand Down

0 comments on commit 47ac029

Please sign in to comment.