技术栈

ubuntu 上配置开机自动启动ssh

helloDesword2024-07-11 20:25

一般安装了就会自动启动。但是各种rc.local, cron都测试了一下,还是这个systemd有效

使用 systemd 服务

创建文件

sudo nano /etc/systemd/system/custom-ssh.service

bash 复制代码
[Unit]
Description=Start SSH service at boot
After=network.target

[Service]
ExecStart=/usr/sbin/service ssh start
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

sudo systemctl enable custom-ssh.service

sudo systemctl start custom-ssh.service

上一篇:【LeetCode】字母异位词分组
下一篇:docker(六)--创建镜像
相关推荐
zzzzzz310
21 小时前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
XIAOHEZIcode
21 小时前
Linux系统鼠标偏移常见原因以及修复方案
linux·运维·游戏
A小辣椒
3 天前
TShark:Wireshark CLI 功能
linux
A小辣椒
3 天前
TShark:基础知识
linux
AlfredZhao
3 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao
4 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户971835633466
4 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪
4 天前
linux 拷贝文件或目录到指定的位置
linux
摇滚侠
5 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
bush4
5 天前
嵌入式linux学习记录十四、术语
linux·嵌入式
热门推荐
012026年6月AI行业全景:从百模大战到Agent元年,这30天发生了什么?022026年6月AI大模型全景报告:GPT-5.6、Claude Opus 4.8、Gemini 3.5,中美AI三足鼎立谁主沉浮?03GitHub 镜像站点04【AI】2026 年具身智能模型和世界模型总结052026 年 AI 编程工具终极横评:Cursor vs Claude Code vs Copilot vs Windsurf06AI科技热点日报 | 2026年6月1日07AI一周事件 · 2026-06-03 至 2026-06-0908Claude Code、Codex、Cursor三分天下:2026年AI编程Agent生态全景剖析09上线仅72小时被强制下架:Claude Fable 5 的短命10Codex 下载安装指南:Windows 和 macOS 官方版下载