Minimal Alpine Linux Docker image with sshd
exposed and rsync
installed. The image is available on quay.io quay.io/panubo/sshd
and AWS ECR Public public.ecr.aws/panubo/sshd
.
Configure the container with the following environment variables or optionally mount a custom sshd config at /etc/ssh/sshd_config
:
SSH_USERS
list of user accounts and uids/gids to create. eg SSH_USERS=www:48:48,admin:1000:1000:/bin/bash
. The fourth argument for specifying the user shell is optional. If SSH_GROUPS
is omitted, a group is created for each user with the same name as the user.SSH_GROUPS
list of groups and gids to create. eg SSH_GROUPS=guests:1005,other:1006
. Specifying this option disables automatic group creation of user-named groups if you also specify SSH_USERS
.SSH_ENABLE_ROOT
if "true" unlock the root account. N.B restricted modes to not apply to this account.SSH_ENABLE_PASSWORD_AUTH
if "true" enable password authentication (disabled by default) (excluding the root user)SSH_ENABLE_ROOT_PASSWORD_AUTH
if "true" enable password authentication for all users including rootMOTD
change the login messageGATEWAY_PORTS
if "true" sshd will allow gateway portsTCP_FORWARDING
if "true" sshd will allow TCP forwardingDISABLE_SFTP
if "true" sshd will not accept sftp connections. Note: This does not
prevent file access unless you define a restricted shell for each user that prevents executing
programs that grant file access.The following three restricted modes, SFTP only, SCP only and Rsync only are mutually exclusive. If no mode is defined, then all connection types will be accepted. Only one mode can be enabled at a time:
SFTP_MODE
if "true" sshd will only accept sftp connectionsSFTP_CHROOT
if in sftp only mode sftp will be chrooted to this directory. Default "/data"SCP_MODE
if "true" sshd will only accept scp connections (uses rssh)RSYNC_MODE
if "true" sshd will only accept rsync connections (uses rssh)SSH uses host keys to identify the server. To avoid receiving a security warning the host keys should be mounted on an external volume.
By default this image will create new host keys in /etc/ssh/keys
which should be mounted on an external volume. If you are using existing keys and they are mounted in /etc/ssh
this image will use the default host key location making this image compatible with existing setups.
If you wish to configure SSH entirely with environment variables it is suggested that you externally mount /etc/ssh/keys
instead of /etc/ssh
.
Mount your .ssh credentials (RSA public keys) at /root/.ssh/
in order to
access the container via root and set SSH_ENABLE_ROOT=true
or mount each user's key in
/etc/authorized_keys/<username>
and set SSH_USERS
environment config to create the user accounts.
Authorized keys must be either owned by root (uid/gid 0), or owned by the uid/gid that corresponds to the
uid/gid and user specified in SSH_USERS
.
When in sftp only mode (activated by setting SFTP_MODE=true
) the container will only accept sftp connections. All sftp actions will be chrooted to the SFTP_CHROOT
directory which defaults to "/data".
Please note that all components of the pathname in the ChrootDirectory directive must be root-owned directories that are not writable by any other user or group (see man 5 sshd_config
).
When in scp or rsync only mode (activated by setting SCP_MODE=true
or RSYNC_MODE=true
respectively) the container will only accept scp or rsync connections. No chroot is provided.
This is provided by using rssh restricted shell.
Executable shell scripts and binaries can be mounted or copied in to /etc/entrypoint.d
. These will be run when the container is launched but before sshd is started. These can be used to customise the behaviour of the container.
Password authentication is not recommended however using SSH_ENABLE_PASSWORD_AUTH=true
you can enable password authentication. The image doesn't provide any way to set user passwords via config but you can use the custom scripts support to run a custom script to set user passwords.
Setting SSH_ENABLE_ROOT_PASSWORD_AUTH=true
also enables password authentification for the root account.
For example you could add the following script to /etc/entrypoint.d/
setpasswd.sh
#!/usr/bin/env bash set -e echo 'user1:$6$lAkdPbeeZR7YJiE3$ohWgU3LcSVit/hEZ2VOVKvxD.67.N9h5v4ML7.4X51ZK3kABbTPHkZUPzN9jxQQWXtkLctI0FJZR8CChIwz.S/' | chpasswd --encrypted # Or if you don't pre-hash the password remove the line above and uncomment the line below. # echo "user1:user1password" | chpasswd
It is strongly recommend to pre-hash passwords. Passwords that are not hashed are a security risk, other users may be able to read the setpasswd.sh
script and see all other users passwords and keeping plain text passwords is considered bad practice.
To generate a hashed password use mkpasswd
which is available in this image or use https://trnubo.github.io/passwd.html to generate a hash in your browser. Example use of mkpasswd
below.
$ docker run --rm -it --entrypoint /usr/bin/env quay.io/panubo/sshd:1.9.0 mkpasswd
Password:
$6$w0ZvF/gERVgv08DI$PTq73dIcZLfMK/Kxlw7rWDvVcYvnWJuOWtxC7sXAYZL69CnItCS.QM.nTUyMzaT0aYjDBdbCH1hDiwbQE8/BY1
To start sshd with the setpasswd.sh
script
docker run -ti -p 2222:22 \
-v $(pwd)/keys/:/etc/ssh/keys \
-e SSH_USERS=user:1000:1000 \
-e SSH_ENABLE_PASSWORD_AUTH=true \
-v $(pwd)/entrypoint.d/:/etc/entrypoint.d/ \
quay.io/panubo/sshd:1.9.0
To enable password authentication on the root account, the previous setpasswd.sh
script must also define a password for the root user, then
the command will be:
docker run -ti -p 2222:22 \
-e SSH_ENABLE_ROOT_PASSWORD_AUTH=true \
-v $(pwd)/entrypoint.d/:/etc/entrypoint.d/ \
quay.io/panubo/sshd:1.9.0
The example below will run interactively and bind to port 2222
. /data
will be
bind mounted to the host. And the ssh host keys will be persisted in a keys
directory.
You can access with ssh root@localhost -p 2222
using your private key.
docker run -ti -p 2222:22 \
-v ${HOME}/.ssh/id_rsa.pub:/root/.ssh/authorized_keys:ro \
-v $(pwd)/keys/:/etc/ssh/keys \
-v $(pwd)/data/:/data/ \
-e SSH_ENABLE_ROOT=true \
quay.io/panubo/sshd:1.9.0
Create a www
user with gid/uid 48. You can access with ssh www@localhost -p 2222
using your private key.
docker run -ti -p 2222:22 \
-v ${HOME}/.ssh/id_rsa.pub:/etc/authorized_keys/www:ro \
-v $(pwd)/keys/:/etc/ssh/keys \
-v $(pwd)/data/:/data/ \
-e SSH_USERS="www:48:48" \
quay.io/panubo/sshd:1.9.0
For production usage, please use a versioned release rather than the floating 'latest' tag.
See the releases for tag usage and release notes.
Production ready and stable.
AI小说写作助手,一站式润色、改写、扩写
蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。
字节跳动发布的AI编程神器IDE
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。
全能AI智能助手,随时解答生活与工作的多样问题
问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。
实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让 全世界的语言交流不再有国界。
一键生成PPT和Word,让学习生活更轻松
讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。
深度推理能力全新升级,全面对标OpenAI o1
科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的 帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。
一种基于大语言模型的高效单流解 耦语音令牌文本到语音合成模型
Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。
AI助力,做PPT更简单!
咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。
选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。
专业的AI公文写作平台,公文写作神器
AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。
最新AI工具、AI资讯
独家AI资源、AI项目落地
微信扫一扫关注公众号