博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux 添加用户 并且给用户超级管理员权限
阅读量:7083 次
发布时间:2019-06-28

本文共 910 字,大约阅读时间需要 3 分钟。

  hot3.png

1、添加用户,首先用adduser命令添加一个普通用户,命令如下:  #adduser tommy  //添加一个名为tommy的用户  #passwd tommy //修改密码  Changing password for user tommy.  New UNIX password: //在这里输入新密码  Retype new UNIX password: //再次输入新密码  passwd: all authentication tokens updated successfully.2、赋予root权限方法一: 修改 /etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉## Allows people in group wheel to run all commands%wheel    ALL=(ALL)    ALL然后修改用户,使其属于root组(wheel),命令如下:#usermod -g root tommy修改完毕,现在可以用tommy帐号登录,然后用命令 su - ,即可获得root权限进行操作。方法二: 修改 /etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:## Allow root to run any commands anywhereroot    ALL=(ALL)     ALLtommy   ALL=(ALL)     ALL修改完毕,现在可以用tommy帐号登录,然后用命令 su - ,即可获得root权限进行操作。方法三: 修改 /etc/passwd 文件,找到如下行,把用户ID修改为 0 ,如下所示:tommy:x:500:500:tommy:/home/tommy:/bin/bash修改后如下tommy:x:0:500:tommy:/home/tommy:/bin/bash保存,用tommy账户登录后,直接获取的就是root帐号的权限。友情提醒:虽然方法三看上去简单方便,但一般不推荐使用,推荐使用方法二。

 

转载于:https://my.oschina.net/wxpi/blog/1359342

你可能感兴趣的文章
CentOS切换桌面模式和命令行模式
查看>>
noip2013火柴排序
查看>>
固定GridView的头
查看>>
ElasticSearch 监控单个节点详解
查看>>
微软职位内部推荐-Senior Development Lead
查看>>
parent对象
查看>>
三位老师
查看>>
写给测试人员:不是所有的bug都需要修复
查看>>
【转】万亿移动支付产业的难点和痛点
查看>>
C2 CompilerThread0 如果抓到的java线程dump里占用CPU最高的线程是这个,99%可能是因为服务重启了...
查看>>
log4j2配置
查看>>
hadoop学习笔记411
查看>>
Android 监听器
查看>>
FPGA配置OV5640摄像头及RGB图像数据采集
查看>>
LeetCode:Clone Graph
查看>>
git的合并与推送
查看>>
前端优化
查看>>
c++的检测的确比C++更严格
查看>>
ibatis增删改、批量增删改以及查询
查看>>
Installing MySQL on Microsoft Windows Using a noinstall Zip Archive
查看>>