欢迎光临散文网 会员登陆 & 注册

Install and enable ssh on Ubuntu 2204 LTS

2023-08-02 15:50 作者:Jinniq  | 我要投稿

By default, after you install the Ubuntu system, the system does not allow remote access through SSH, you need to install OpenSSH and enable it.

The installation method is very simple, you need to install and enable SSH as root or an account with sudo privileges according to the following steps.


update ubuntu

sudo apt update && sudo apt upgrade -y

install ssh(openssh)

# intall openssh server
sudo apt install openssh-server -y

# start openssh server
sudo systemctl enable --now ssh

# check openssh state
# press 'q' to return terminal
sudo systemctl status ssh

# another way check openssh state
sudo ss -lt

# close openssh
sudo systemctl disable ssh --now

# start openssh
sudo systemctl enable ssh --now

# uninstall openssh
sudo apt autoremove openssh-server -y


ubuntu firewall settings

# check ubuntu firewall states
sudo ufw status

# maybe ufw status is inactive
# active firewall
sudo ufw enable

# firewall allow ssh
sudo ufw allow ssh

# allow ssh use other ports
sudo ufw allow 7722/tcp

# allow ssh use ports from 7100 to 7200
sudo ufw allow 7100:7200/tcp


Install and enable ssh on Ubuntu 2204 LTS的评论 (共 条)

分享到微博请遵守国家法律