在Ubuntu系統中,SSH(Secure Shell)是一個用于加密客戶端與服務器之間鏈接的加密協議,可以安全地進行遠程訪問和文件傳輸。以下是一些常用的SSH命令及其用法:
安裝OpenSSH服務器:
sudo apt update
sudo apt install openssh-server
檢查SSH服務狀態:
sudo systemctl status ssh
啟動SSH服務:
sudo systemctl start ssh
停止SSH服務:
sudo systemctl stop ssh
啟用SSH服務(開機自啟動):
sudo systemctl enable ssh
禁用SSH服務:
sudo systemctl disable ssh
連接到SSH服務器:
ssh username@ip_address
免密登錄:
ssh-keygen
ssh-copy-id username@ip_address
配置防火墻:
sudo ufw allow ssh
查看服務器IP:
ip addr show