CentOS 初始化账号

装完Linux系统之后,除Root账户之外,还应创建一个普通账户。

本文环境为:

centos-release-8.2-2.2004.0.2.el8.x86_64

1. 创建新用户 tester

[root@localhost ~]# adduser tester

2. 为tester设置密码

[root@localhost ~]# passwd tester

如果你的密码比较简单,系统可能会提示你不符合安全要求,可忽略。

 

3. 此时tester只有在/home/tester目录下有完整权限,如果tester需要在其他目录创建文件或目录,则需要为其升级权限:

[root@localhost ~]# vim /etc/sudoers

下拉找到

## Allow root to run any commands anywhere 
root ALL=(ALL) ALL

在该行之下新增一行

tester ALL=(ALL) ALL

保存退出。此时tester可以通过sudo命令来执行root权限。

原文地址:https://www.cnblogs.com/eagle6688/p/14354579.html