Ubuntu 22.04 版本常用设置

Ubuntu 22.04 版本常用设置

  • [Ubuntu 22.04 版本常用设置](#Ubuntu 22.04 版本常用设置)

Ubuntu 22.04 版本常用设置

默认情况下,root 用户不能远程登录,习惯上使用 CRT 工具远程连接服务器。

修改 root 密码

shell 复制代码
sudo passwd root

远程登录

Ubuntu 系统需先进行一些设置才能进行登录。

  1. 安装 ssh 服务,支撑后续使用 ssh 通过 22 端口远程连接
shell 复制代码
sudo apt install -y openssh-server

# 检查 sshd 状态
systemctl  status ssh
# 设置随机启动
systemctl enable ssh
  1. 配置 /etc/ssh/sshd_config 配置文件
shell 复制代码
vim /etc/ssh/sshd_config 

找到 #PermitRootLogin prohibit-password 这一行数据,在其下面新添加一行
PermitRootLogin yes

  1. 重启 ssh 服务
shell 复制代码
systemctl restart ssh

至此,可通过 root 用户,使用 CRT 工具远程登录服务器。

网络配置

Ubuntu 中一些网络命令不能使用,例如:ifconfignetstat等。

需先安装依赖包。

  • 如下安装命令,使用 root 用户执行。
shell 复制代码
apt install -y net-tools

VSCode 安装

执行如下安装命令

shell 复制代码
snap install code --classic

当前安装 Ubuntu 是用来做嵌入式开发,使用 VSCode 进行 C 开发。

故需安装 gcc,命令如下:

shell 复制代码
apt install -y gcc

验证版本:

shell 复制代码
root@test-virtual-machine:~# gcc --version
gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@test-virtual-machine:~# 

使用 root 用户登录图形化

默认情况下,不能使用 root 用户登录图形化界面(gdm3)。

需进行如下设置后,可实现登录。

  1. 编辑 /etc/pam.d/gdm-password 文件
shell 复制代码
vim  /etc/pam.d/gdm-password

# 找到如下一行,将其注释掉
# auth   required        pam_succeed_if.so user != root quiet_success
  1. 编辑 /etc/pam.d/gdm-autologin 文件
shell 复制代码
vim /etc/pam.d/gdm-autologin

# 同样,找到如下一行,将其注释掉
#auth   required        pam_succeed_if.so user != root quiet_success
  1. 编辑 /etc/gdm3/custom.conf 文件
shell 复制代码
vim /etc/gdm3/custom.conf

# 在 [security] 下面新添加一行 AllowRoot  = true
[security]
AllowRoot = true

补丁等更新

  1. 更新指令如下
shell 复制代码
# 1. 更新软件源缓存
apt update

# 2. 升级所有已安装软件、系统补丁、内核、驱动
apt upgrade -y

# 如果上面更新完还有残留包,用这个:
apt full-upgrade -y
  1. 清理残留 依赖包
shell 复制代码
apt autoremove -y
apt clean

若有转载,请标明出处:https://blog.csdn.net/CharlesYuangc/article/details/160461447

相关推荐
CC城子12 小时前
EtherNet/IP I/O 丢包排查(linux系统)
linux·单片机·tcp/ip·ethernetip
新时代牛马12 小时前
Linux 信号处理完整篇:从sigaction、掩码到内核发送与可重入排障
linux·运维·信号处理
lpfasd12312 小时前
Docker存储清理与防膨胀实践
运维·docker·容器
每天被AI救一次12 小时前
WorkBuddy 会议自动化实战:从腾讯会议转写到待办系统的完整链路(附全套提示词)
运维·自动化·腾讯会议
程序员梅雨12 小时前
Linux & Shell 实用干货
linux·运维·服务器·后端·面试·php
吴声子夜歌12 小时前
编写Shell脚本——自顶向下设计
linux·运维·shell
M78佐菲12 小时前
HTML学习笔记
linux·笔记·学习·tcp/ip·html
XR12345678812 小时前
医院无线整网高密覆盖选型深度解析
运维·网络
新时代牛马12 小时前
嵌入式 Linux 蓝牙框架完整篇:从 HCI、L2CAP 到BlueZ 用户态
linux·运维·服务器
Brilliantwxx13 小时前
【STM32】 初认识USART串口
linux·stm32·单片机·嵌入式硬件·架构