在Ubuntu Minimal系统中进行远程连接,通常可以使用SSH(Secure Shell)协议。以下是设置和进行远程连接的步骤:
首先,确保你的Ubuntu Minimal系统上安装了SSH服务器。如果没有安装,可以使用以下命令进行安装:
sudo apt update
sudo apt install openssh-server
安装完成后,启动SSH服务并设置为开机自启:
sudo systemctl start ssh
sudo systemctl enable ssh
你可以根据需要配置SSH服务器,例如更改默认端口、禁用root登录等。编辑SSH配置文件:
sudo nano /etc/ssh/sshd_config
进行必要的修改后,保存并退出编辑器,然后重启SSH服务:
sudo systemctl restart ssh
确保你的Ubuntu Minimal系统有一个可用的IP地址。你可以通过以下命令查看:
ip addr show
或者使用:
hostname -I
使用SSH客户端从另一台计算机连接到你的Ubuntu Minimal系统。打开终端或命令提示符,输入以下命令:
ssh username@server_ip_address
其中:
username
是你在Ubuntu Minimal系统上的用户名。server_ip_address
是你的Ubuntu Minimal系统的IP地址。如果一切配置正确,你应该能够成功连接到远程服务器,并看到类似以下的输出:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-42-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu Apr 1 12:34:56 UTC 2021
System load: 0.01 Processes: 123
Usage of /: 13.5% of 229.05GB Users logged in: 1
Memory usage: 35% IP address for eth0: 192.168.1.100
Swap usage: 0%
=> There are 3 zombie processes.
* Super-optimized for small spaces - read how we shrank the memory
footprint of MicroK8s to make it the smallest full K8s around.
0 updates can be installed immediately.
0 of these updates are security updates.
Last login: Thu Apr 1 12:35:01 2021 from 192.168.1.50
username@ubuntu-minimal:~$
/etc/ssh/sshd_config
中禁用了root登录(PermitRootLogin no
)。通过以上步骤,你应该能够在Ubuntu Minimal系统上成功设置和进行远程连接。