下載:https://www.debian.org/distrib/netinst
一、更新包信息
apt update
二、更改網絡
vi /etc/network/interfaces
修改为如下
# The primary network interface
allow-hotplug ens18
iface ens18 inet static
address 192.168.1.102
netmask 255.255.255.0
gateway 192.168.1.1
修改完按 ESC 输入:wq 进行保存
重启网络服务使设置生效
systemctl restart networking
三、普通用户添加 sudo 权限
启动 root 用户
su
# 输入密码
安装 sudo 及 vim
apt-get install sudo vim
修改 /etc/sudoers 文件属性为可写:
chmod +w /etc/sudoers
vim 進入 sudo
vi /etc/sudoers
修改 sudo 配置
# 在 root ALL=(ALL)ALL 这行下添加
(一般用戶) ALL=(ALL)ALL
# 保存退出
修改 /etc/sudoers 文件属性为只读
chmod -w /etc/sudoers
四、允许 root 用户远程 SSH 登录
要在 Debian Linux 系统上为 root 用户启用 SSH 登录,您需要首先配置 SSH 服务器。
- 首先安装 SSH
注意:如果使用的是 WSL 安装的 ubuntu/debian,那么你需要先卸载再安裝:
apt remove openssh-server
sudo apt install openssh-server
- 安装完成后 SSH 服务默认开启
手动启动:
systemctl start ssh.service
- 利用 vim 打开并修改 /etc/ssh/sshd_config 文件
vim /etc/ssh/sshd_config
将 PermitRootLogin 设置为 yes,PasswordAuthentication 设置为 yes
PermitRootLogin yes
PasswordAuthentication yes
:wq 保存退出即可。
- 输入下面命令,重新启动 SSH 服务器:
/etc/init.d/ssh restart
正文完