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

相关推荐
yuanpan1 分钟前
ubuntu系统上的conda虚拟环境导出方便下次安装
linux·ubuntu·conda
AOwhisky1 小时前
Linux 文本处理三剑客:awk、grep、sed 完全指南
linux·运维·服务器·网络·云计算·运维开发
Gavin_9151 小时前
从零开始部署经典开源项目管理系统最新版redmine6-Linux Debian12
linux·ruby on rails·开源·debian·ruby·redmine
xuanerya1 小时前
使用 SSH 方式克隆 GitHub 仓库没有权限解决办法
运维·ssh·github
花小璇学linux2 小时前
imx6ull-驱动开发篇31——Linux异步通知
linux·驱动开发·嵌入式软件
shelutai2 小时前
ubuntu 编译ffmpeg6.1 增加drawtext,libx264,libx265等
linux·ubuntu·ffmpeg
runfarther2 小时前
搭建LLaMA-Factory环境
linux·运维·服务器·python·自然语言处理·ai编程·llama-factory
hello_ world.2 小时前
RHCA10NUMA
linux
神秘人X7073 小时前
Linux高效备份:rsync + inotify实时同步
linux·服务器·rsync
轻松Ai享生活3 小时前
一步步学习Linux initrd/initramfs
linux