Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add entrypoint to run sshd #6

Open
OhMyMndy opened this issue Sep 26, 2022 · 0 comments
Open

Add entrypoint to run sshd #6

OhMyMndy opened this issue Sep 26, 2022 · 0 comments

Comments

@OhMyMndy
Copy link
Owner


mkdir -p /run/sshd
sed -Ei 's/#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config

useradd --uid 1000 --user-group --create-home --shell /bin/bash user || true


echo -e '1234\n1234' | passwd root
echo -e '1234\n1234' | passwd user

if [[ ! -f ~/.ssh/id_rsa.pub ]]; then
    mkdir -p ~/.ssh/
    ssh-keygen -A
fi

if [[ ! -f ~user/.ssh/id_rsa.pub ]]; then
    su user -c "mkdir -p ~user/.ssh/"
    su user -c "ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1"
fi


exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant