ubuntu

ubuntu minimal如何进行远程连接

小樊
42
2025-04-29 18:47:49
栏目: 智能运维

在Ubuntu Minimal系统中进行远程连接,通常可以使用SSH(Secure Shell)协议。以下是设置和进行远程连接的步骤:

1. 安装SSH服务器

首先,确保你的Ubuntu Minimal系统上安装了SSH服务器。如果没有安装,可以使用以下命令进行安装:

sudo apt update
sudo apt install openssh-server

2. 启动并启用SSH服务

安装完成后,启动SSH服务并设置为开机自启:

sudo systemctl start ssh
sudo systemctl enable ssh

3. 配置SSH服务器(可选)

你可以根据需要配置SSH服务器,例如更改默认端口、禁用root登录等。编辑SSH配置文件:

sudo nano /etc/ssh/sshd_config

进行必要的修改后,保存并退出编辑器,然后重启SSH服务:

sudo systemctl restart ssh

4. 获取服务器的IP地址

确保你的Ubuntu Minimal系统有一个可用的IP地址。你可以通过以下命令查看:

ip addr show

或者使用:

hostname -I

5. 远程连接

使用SSH客户端从另一台计算机连接到你的Ubuntu Minimal系统。打开终端或命令提示符,输入以下命令:

ssh username@server_ip_address

其中:

6. 验证连接

如果一切配置正确,你应该能够成功连接到远程服务器,并看到类似以下的输出:

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:~$

7. 安全注意事项

通过以上步骤,你应该能够在Ubuntu Minimal系统上成功设置和进行远程连接。

0
看了该问题的人还看了