ubuntu 上配置开机自动启动ssh

一般安装了就会自动启动。但是各种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

相关推荐
readhere7 小时前
从ZYNQ7000开发板,学会启动嵌入式Linux系统——入门学习:EBAZ4205篇目录
linux·启动·嵌入式linux·zynq7000·ebaz4205
打工仔折腾 AI8 小时前
在 Ubuntu ARM64 部署 Q1 V3.0 MuJoCo 模型:加载、单步推理与执行器响应解析
linux·运维·人工智能·python·深度学习·ubuntu·性能优化
‎ദ്ദിᵔ.˛.ᵔ₎8 小时前
关于Linux 线程局部存储的认识
linux·运维
小小de风呀10 小时前
de风——【从零开始学习Linux】(九):进程基础 —— 从冯诺依曼体系到 fork 创建进程
linux·学习
晚风吹北巷12 小时前
Linux复习篇(自用)
linux·运维·服务器·1024程序员节
by2099912 小时前
Linux 压缩传输、进程查看与权限管理
linux·经验分享·1024程序员节
不是万能的豆学长13 小时前
OpenShell项目引爆GitHub趋势
ssh·github
无足鸟ICT13 小时前
【RHCA+】reboot命令(重启)
linux·运维·服务器·1024程序员节
DYWorker00114 小时前
第1课:基于正点原子RK3568开发板读懂Linux内核
linux·运维·网络