Tiny Core Linux SSH 配置

在VMware环境下,本文详细介绍了如何在Tiny Core Linux中安装并配置SSH服务器,包括设置监听端口、用户登录控制、验证方式等,以增强系统的远程登录安全性。
部署运行你感兴趣的模型镜像

环境:VMware

目标:安装好TinyCore之后希望在虚拟机外用终端工具登录。


安装SSH:

openssh.tcz

安装好之后:

cd   /usr/local/etc/ssh
sudo cp ssh_config.example ssh_config
sudo cp sshd_config.example sshd_config
sudo /usr/local/etc/init.d/openssh start


此时还需要将ssh开机启动:
打开Apps ==> Apps ==> Maintenance ==> OnBoot Maintenance.
右边OnBoot items (Onboot.lst)表示开机默认加载的apps,左边一栏select是可以选择并加入开机启动的程序。
选择OpenSSH.tcz并加入右边。


保存ssh的配置,设置要保存修改的目录列表,用vi修改成如下:

root@box:/home/tc# cat /opt/.filetool.lst 
opt
home
etc/shadow  //用于保存用户密码
etc/passwd  //用于保存用户密码
usr/local/etc/ssh  //用于保存SSH配置信息

设置SSH

SSH的配置文件:
sshd服务的配置文件默认在/etc/ssh/sshd_config,正确调整相关配置项,可以进一步提高sshd远程登录的安全性。
配置文件的内容可以分为以下三个部分:

1、常见SSH服务器监听的选项如下:
Port 22                    //监听的端口为22
Protocol 2                //使用SSH V2协议
ListenAdderss 0.0.0.0    //监听的地址为所有地址

AddressFamily any
UseDNS no                //禁止DNS反向解析

2、常见用户登录控制选项如下:
PermitRootLogin no            //禁止root用户登录
PermitEmptyPasswords no        //禁止空密码用户登录
LoginGraceTime 2m            //登录验证时间为2分钟
MaxAuthTries 6                //最大重试次数为6

AllowUsers user            //只允许user用户登录,与DenyUsers选项相反


3、常见登录验证方式如下:
PasswordAuthentication yes                //启用密码验证
PubkeyAuthentication yes                    //启用秘钥验证

AuthorsizedKeysFile .ssh/authorized_keys    //指定公钥数据库文件


配置完成之后:

sudo /usr/local/etc/init.d/openssh restart


附完整配置文件:

root@box:/home/tc# cat /usr/local/etc/ssh/sshd_config
#       $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 22
AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
Protocol 2

# HostKey for protocol version 1
#HostKey /usr/local/etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /usr/local/etc/ssh/ssh_host_rsa_key
#HostKey /usr/local/etc/ssh/ssh_host_dsa_key
#HostKey /usr/local/etc/ssh/ssh_host_ecdsa_key
#HostKey /usr/local/etc/ssh/ssh_host_ed25519_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Ciphers and keying
#RekeyLimit default none

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
MaxAuthTries 6
MaxSessions 10

RSAAuthentication yes
PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /usr/local/etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem       sftp    /usr/local/libexec/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server

参考资料:

http://www.unixmen.com/install-openssh-tiny-core-linux/#sthash.mZQsjqKs.dpuf

http://m.blog.youkuaiyun.com/article/details?id=22155309

http://www.linuxidc.com/Linux/2013-07/88048.htm


您可能感兴趣的与本文相关的镜像

AutoGPT

AutoGPT

AI应用

AutoGPT于2023年3月30日由游戏公司Significant Gravitas Ltd.的创始人Toran Bruce Richards发布,AutoGPT是一个AI agent(智能体),也是开源的应用程序,结合了GPT-4和GPT-3.5技术,给定自然语言的目标,它将尝试通过将其分解成子任务,并在自动循环中使用互联网和其他工具来实现这一目标

<think>好的,我现在需要帮助用户了解如何制作或定制Tiny Core Linux的自定义ISO。首先,我需要回顾用户提供的引用内容,找出相关的信息点。 引用[1]提到Tiny Core Linux是模块化的,允许按需安装软件包,这可能涉及扩展系统功能的方法。引用[2]和[4]提到使用ISO文件启动系统,说明用户可能已经知道如何下载和启动,但需要定制。引用[4]还提到直接从ISO启动,可能暗示制作自定义ISO的流程。 接下来,我需要整理制作自定义ISO的基本步骤。通常,定制Linux发行版ISO需要挂载原ISO,修改文件系统,添加或删除软件包,然后重新打包。但Tiny Core的特殊之处在于它的模块化设计,所以可能使用不同的工具,比如tce-load来安装扩展,然后使用特定工具生成新ISO。 根据我的知识,Tiny Core Linux的定制通常包括启动到基础系统,安装必要扩展,配置系统,然后使用工具如“filetool.sh”备份更改,最后用“mkisofs”或类似工具生成ISO。需要确认这些步骤是否在引用中有支持。引用[1]提到按需安装软件包,所以tce-load应该是关键步骤。 用户可能还需要了解如何保存配置,因为Tiny Core默认在重启后不保存更改。引用[1]提到的模块化方法可能涉及持久化存储,比如使用备份文件(mydata.tgz)。这需要正确配置filetool.lst和运行备份命令。 生成ISO的步骤可能需要安装mkisofs工具,这在Tiny Core的仓库中可能有。需要指导用户安装该工具,然后使用命令打包文件系统为ISO。需要确保路径正确,例如将/boot中的核心文件包含进去。 此外,用户可能需要自定义内核或引导参数,但考虑到复杂性,可能先介绍基础配置。需要分步骤说明,从准备环境到安装扩展、配置、备份,最后生成ISO。 还要注意用户可能是在手机上操作,如引用[4]提到的,所以步骤需要适应命令行环境,可能没有图形界面。需要确保命令准确,并提示可能的依赖项,如编译工具或额外软件包。 最后,生成相关问题需要考虑用户可能的后续需求,比如持久化配置、添加驱动、调整ISO大小或自动化构建流程。</think>### Tiny Core Linux 定制与制作自定义ISO教程 Tiny Core Linux 的模块化特性使其非常适合按需定制。以下是制作自定义ISO的核心步骤: --- #### **一、基础环境准备** 1. **启动基础系统** - 下载官方ISO(例如 `Core-14.0.iso`)并启动到Tiny Core Linux环境[^1][^2]。 - 使用以下命令挂载ISO并访问文件系统(若需要): ```bash sudo mkdir /mnt/iso sudo mount -o loop Core-14.0.iso /mnt/iso ``` 2. **安装必要工具** - 安装编译工具和ISO生成依赖: ```bash tce-load -wi squashfs-tools genisoimage # 安装打包工具 ``` --- #### **二、系统功能扩展** 1. **通过TCE软件包扩展** - 使用 `tce-load` 安装所需软件(如Web服务器、开发工具): ```bash tce-load -wi nginx python3.10 # 示例安装Nginx和Python ``` 2. **持久化配置** - 编辑 `/opt/.filetool.lst`,添加需要备份的文件或目录(例如 `/home/tc/.ssh`)。 - 运行备份命令生成 `mydata.tgz`(包含自定义配置): ```bash filetool.sh -b ``` --- #### **三、构建自定义ISO** 1. **准备文件结构** - 复制原始ISO文件到工作目录,并解压核心组件: ```bash mkdir custom_iso cp -a /mnt/iso/* custom_iso/ # 复制原始ISO内容 ``` 2. **集成自定义内容** - 将持久化数据 `mydata.tgz` 和额外软件包复制到ISO目录: ```bash cp /mnt/sda1/mydata.tgz custom_iso/ cp -r /tmp/tce/optional/*.tcz custom_iso/ # 添加预装软件包 ``` 3. **生成新ISO** - 使用 `mkisofs` 打包新镜像: ```bash mkisofs -l -J -R -no-emul-boot -boot-load-size 4 \ -boot-info-table -b boot/isolinux/isolinux.bin \ -c boot/isolinux/boot.cat -o TinyCore-Custom.iso custom_iso/ ``` --- #### **四、验证与测试** 1. **通过QEMU模拟启动** ```bash qemu-system-x86_64 -cdrom TinyCore-Custom.iso -boot d ``` - 检查预装软件和配置是否生效[^3]。 --- #### **五、高级定制(可选)** - **内核修改**:替换 `/boot/vmlinuz` 并重新配置引导参数。 - **自动化脚本**:在 `/opt/bootlocal.sh` 中添加开机自启动命令。 - **精简体积**:删除未使用的模块或语言包以缩小ISO尺寸。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值