技术栈

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(六)--创建镜像
相关推荐
linjoe99
3 小时前
【Deep Learning】Ubuntu配置深度学习环境
人工智能·深度学习·ubuntu
Empty_777
4 小时前
SELinux安全上下文
linux·服务器·安全
bug攻城狮
5 小时前
解决Ubuntu中apt-get -y安装时弹出交互提示的问题
linux·运维·ubuntu
xiachong27
5 小时前
ubuntu18.04安装PCL1.14
linux·ubuntu
夜阑珊夭夭
5 小时前
linux自定义网卡名字
linux·运维
czhc1140075663
5 小时前
Linux912 shell:$# $1 $?;RHEL 8 AppStream BaseOS
linux
佛天华
6 小时前
centos 时间校准
linux·运维·centos
小柯J桑_
7 小时前
Linux:线程封装
linux·运维·c++
先锋队长
7 小时前
linux系统搭建nacos集群,并通过nginx实现负载均衡
linux·nginx·负载均衡
zwhSunday
7 小时前
Linux驱动开发(1)概念、环境与代码框架
linux·运维·驱动开发
热门推荐
01UV安装并设置国内源02conda中设置镜像地址(附所有可换的地址)03GitHub 镜像站点04KGG转MP3工具|非KGM文件|解密音频05A股预测还能更准?开源大模型Kronos带你跑通预测+回测全流程06UV 工具安装与国内镜像源配置指南07突破百度网盘的下载限速,两种方法教会你【超详细】0846个Nano-banana 精选提示词,持续更新中09Spec-Kit 使用指南10保姆级教程:手把手教你用Dify实现完美多轮对话(附Chatflow和提示词)