本文摘自PHP中文网,作者V,侵删。

1、添加用户
首先用adduser
命令添加一个普通用户,命令如下:
1 2 3 4 5 6 7 | #adduser tommy
#passwd tommy
Changing password for user tommy.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
|
免费视频教程推荐:linux视频教程
2、赋予root权限
方法一: 修改 /etc/sudoers
文件,找到下面一行,把前面的注释(#)去掉
1 2 | ## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
|
然后修改用户,使其属于root组(wheel),命令如下:
修改完毕,现在可以用tommy帐号登录,然后用命令 su -
,即可获得root权限进行操作。
方法二: 修改 /etc/sudoers
文件,找到下面一行,在root下面添加一行,如下所示:
1 2 3 | ## Allow root to run any commands anywhere
root ALL=(ALL) ALL
tommy ALL=(ALL) ALL
|
修改完毕,现在可以用tommy帐号登录,然后用命令 su -
,即可获得root权限进行操作。
相关文章教程分享:linux教程
以上就是linux中如何添加用户并给用户root权限的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
Linux中怎么检查是否安装了某软件
centos7下创建数据库和用户
虚拟机安装Linux操作系统
Linux适合干什么?
为什么要用Linux系统
Linux的命令怎么用
如何使用describezones查询一个地域下的可用区
详细介绍Linux中的内存管理
如何修改Linux的ip地址
Linux如何切换用户
更多相关阅读请进入《Linux》频道 >>
转载请注明出处:木庄网络博客 » linux中如何添加用户并给用户root权限