博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
赋予普通用户root权限具体步骤
阅读量:4300 次
发布时间:2019-05-27

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

实现的效果就是输入su -之后,可以切换到root。

 

赋予普通用户root权限步骤

1.首先你需要sudo su登陆root账号

2. chmod 700 /etc/sudoers 修改sudoers文件的权限,允许自己修改

3.根据下列方法一或方法二来赋予root权限

4.exit退出root账号

5.用命令 su - (su和-之间有空格),即可获得root权限进行操作

6.如果还不行,就sudo passwd root重新设置下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 anywhere

root ALL=(ALL) ALL

tommy ALL=(ALL) ALL

你可能感兴趣的文章
开源SoC整理
查看>>
【2020-3-21】Mac安装Homebrew慢,解决办法
查看>>
influxdb 命令行输出时间为 yyyy-MM-dd HH:mm:ss(年月日时分秒)的方法
查看>>
已知子网掩码,确定ip地址范围
查看>>
判断时间或者数字是否连续
查看>>
docker-daemon.json各配置详解
查看>>
Mac 下docker路径 /var/lib/docker不存在问题
查看>>
Docker(一)使用阿里云容器镜像服务
查看>>
Docker(二) 基础命令
查看>>
Docker(三) 构建镜像
查看>>
Spring 全家桶注解一览
查看>>
JDK1.8-Stream API使用
查看>>
cant connect to local MySQL server through socket /tmp/mysql.sock (2)
查看>>
vue中的状态管理 vuex store
查看>>
Maven之阿里云镜像仓库配置
查看>>
Maven:mirror和repository 区别
查看>>
微服务网关 Spring Cloud Gateway
查看>>
SpringCloud Feign的使用方式(一)
查看>>
SpringCloud Feign的使用方式(二)
查看>>
关于Vue-cli+ElementUI项目 打包时排除Vue和ElementUI
查看>>