Files
public/install_ssh.sh

24 lines
454 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Ubuntu SSH安装脚本
# 简洁版本
echo "正在安装SSH服务器..."
# 更新包列表并安装SSH服务器
sudo apt update && sudo apt install openssh-server -y
# 启用并启动SSH服务
sudo systemctl enable ssh
sudo systemctl start ssh
# 生成SSH主机密钥
sudo ssh-keygen -A
echo "SSH安装完成"
echo "服务状态:"
sudo systemctl status ssh --no-pager -l
echo "SSH端口监听状态"
sudo ss -tlnp | grep :22