zoukankan      html  css  js  c++  java
  • Linux --赋予普通用户root 权限

    资源来源:

    https://www.linuxidc.com/Linux/2012-07/64530.htm

    Linux的普通用户在安装一些东西的时候或者执行命令的时候,终端始终会提示权限不够,我们会将这个普通用户赋予root权限,但是,和root还是有区别的,因为只能执行root规定好的一些操作命令。

    1、添加用户,首先用adduser命令添加一个普通用户,命令如下:

    #adduser claire   //添加一个名为claire的用户

    #passwd claire   //change the password

    changing password for user claire

    New unix password :  //input new password

    Retype new unix password:  //input the new password again

    password:all authentication tokens updated successfully.

    2.赋予root 权限

    方法一:

    change /etc/sudoers file ,找到%wheel 一行,把前面的注释(#)去掉

    ##Allow people in group wheel to run all commands

    %wheel ALL=(ALL)   ALL

    然后修改用户,使其属于root组(wheel),命令如下:

    #usermod -g root claire

    修改完毕后,现在可以用claire 账号登陆,然后用sudo su -,即可获得root权限进行操作。

    方法二:

    修改/etc/sudoers 文件,找到root一行,在root下面添加一行,如下所示:

    root  ALL=(ALL)  ALL

    claire  ALL=(ALL)  ALL

    修改完毕后,可以用claire账号登陆,然后用sudo su - ,即可获得root权限。

  • 相关阅读:
    Keepalived 无法自动转换主备角色,请关注 iptables 防火墙配置
    Linux 下使用网易的SMTP服务器 发送邮件
    Spring-boot 最小demo
    go build 时报错 cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
    spark-shell 执行脚本并传入参数
    JVM
    spark
    spark
    linux
    linux
  • 原文地址:https://www.cnblogs.com/clairedandan/p/11061128.html
Copyright © 2011-2022 走看看