网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

如何进行linuxsudo权限配置

本篇文章给大家分享的是有关如何进行linux sudo权限配置,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

创新互联建站主要从事做网站、网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务西夏,十年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

    这里记录一下linux的sudo简单配置过程,备后查。

    1、root打开sudo配置文件

[root@centos ~]# visudo

    2、sudo配置项

## Next comes the main part: which users can run what software on

## which machines (the sudoers file can be shared between multiple

## systems).

## Syntax:

##

##      user    MACHINE=COMMANDS

##

## The COMMANDS section may have other options added to it.

##

## Allow root to run any commands anywhere

root    ALL=(ALL)       ALL

MySQL   ALL=(ALL)       ALL  #配置mysql用户等同root用户执行的所有命令

    3、配置mysql免密执行

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)

#includedir /etc/sudoers.d

mysql localhost=(root) NOPASSWD:ALL

    4、root修改mysql的密码

[root@centos ~]# passwd mysql

    5、mysql添加mysql用户的sudo密码,sudo密码是第4部设置的mysql操作系统层的密码

-bash-4.1$ sudo uname

[sudo] password for mysql: 

Linux

-bash-4.1$

    6、查看sudo配置

[root@centos ~]# sudo -l

Matching Defaults entries for root on this host:

    requiretty, !visiblepw, always_set_home, env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS",

    env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT

    LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS

    _XKB_CHARSET XAUTHORITY", secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User root may run the following commands on this host:

    (ALL) ALL

[root@centos ~]# 

     7、mysql用户测试sudo是否正确

-bash-4.1$ sudo mkdir /test1

-bash-4.1$ ls -l /test1

total 0

-bash-4.1$ rm -rf /test1

rm: cannot remove `/test1': Permission denied

-bash-4.1$ sudo rm -rf /test1

-bash-4.1$ ls -l /test1

ls: cannot access /test1: No such file or directory

-bash-4.1$ 

    linux的sudo配置完成!

以上就是如何进行linux sudo权限配置,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


本文名称:如何进行linuxsudo权限配置
文章地址:http://bjjierui.cn/article/ggdecc.html

其他资讯