一、普通用户使用sudo报错

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

二、修改/etc/sudoers文件

[hladmin@localhost hl-sms-core]$ su root
密码:
[root@localhost hl-sms-core]# vim /etc/sudoers
## Allow root to run any commands anywhere 
root       ALL=(ALL)       ALL
hladmin ALL=(ALL)       ALL

将  root ALL=(ALL) ALL 复制一行,将root修改为hladmin 保存退出

三、测试

[hladmin@localhost hl-sms-core]$ cp /etc/my.cnf /etc/my_old.cnf
cp: 无法创建普通文件"/etc/my_old.cnf": 权限不够
[hladmin@localhost hl-sms-core]$ sudo cp /etc/my.cnf /etc/my_old.cnf

 

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2022-02-18
  • 2021-10-11
  • 2022-12-23
相关资源
相似解决方案