CentOS切换中文拼音安装包时:zw 不在 sudoers 文件中。此事将被报告。【记录】

CentOS切换中文拼音安装包时:zw 不在 sudoers 文件中。此事将被报告。

先摆错误过程:

[zw@CentOS72 ~]$ yum install ibus-libpinyin
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
您需要 root 权限执行此命令。
[zw@CentOS72 ~]$ su root
密码:
[root@CentOS72 zw]# yum install ibus-libpinyin
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
软件包 ibus-libpinyin-1.6.91-4.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@CentOS72 zw]# exit
exit
[zw@CentOS72 ~]$ yum install ibus-libpinyin
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
您需要 root 权限执行此命令。
[zw@CentOS72 ~]$ sudo yum install ibus-libpinyin
[sudo] zw 的密码:
zw 不在 sudoers 文件中。此事将被报告。

- 添加汉语拼音键盘

如上面的引用,本来想添加中文拼英键盘,但是在设置里面只找到了汉语,没有汉语(intelligent Pinyin),这种情况下不能切换中文键盘。进行下载:

yum install ibus-libpinyin

提示需要root权限进行下载,我是可以进入root的,但是在命令前使用sudo 就会提示 当前用户不在sudoers文件中:

zw 不在 sudoers 文件中。此事将被报告。

(以前我每次遇到这种都是直接su root 进入root ,但是这次我去看了一下root 用户和sudo之间的区别:弄清这个很有必要,避免不必要的麻烦。
命令前加sudo执行和用真正的root用户执行有什么区别? - pansz的回答 - 知乎
)

- 解决sudoers问题——在sudoers中增加用户,并赋予权限

解决方案来源:http://t.csdn.cn/T6hGe

  1. 进入root用户
su root 
  1. 给root用户添加可写权限
chmod 640 /etc/sudoers
  1. 修改文件
vim /etc/sudoers

在 root ALL=(ALL) ALL下添加:(按i进入插入模式)
zw ALL=(ALL) ALL
(Esc 后按: 输入wq! 强制保存退出)
4. 打印查看是否修改成功

cat /etc/sudoers
  1. 改回原有的sudoers文件只读权限
chmod 440 /etc/sudoers
  1. 退出root到zw用户
exit
  1. 再次下载
sudo yum install ibus-libpinyin

这个时候去设置看语言地区就能看到汉语(Intelligent Pinyin)选项,选它并移到前面就可以切换中文拼音键盘了。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值