当前位置: 首页 > article >正文

随堂笔记0403

负载监控计算机核心资源CPU 计算lscpu内存 缓存数据掉电丢失硬盘 持久化存储数据网络 传播数据[rootCentos01 wyj]# lscpu CPU(s): 2 型号名称 Intel(R) Core(TM) Ultra 9 185H CPU MHz 3072.000给系统加负载[rootCentos01 wyj]# md5sum /dev/zero [rootCentos01 wyj]# md5sum /dev/zero 查看使用情况 top 命令使用PCPU降序排序 M内存降序排序top - 10:14:36 up 2:32, 2 users, load average: 0.94, 0.24, 0.11 Tasks: 432 total, 5 running, 427 sleeping, 0 stopped, 0 zombie %Cpu(s): 96.7 us, 3.3 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem: 3869044 total, 2628880 used, 1240164 free, 1564 buffers KiB Swap: 4079612 total, 0 used, 4079612 free. 1672804 cached Mem ​ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME COMMAND 12669 wyj 20 0 2065972 369100 9088 S 0.3 9.5 2:56.34 gnome-shell 1 root 20 0 53956 7008 2236 S 0.0 0.2 0:04.57 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kthreaddCPU指标%Cpu(s): 96.7 us, 3.3 sy 100%内存指标KiB Mem: 3869044 total, 2628880 used, 1240164 free, 1564 buffers清理进程[rootCentos01 wyj]# kill 2262 [rootCentos01 wyj]# kill 2253 [1]- 已终止 md5sum /dev/zero [2] 已终止 md5sum /dev/zero [rootCentos01 wyj]#磁盘容量[rootCentos01 wyj]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 46G 4.9G 41G 11% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 92K 1.9G 1% /dev/shm tmpfs 1.9G 9.0M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 497M 119M 379M 24% /boot硬盘速度模拟下载[rootCentos01 ~]# wget http://192.168.42.100/02.%E7%B3%BB%E7%BB%9F%E9%95%9C%E5%83%8F/CentOS-7-x86_64-DVD-2207-02.isoiotop 查看每个进程的读写速度可以排序[rootCentos01 ~]# yum install -y iotop [rootCentos01 ~]# iotop查看硬盘整体速度硬盘名称sda 第一块sata接口硬盘硬盘 sdb[rootCentos01 ~]# sar -dp 1 Linux 3.10.0-123.el7.x86_64 (Centos01) 2026年04月02日 _x86_64_ (2 CPU) ​ 10时20分26秒 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 10时20分27秒 sda 6.93 95.05 0.00 13.71 0.01 0.86 0.86 0.59 10时20分27秒 centos-swap 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10时20分27秒 centos-root 6.93 95.05 0.00 13.71 0.01 0.86 0.86 0.59 读写单位是k rd_sec/s wr_sec/s清理文件[rootCentos01 wyj]# rm CentOS-7-x86_64-DVD-2207-02.iso rm是否删除普通文件 CentOS-7-x86_64-DVD-2207-02.isoy网卡[rootCentos01 ~]# sar -n DEV 1 Linux 3.10.0-123.el7.x86_64 (Centos01) 2026年04月03日 _x86_64_ (2 CPU) ​ 09时18分35秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s 09时18分36秒 eno16777736 10.00 24.00 0.77 34.71 0.00 0.00 0.00 09时18分36秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 ​ rxkB/s 接收 txkB/s 发送 1 1秒刷新一次服务管理pid为1的程序是systemd也是系统第一个进程负责操作系统整个资源的管理。 系统中服务也由systemd管理。systemctl 命令语法systemctl action service-name action: status start stop restart enalbe disable is-active is-enabled service-name: sshd firewalld mysqldsystemd与systemctl关系systemd 一直运行的程序守护进程systemctl 是给systemd下指令的工具人与机器之间交互使用。类比与web服务器httpd浏览器访问页面查看服务状态[rootCentos01 wyj]# systemctl status sshd sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: active (running) since 三 2026-04-01 18:28:31 CST; 16h ago Process: 1553 ExecStartPre/usr/sbin/sshd-keygen (codeexited, status0/SUCCESS) Main PID: 1565 (sshd) CGroup: /system.slice/sshd.service └─1565 /usr/sbin/sshd -D # 运行记录 4月 01 18:28:32 Centos01 sshd[1565]: Server listening on 0.0.0.0 port 22. 4月 01 18:28:32 Centos01 sshd[1565]: Server listening on :: port 22. 4月 01 18:31:51 Centos01 sshd[13180]: Accepted password for root from 192.16...h2 4月 01 18:31:51 Centos01 sshd[13184]: Accepted password for root from 192.16...h2 4月 01 18:31:58 Centos01 sshd[13390]: Accepted password for root from 192.16...h2 4月 01 18:31:59 Centos01 sshd[13395]: Accepted password for root from 192.16...h2 4月 02 09:18:39 Centos01 sshd[36914]: Accepted password for root from 192.16...h2 4月 02 09:18:40 Centos01 sshd[36918]: Accepted password for root from 192.16...h2 4月 02 10:20:08 Centos01 sshd[59861]: Accepted password for root from 192.16...h2 4月 02 10:20:09 Centos01 sshd[59868]: Accepted password for root from 192.16...h2 Hint: Some lines were ellipsized, use -l to show in full.重点关注Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) 配置文件位置 /usr/lib/systemd/system/sshd.service 第一个enable 代表开机自动启动 第二个enable 暂不关注Active: active (running)停止服务[rootCentos01 wyj]# systemctl stop sshd [rootCentos01 wyj]# systemctl is-active sshd inactive [rootCentos01 wyj]# systemctl status sshd sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: inactive (dead) since 四 2026-04-02 11:14:54 CST; 52s ago使用工具再次连接连接不上去服务未启动。启动服务[rootCentos01 wyj]# systemctl start sshd [rootCentos01 wyj]# systemctl is-active sshd active使用工具再次连接能连接上服务启动。禁止sshd服务开机启动[rootCentos01 wyj]# systemctl disable sshd rm /etc/systemd/system/multi-user.target.wants/sshd.service [rootCentos01 wyj]# systemctl is-enabled sshd disabled重启验证机器启动后是否可以通过终端工具登录不行[rootCentos01 wyj]# reboot设置sshd服务开机启动[rootCentos01 wyj]# systemctl enable sshd ln -s /usr/lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service [rootCentos01 wyj]# systemctl is-enabled sshd enabled重启验证机器启动后是否可以通过终端工具登录行[rootCentos01 wyj]# reboot开发一个服务[rootcentos7 ~ 16:15:19]# vim /usr/local/bin/study #!/bin/bash # 第一行内容是脚本的 解释器声明shebang指定该脚本使用 /bin/bash 作为解释器执行。系统会根据这一行找到对应的 shell 程序来解析后续命令。 ​ # 启动一个无限循环while 是循环关键字true 是一个永远为真的条件因此这个循环会一直执行下去直到被外部终止如 CtrlC。 while true ​ # 循环体的开始标记do 和后面的 done 之间的内容是循环中重复执行的命令。 do # 执行 date 命令获取当前系统时间并通过 $(...) 捕获其输出将结果赋值给变量 DATE。 DATE$(date) # echo 命令输出字符串其中 $DATE 会被替换为变量的值 # 是追加重定向符号将输出内容追加到 /var/log/study.log 文件中 # 最终输出内容类似 Fri Oct 31 10:00:00 CST 2025: IM studying [ Linux ]。 echo $DATE: IM studying [ Linux ] /var/log/study.log # 让脚本暂停执行 5 秒sleep 命令用于延迟单位默认为秒避免循环执行过快。 sleep 5 ​ # 循环体的结束标记与前面的 while 和 do 配合标志着一次循环的结束。 done开发服务准备服务程序 /usr/local/bin/study准备服务配置文件 /etc/systemd/system/studyd.service (程序后面的ddaemon守护称呼)通知systemd 变化 systemctl daemon-reload激活服务 systemctl enable studyd --now复习 vim[rootcentos7 ~ 14:28:48]# cp /usr/lib/systemd/system/sshd.service /etc/systemd/system/studyd.service [rootcentos7 ~ 14:28:48]# vim /etc/systemd/system/studyd.service 1. :set nu 显示行号 2. 3,5d 【或者 光标移动到第三行d3d】 删除3-5行 3. 5,6d 删除5-6行 4. 6,9d 删除6-9行 5. /Open 搜索并定位到特定字符串位置 6. cw change word替换一个单词自动进入插入模式输入study按esc 7. /sbin 搜索C删除到最后并进入插入模式补全路径local/bin/study按esc 8. ZZ 保存退出。 ​ 最终文件内容如下 [Unit] Descriptionstudy server daemon ​ [Service] ExecStart/usr/local/bin/study ​ [Install] WantedBymulti-user.target ​ 补充 u 撤销上一步操作 ctrlr 重做上一步操作分析sshd建立连接流程操作步骤windows 管理员身份打开cmd执行arp -d 192.168.100.101(自己Linux服务IP开启wireshark捕捉vmware 8 nat网卡流量使用终端登录 Linux 服务分析 抓包结果OSI 七层模型。ssh工具使用windows中使用普通命令行操作1. ssh 192.168.100.101 2. ssh root192.168.100.101或者ssh wyj192.168.100.101 3-1. ssh wyj192.168.100.101 hostname 3-2. ssh wyj192.168.100.101 id为自己创建一个普通 wang 用户并设置密码[rootCentos01 ~]# useradd wang [rootCentos01 ~]# echo 123 | passwd --stdin wang 更改用户 wang 的密码 。 passwd所有的身份验证令牌已经成功更新。配置 ssh 工具配置文件如果.ssh目录不存在执行以下命令切用户 su - wang 要有- [wangCentos01 ~]$ ssh localhost # 然后ctrlc 停止即可准备配置文件[wangCentos01 ~]$ cp /etc/ssh/ssh_config .ssh/config [wangCentos01 ~]$ vim .ssh/config # 删除前19行 # 取消相应行注释 Host * # 新增 User 行指明默认登录用户 User root ​ # 首次登录不要提示输入yes/no(不要对主机key校验) # StrictHostKeyChecking ask StrictHostKeyChecking no验证[wangCentos01 ~]$ ssh 192.168.100.101 Warning: Permanently added 192.168.100.101 (ECDSA) to the list of known hosts. root192.168.100.101s password:ssh命令行传递密码工具 sshpass[rootCentos01 ~]# yum install -y sshpass确保之前连接过记得输入yes[wyjCentos01 root]$ ssh root192.168.100.101 The authenticity of host 192.168.100.101 (192.168.100.101) cant be established. ECDSA key fingerprint is db:95:2e:65:8b:15:dd:e1:a9:89:5f:2b:a3:bf:bc:49. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 192.168.100.101 (ECDSA) to the list of known hosts. ​ # 接下来传递密码登录 [wyjCentos01 root]$ sshpass -p 123456 ssh root192.168.100.101 id # 显示结果如下 uid0(root) gid0(root) 组0(root) 环境unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023配置使用秘钥登录window 终端工具使用秘钥登录Linux生成密钥对私钥和公钥将公钥复制给Linux服务器测试生成密钥对私钥和公钥xshell 为例 工具-用户秘钥管理者-生成打开界面基本上是下一步即可。 找到用户秘钥-属性-公钥标签复制公钥。例如ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAt9zyALQw0LFzUy8Q84NetuGDbixDaJWl83eieWGhOLQhC8iVxseetPB9yU42xXv7b1LJVcrlC3FbaxYue1xAmY3edBXmjQ/xne4rQ6G14NzqsIeXqjrNwP31tp2y5UeQ84rCx3cYcOXeTyqnsJFFMBeSU7AS0IajG5yPe026VdAo5wyAxVTkqKDcHiQwPoqLbviqNcqjyu87cn2tIKcgIi1NIXEnpyjHnqTewlIhGxVHx53j1R326Zod2ynKdhhqXU5rNsWEBkFwCDQ1vcF8FCtm7eQGncDcwkDbZ3rix01eqJipe5vkT1nYPUnmOZd/Co8HRBO4Nc9KBnw rsa 2048-20260406写入对方文件~/.ssh/authorized_keys[wyjCentos01 ~]$ vim .ssh/authorized_keys [wyjCentos01 ~]$ ll .ssh/authorized_keys -rw-rw-r-- 1 laoma laoma 394 4月 3 09:47 .ssh/authorized_keys [wyjCentos01 ~]$ chmod 600 .ssh/authorized_keys登录时候选择验证方式公钥并指定对应公钥。刚刚实现 windows 使用 laoma 用户秘钥登录 centos7 思考如何实现 windows 使用 root 用户秘钥登录 centos7[rootcentos7 ~ 10:19:01]# cat /home/laoma/.ssh/authorized_keys /root/.ssh/authorized_keysssh 工具配置文件 ~/.ssh/config用户级别给用户自己定制优先级更高 /etc/ssh/ssh_config系统全局级别默认设置针对系统中所有用户生效 sshd 服务配置文件 /etc/ssh/sshd_config针对sshd服务生效。控制root用户登录。因为所有Linux系统管理员都是root防止暴力破解。PermitRootLogin no 禁止登录 PermitRootLogin without-password 禁止使用密码登录[rootcentos7 ~ 10:21:06]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.20260403 [rootcentos7 ~ 10:30:16]# vim /etc/ssh/sshd_config 1. /Root定位。如果第一个搜索到的内容不是需要的使用nnext查找下一个。 2. yy 复制对应行p 粘贴到下一行。保留原有行 3. 自行删除第一# 4. w 跳转到yes位置cw 替换一个单词输入without-password按esc 5. ZZ 保存退出。 6. 重新加载服务 [rootcentos7 ~ 10:34:57]# systemctl restart sshd 7. 验证 ​ ## 禁止密码登录。 PasswordAuthentication no # 验证 DenyUsers, AllowUsers, DenyGroups,AllowGroups 例如AllowUsers laoma ​ [rootCentos01 ~]# man sshd_config 找PermitRootLogin支持参数 man 帮助 man 帮助 命令 --help 查询命令 如果查询配置文件如何写 man 配置文件名例如man sshd_config 搜索 Root/Root 软件包升级 # 查询软件包版本 [rootcentos7 ~ 11:01:38]# rpm -q openssh-server openssh-server-7.4p1-22.el7_9.x86_64 ​ # 查询可用版本 [rootcentos7 ~ 11:12:51]# yum list openssh-server --showduplicates 已加载插件fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com 已安装的软件包 openssh-server.x86_64 7.4p1-22.el7_9 anaconda 可安装的软件包 openssh-server.x86 _64 7.4p1-21.el7 base openssh-server.x86_64 7.4p1-22.el7_9 updates openssh-server.x86_64 7.4p1-23.el7_9 updates ​ # 升级到最新版本 [rootcentos7 ~ 11:15:25]# yum update -y openssh-server # 测试 参数 /etc/ssh/sshd_config 中参数 PermitRootLogin prohibit-password ​ 软件包升级 日志装centos7vmware 三种网络模式桥接主机NAT实验bash-completion 命令行补全 vim 高亮显示编辑器 open-vm-tools vmware 更好地控制虚拟机 lrzsz 上传和下载 unzip 解压zip rsync 同步sshpass 传递密码日志systemd-journal systemd子系统rsyslog 服务对应rsyslog 将日志记录到对应的文件中 | /var/log/messages | 大多数系统日志排除认证、邮件、定时任务、调试日志 | | /var/log/secure | 安全/认证相关日志如ssh登录、用户验证 | | /var/log/maillog | 邮件服务相关日志如sendmail/postfix | | /var/log/cron | 定时任务执行日志crontab/anacron | | /var/log/boot.log | 系统启动过程中的非syslog控制台消息 |实验一修改sshd_config内容导致错误 [rootcentos7 ~ 15:15:08]# tail -f /var/log/secure 新增加一个ssh连接日志更新内容如下 Apr 3 15:17:44 centos7 sshd[1292]: Accepted password for laoma from 10.1.8.1 port 5350 ssh2 Apr 3 15:17:44 centos7 sshd[1292]: pam_unix(sshd:session): session opened for user laoma by (uid0) ​ 断开连接日志更新内容如下 Apr 3 15:18:39 centos7 sshd[1292]: pam_unix(sshd:session): session closed for user laoma ​ 模拟sshd故障并排故。 模拟 [rootcentos7 ~ 15:20:35]# cp /etc/ssh/sshd_config{,.0403} [rootcentos7 ~ 15:20:43]# echo hello world /etc/ssh/sshd_config [rootcentos7 ~ 15:21:53]# systemctl restart sshd Job for sshd.service failed because the control process exited with error code. See systemctl status sshd.service and journalctl -xe for details. ​ # 根据提示 查看状态 [rootcentos7 ~ 15:22:22]# systemctl status sshd.service ● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Fri 2026-04-03 15:22:22 CST; 27s ago Docs: man:sshd(8) man:sshd_config(5) Process: 1342 ExecStart/usr/sbin/sshd -D $OPTIONS (codeexited, status255) Main PID: 1342 (codeexited, status255) ​ Apr 03 15:22:22 centos7.laoma.cloud systemd[1]: sshd.service: main process exited, codeexited, status255/n/a Apr 03 15:22:22 centos7.laoma.cloud systemd[1]: Failed to start OpenSSH server daemon. Apr 03 15:22:22 centos7.laoma.cloud systemd[1]: Unit sshd.service entered failed state. Apr 03 15:22:22 centos7.laoma.cloud systemd[1]: sshd.service failed. ​ # 状态日志没有对应提示信息 ​ # 继续查看message日志 [rootcentos7 ~ 15:23:40]# tail /var/log/messages Apr 3 15:23:04 centos7 systemd: sshd.service failed. Apr 3 15:23:47 centos7 systemd: sshd.service holdoff time over, scheduling restart. Apr 3 15:23:47 centos7 systemd: Stopped OpenSSH server daemon. Apr 3 15:23:47 centos7 systemd: Starting OpenSSH server daemon... Apr 3 15:23:47 centos7 sshd: /etc/ssh/sshd_config: line 141: Bad configuration option: hello Apr 3 15:23:47 centos7 sshd: /etc/ssh/sshd_config: terminating, 1 bad configuration options # 发现 141 行有问题。 # 根据提示修复。 ​ [rootcentos7 ~ 15:25:50]# vim /etc/ssh/sshd_config # 注释最后一行 #hello world ​ [rootcentos7 ~ 15:26:10]# systemctl restart sshd [rootcentos7 ~ 15:26:17]# systemctl is-active sshd active ​ 补充 快速创建多个文件 [rootcentos7 ~ 15:20:05]# echo /etc/ssh/sshd_config-{1,2} [rootcentos7 ~ 15:20:05]# echo /etc/ssh/sshd_config-{1,2} /etc/ssh/sshd_config-1 /etc/ssh/sshd_config-2 [rootcentos7 ~ 15:20:11]# echo /etc/ssh/sshd_config-{,2} /etc/ssh/sshd_config- /etc/ssh/sshd_config-2 [rootcentos7 ~ 15:20:22]# echo /etc/ssh/sshd_config{,.0403} /etc/ssh/sshd_config /etc/ssh/sshd_config.0403 ​ 实验二移走sshd_config导致错误 # 故障2 [rootcentos7 ~ 16:04:31]# mv /etc/ssh/sshd_config /tmp [rootcentos7 ~ 15:39:13]# systemctl restart sshd Job for sshd.service failed because the control process exited with error code. See systemctl status sshd.service and journalctl -xe for details. [rootcentos7 ~ 15:46:05]# journalctl -e -u sshd ... ... Apr 03 15:45:32 centos7.laoma.cloud systemd[1]: Failed to start OpenSSH server daemon. Apr 03 15:45:32 centos7.laoma.cloud systemd[1]: Unit sshd.service entered failed state. Apr 03 15:45:32 centos7.laoma.cloud systemd[1]: sshd.service failed. Apr 03 15:46:05 centos7.laoma.cloud polkitd[676]: Registered Authentication Agent for unix-process:1504:240860 (syst Apr 03 15:46:05 centos7.laoma.cloud systemd[1]: Stopped OpenSSH server daemon. Apr 03 15:46:05 centos7.laoma.cloud systemd[1]: Starting OpenSSH server daemon... Apr 03 15:46:05 centos7.laoma.cloud sshd[1510]: /etc/ssh/sshd_config: No such file or directory Apr 03 15:46:05 centos7.laoma.cloud systemd[1]: sshd.service: main process exited, codeexited, status1/FAILURE Apr 03 15:46:05 centos7.laoma.cloud systemd[1]: Failed to start OpenSSH server daemon. Apr 03 15:46:05 centos7.laoma.cloud systemd[1]: Unit sshd.service entered failed state. Apr 03 15:46:05 centos7.laoma.cloud systemd[1]: sshd.service failed. Apr 03 15:46:05 centos7.laoma.cloud polkitd[676]: Unregistered Authentication Agent for unix-process:1504:240860 ​ # 发现 /etc/ssh/sshd_config: No such file or directory ​ # 查询文件哪个软件包提供 [rootcentos7 ~ 15:48:16]# yum provides /etc/ssh/sshd_config Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com openssh-server-7.4p1-21.el7.x86_64 : An open source SSH server daemon Repo : base Matched from: Filename : /etc/ssh/sshd_config ​ ​ ​ openssh-server-7.4p1-22.el7_9.x86_64 : An open source SSH server daemon Repo : updates Matched from: Filename : /etc/ssh/sshd_config ​ # yum-utils提供yumdownloader用于下载软件包 [rootcentos7 ~ 15:51:19]# yum install -y yum-utils [rootcentos7 ~ 15:51:19]# yumdownloader openssh-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com openssh-server-7.4p1-23.el7_9.x86_64.rpm | 459 kB 00:00:03 [rootcentos7 ~ 15:51:47]# ls openssh* openssh-server-7.4p1-23.el7_9.x86_64.rpm # rpm是一个特殊格式的文件里面文件通过 cpio 压缩。 ​ # 查看软件包中文件 [rootcentos7 ~ 15:56:17]# rpm2cpio openssh-server-7.4p1-23.el7_9.x86_64.rpm | cpio -t ./etc/pam.d/sshd ./etc/ssh/sshd_config ./etc/sysconfig/sshd ./usr/lib/systemd/system/sshd-keygen.service ./usr/lib/systemd/system/sshd.service ./usr/lib/systemd/system/sshd.socket ./usr/lib/systemd/system/sshd.service ./usr/lib64/fipscheck/sshd.hmac ./usr/libexec/openssh/sftp-server ./usr/sbin/sshd ./usr/sbin/sshd-keygen ./usr/share/man/man5/moduli.5.gz ./usr/share/man/man5/sshd_config.5.gz ./usr/share/man/man8/sftp-server.8.gz ./usr/share/man/man8/sshd.8.gz ./var/empty/sshd 1946 blocks ​ # 直接提取对应文件 [rootcentos7 ~ 15:56:47]# rpm2cpio openssh-server-7.4p1-23.el7_9.x86_64.rpm | cpio -id ./etc/ssh/sshd_config # 验证 [rootcentos7 ~ 15:57:23]# yum install -y tree [rootcentos7 ~ 15:57:18]# tree etc etc └── ssh └── sshd_config ​ 1 directory, 1 file # 将软件包里的sshd_config文件放入/etc/ssh [rootcentos7 ~ 16:18:57]# mv etc/ssh/sshd_config /etc/ssh [rootcentos7 ~ 15:57:51]# systemctl restart sshd ​ ​ # 补充 命令行快捷键 ctrlr 搜索历史命令回车执行。

相关文章:

随堂笔记0403

负载监控计算机核心资源:CPU: 计算(lscpu)内存: 缓存数据(掉电丢失)硬盘: 持久化存储数据网络: 传播数据[rootCentos01 wyj]# lscpuCPU(s): 2型号名称&am…...

绝地求生自动压枪解决方案:告别后坐力困扰,提升射击精准度

绝地求生自动压枪解决方案:告别后坐力困扰,提升射击精准度 【免费下载链接】logitech-pubg PUBG no recoil script for Logitech gaming mouse / 绝地求生 罗技 鼠标宏 项目地址: https://gitcode.com/gh_mirrors/lo/logitech-pubg 在激烈的绝地求…...

OpenClaw环境迁移指南:将Phi-3-mini-128k-instruct配置复制到新电脑

OpenClaw环境迁移指南:将Phi-3-mini-128k-instruct配置复制到新电脑 1. 为什么需要环境迁移? 上周我的主力开发机突然硬盘故障,虽然数据最终恢复,但重装OpenClaw环境的过程让我意识到:自动化工具的配置迁移应该像备份…...

tmux和screen对比

tmux和screen都是优秀的终端复用器,核心功能相似:在单个终端窗口中创建多个持久化的虚拟终端会话,实现会话保持、窗口分割和多任务管理。 核心对比概括: tmux:设计更现代,功能更强大灵活,配置…...

A53安全启动基石——TrustZone在A53中的硬件实现

该文章同步至公众号OneChan 开篇:回答上篇进阶思考 在上一篇探讨复位启动的种种陷阱后,我们留下的五个进阶思考问题,现在结合安全启动和TrustZone的特性进行分析: 1. 量子不确定性对复位电路的影响 量子隧穿效应:在…...

将软件需求“翻译”成硬件语言:一份让设计团队无法拒绝的黄金文档

该文章同步至公众号OneChan ——如何用硬件工程师的思维,赢得他们的尊重与代码 你提交的不是一份“需求清单”,而是一份“缺陷预防方案”和“效率提升指南”。 引言:一次代价高昂的“翻译失败” 数年前,我参与一个关键IP的开发。…...

Linux系统管理员必备命令大全

1. Linux命令概述作为一名Linux系统管理员,掌握常用命令是基本功。Linux命令是操作系统与用户交互的主要方式,通过命令行可以完成几乎所有系统管理任务。与图形界面相比,命令行操作更加高效、灵活,特别是在远程管理和自动化脚本方…...

PostgreSQL 选择数据库

PostgreSQL 选择数据库 引言 在当今数据驱动的世界中,选择合适的数据库系统对于企业来说至关重要。PostgreSQL,作为一款功能强大、开源的关系型数据库管理系统(RDBMS),因其卓越的性能、灵活性和可扩展性而备受青睐。本文将深入探讨PostgreSQL的特点,分析为何它是众多数…...

ESP32驱动ST7796S LCD的PlatformIO标准组件

1. 项目概述 htcw_esp_lcd_st7796 是一个专为 PlatformIO(PIO)生态定制的 ESP-IDF 兼容 LCD 驱动组件,封装了 Espressif 官方 esp_lcd 驱动框架中对 ST7796S 显示控制器的支持。该组件并非独立实现底层时序逻辑,而是基于 ESP-I…...

Eclipse 添加书签的详细指南

Eclipse 添加书签的详细指南 引言 Eclipse 作为一款功能强大的集成开发环境(IDE),被广泛应用于Java编程和软件开发领域。书签功能是Eclipse提供的一个便捷的工具,可以帮助开发者快速定位到代码中的特定位置。本文将详细介绍如何在Eclipse中添加书签,以及如何管理和使用这…...

ATtiny85轻量级图形库应用与优化

1. Tiny Graphics Library:ATtiny85上的轻量级图形解决方案在嵌入式开发中,为资源受限的MCU添加图形显示功能一直是个挑战。今天我要分享的是一个特别适合ATtiny85等低资源处理器的图形库——Tiny Graphics Library。这个库最大的特点就是完全不需要显示…...

HTML5从零到精通全攻略,一周内精通前端最基本框架

这是一篇为“什么都不懂的初学者”准备的HTML5超详细入门长文。请注意,文章较长,但结构清晰,配有大量简单例子和实战环节。我们遵循从概念到实践,从简单到复杂的路径。 ⚠️ 长文预警与学习指南 本文旨在用一周左右的时间&#x…...

终极鸣潮自动化工具指南:3步实现智能后台战斗与资源收集

终极鸣潮自动化工具指南:3步实现智能后台战斗与资源收集 【免费下载链接】ok-wuthering-waves 鸣潮 后台自动战斗 自动刷声骸 一键日常 Automation for Wuthering Waves 项目地址: https://gitcode.com/GitHub_Trending/ok/ok-wuthering-waves ok-ww是一款基…...

UI UX PRO MAX怎么做

4月6日 ui ux 能够自动设计项目...

网络SEO优化与移动端优化的关系是什么

网络SEO优化与移动端优化的关系:为什么两者不可分割 在当前互联网时代,网络SEO优化与移动端优化的关系越来越受到企业和营销人员的关注。随着移动互联网的普及,越来越多的用户通过手机浏览器进行网络搜索和浏览。因此,如何在网络…...

AlienFX Tools终极控制方案:彻底释放Alienware设备潜力的完整攻略

AlienFX Tools终极控制方案:彻底释放Alienware设备潜力的完整攻略 【免费下载链接】alienfx-tools Alienware systems lights, fans, and power control tools and apps 项目地址: https://gitcode.com/gh_mirrors/al/alienfx-tools 如果你对Alienware官方臃…...

鸿蒙_ArkTS解决Duplicate function implementation错误

在鸿蒙应用开发中编写自定义构建函数时遇到了Error Message: Duplicate function implementation.错误,原因是在多个不同页面(.ets文件)中使用了相同名称的组件外自定义构建函数,导致预览器报错:导致报错的代码如下&am…...

Windows下OpenClaw安装指南:一键部署gemma-3-12b-it镜像

Windows下OpenClaw安装指南:一键部署gemma-3-12b-it镜像 1. 为什么选择OpenClawGemma组合 去年第一次听说OpenClaw时,我正被各种重复性工作折磨——每天要手动整理几十份会议纪要、处理上百封邮件。作为一个技术出身的效率控,我本能地抗拒这…...

Flutter 自定义 Widget:打造独特的用户界面

Flutter 自定义 Widget:打造独特的用户界面突破内置组件的局限,创造属于你自己的 UI 组件。一、自定义 Widget 的意义 作为一名追求像素级还原的 UI 匠人,我深知内置组件的局限。有时候,设计稿上的那个特殊按钮,那个独…...

Stepper595:基于74HC595的轻量步进电机驱动库

1. Stepper595库概述:基于74HC595的轻量级步进电机驱动方案Stepper595是一个面向资源受限嵌入式平台的精简型步进电机控制库,其核心设计哲学是“用最少的硬件引脚、最简的时序逻辑、最低的代码开销实现可靠双电机协同控制”。该库不依赖传统GPIO逐位模拟…...

嵌入式开发必备硬件知识解析与应用

1. 嵌入式开发与硬件的关系解析作为一名在嵌入式领域摸爬滚打多年的工程师,我经常被新人问到一个经典问题:"做嵌入式软件开发是不是可以完全不懂硬件?"我的回答永远是:你可以选择不精通,但绝对不能完全不懂。…...

OpenClaw技能市场挖掘:千问3.5-9B增强插件TOP5

OpenClaw技能市场挖掘:千问3.5-9B增强插件TOP5 1. 为什么需要关注OpenClaw技能市场? 第一次接触OpenClaw时,我以为它只是个简单的自动化脚本工具。直到在项目里连续熬了三个深夜处理邮件分类和会议纪要,才意识到自己错过了什么—…...

AI模型平台进入深水区:技术落地能力成胜负手

AI模型平台进入深水区:技术落地能力成胜负手 随着AI技术在各行业加速渗透,模型平台已成为企业智能化转型的关键基础设施。当前市场格局下,百度千帆、阿里ModelScope、华为ModelArts与新兴的模力方舟(MoArk)正在上演一场关于技术落地能力的终极…...

锁相双极性PWM电机驱动原理与STM32实现

1. 项目概述Motor_LockedAntiphase是一个面向嵌入式电机控制的轻量级驱动库,专为实现锁相双极性PWM(Locked Antiphase PWM)控制模式而设计。该模式广泛应用于直流有刷电机(DC Brushed Motor)的双向调速与精确力矩控制场…...

告别环境冲突|Anaconda实战:AI开发全流程(数据→训练→部署)环境标准化指南,建议收藏

摘要:告别环境冲突、依赖地狱、复现失败!本文以 Anaconda 为核心,打造一套可复制、可迁移、可团队协作的 AI 全流程标准化方案,覆盖环境初始化→数据预处理→模型训练→打包部署,一套流程通吃个人实验与工程落地。前言…...

AI Agent 时代的分布式闭源众创 AI Coding 云编程平台 (CSCD) 实现原理与生产应用

AI Agent 时代的分布式闭源众创 AI Coding 云编程平台 (CSCD) 实现原理与生产应用 文章目录 AI Agent 时代的分布式闭源众创 AI Coding 云编程平台 (CSCD) 实现原理与生产应用 第 1 章 AI Agent 时代与 CSCD 平台概述 1.1 AI Agent 时代的到来 1.1.1 从传统编程到 AI 辅助编程的…...

AD09 PCB设计技巧与实战经验分享

1. PCB设计基础与AD09软件概述作为一名从业十年的硬件工程师,我使用Altium Designer(简称AD)完成了近百个PCB设计项目,从简单的双面板到复杂的八层板都有涉及。AD09虽然是比较早期的版本,但其核心功能已经非常完善&…...

Vibe Coding 工具实战案例全解:Cursor、Claude Code、Codex 真实项目 30 分钟到 4 小时快速构建指南(2026 年最新)

Vibe Coding 工具实战案例(2026 年最新)以下是 3 个真实可复现的 Vibe Coding 实战案例,覆盖主流工具(Cursor、Claude Code、OpenAI Codex),从简单入门到中大型项目。每个案例都包含: 项目场景 核心 Prompt 示例 完整操作流程 实际效果 + 耗时 关键技巧(避坑) 这些案例…...

嵌入式开发中全局变量的优化实践与替代方案

1. 嵌入式开发中的全局变量困境作为一名在嵌入式领域摸爬滚打多年的工程师,我见过太多因为滥用全局变量而陷入维护噩梦的项目。记得刚入行时接手过一个智能家居控制器的代码库,打开项目一看,光是extern声明的全局变量就有200多个,…...

Vibe Coding 详解:Karpathy 氛围编程的概念、原理、5层工作流结构与对比图

Vibe Code(或 Vibe Coding,中文常译为“氛围编程”或“气氛编程”) 是 2025 年初由 OpenAI 联合创始人 Andrej Karpathy 提出的一个编程新范式/工作流。它不是某个具体的软件或工具,而是一种用 AI 代替手动写代码的开发方式&#…...