要配置Linux允许SSH登录,您需要按照以下步骤进行操作:
Debian/Ubuntu:sudo apt-get install openssh-server
CentOS/RHEL:sudo yum install openssh-server
Fedora:sudo dnf install openssh-server
Debian/Ubuntu:sudo systemctl start ssh
CentOS/RHEL/Fedora:sudo systemctl start sshd
允许Root用户登录:找到#PermitRootLogin prohibit-password
并将其改为PermitRootLogin yes
,如果您希望允许Root用户通过SSH登录。
允许密码身份验证:找到#PasswordAuthentication yes
并将其改为PasswordAuthentication yes
,如果您希望允许使用密码进行身份验证。
允许Pubkey身份验证:找到#PubkeyAuthentication yes
并将其改为PubkeyAuthentication yes
,如果您希望允许使用公钥进行身份验证。
Debian/Ubuntu:sudo systemctl restart ssh
CentOS/RHEL/Fedora:sudo systemctl restart sshd
Debian/Ubuntu:sudo ufw allow ssh
CentOS/RHEL/Fedora:sudo firewall-cmd --add-service=ssh --permanent
完成上述步骤后,您的Linux系统应允许SSH登录。您可以使用SSH客户端工具连接到Linux系统,如OpenSSH(Linux和macOS自带),PuTTY(Windows)。使用以下命令连接到Linux系统:
ssh username@ip_address
例如:ssh john@192.168.1.10
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: Linux怎么查看堆栈信息