• Linux基础一


    1.关闭SELinux的两种方法
    setenforce 0
    修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。
    -----------------------------------------------------------------------------------------------------

    2.用户不在sudoers文件中,无法使用sudo
    在使用Linux系统过程中,通常情况下,我们都会使用普通用户进行日常操作,而root用户只有在权限分配及系统设置时才会使用,而root用户的密码也不可能公开。普通用户执行到系统程序时,需要临时提升权限,sudo就是我们常用的命令,仅需要输入当前用户密码,便可以完成权限的临时提升。在使用sudo命令的过程中,我们经常会遇到当前用户不在sudoers文件中的提示信息,如果解决该问题呢?通过下面几个步骤,可以很简单的解决此问题。
    1、切换到root用户权限
    Last login: Tue Sep 24 20:50:51 2013 from 192.168.30.171
    [user@Compile ~]$ su root
    密码:
    [root@Compile user]#
    2、查看/etc/sudoers文件权限,如果只读权限,修改为可写权限
    [root@Compile user]# ls -l /etc/sudoers
    -r--r-----. 1 root root 4030 9月 25 00:57 /etc/sudoers
    [root@Compile user]# chmod 777 /etc/sudoers
    [root@Compile user]# ls -l /etc/sudoers
    -rwxrwxrwx. 1 root root 4030 9月 25 00:57 /etc/sudoers
    [root@Compile user]#
    3、执行vi命令,编辑/etc/sudoers文件,添加要提升权限的用户;在文件中找到root ALL=(ALL) ALL,在该行下添加提升权限的用户信息,如:
    root ALL=(ALL) ALL
    user ALL=(ALL) ALL
    说明:格式为(用户名 网络中的主机=(执行命令的目标用户) 执行的命令范围)
    4、保存退出,并恢复/etc/sudoers的访问权限为440
    [root@Compile user]# chmod 440 /etc/sudoers
    [root@Compile user]# ls -l /etc/sudoers
    -r--r-----. 1 root root 4030 9月 25 00:57 /etc/sudoers
    [root@Compile user]#
    5、切换到普通用户,测试用户权限提升功能
    -----------------------------------------------------------------------------------------------------

  • 相关阅读:
    人工智能第三课:数据科学中的Python
    人工智能第二课:认知服务和机器人框架探秘
    人工智能第一课:使用分类算法预测糖尿病
    如何加入Microsoft Teams 技术社区
    Python在Office 365 开发中的应用
    《Office 365开发入门指南》上市说明和读者服务
    基于Microsoft Graph打造自己的Timeline应用
    Office 365 应用开发的 .NET Core 模板库
    拥抱开源,Office 365开发迎来新时代
    Excel as a Service —— Excel 开发居然可以这么玩
  • 原文地址:https://www.cnblogs.com/cevinchen/p/9539397.html
Copyright © 2020-2023  润新知