Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make a docker image of ssh mutual trust

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to make a docker image of ssh mutual trust". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to make a docker image of ssh mutual trust".

DockerfileFROM ubuntu:16.04# packageRUN apt-get update Apt-get-y install sshCOPY ssh_config / etc/ssh/ssh_config# sshRUN sed-I 's/UsePAM yes/UsePAM no/g' / etc/ssh/sshd_config & & sed-I' s/PermitRootLogin without-password/PermitRootLogin yes/g' / etc/ssh/sshd_configRUN echo "root:root" | chpasswdRUN echo "root ALL= (ALL) ALL" > / etc/sudoersRUN ssh-keygen-t rsa-f ~ / .ssh/id_rsa-P''& & \ cat ~ / .ssh/id_rsa.pub > > ~ / .ssh/authorized_keysRUN mkdir / var/run/sshdEXPOSE 22CMD ["sh" "- c", "service ssh start & & bash"] generate image docker build-t sshimage. / verify ssh mutual trust

Start the first docker container, then enter the bash and execute hostname-I to get the ip.

# docker run-- rm-it sshimageroot@cbdf1f5e7e0f:/# hostname-i172.17.0.4

Start another container and execute ssh $ip.

# docker run-- rm-it sshimage * Starting OpenBSD Secure Shell server sshd [OK] root@ecaa455762df:/# ssh 172.17.0.4Warning: Permanently added '172.17.0.4' (ECDSA) to the list of known hosts.root@cbdf1f5e7e0f:~# hostname-i172.17.0.4

As you can see, ssh is a success.

Thank you for reading, the above is the content of "how to make a docker image of ssh mutual trust". After the study of this article, I believe you have a deeper understanding of how to make a docker image of ssh mutual trust, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report