ToB企服应用市场:ToB评测及商务社交产业平台

标题: 二百四十八、Linux——删除/etc/.sudoers文件进程或修改/etc/.sudoers文件 [打印本页]

作者: tsx81429    时间: 2024-8-27 03:10
标题: 二百四十八、Linux——删除/etc/.sudoers文件进程或修改/etc/.sudoers文件
一、目的

安装国产化数据库OceanBase的时候,需要创建用户,并在/etc/.sudoers文件中赋予用户root权限
二、删除/etc/.sudoers文件进程

1 报错

W10: Warning: Changing a readonly file E325: ATTENTION Found a swap file by the name "/etc/.sudoers.swp" owned by: root dated: Wed Jul 31 14:22:16 2024 file name: /etc/sudoers modified: YES user name: root host name: linux130 process ID: 4753 While opening file "/etc/sudoers" dated: Wed Sep 30 21:18:59 2020 (1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r /etc/sudoers" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/etc/.sudoers.swp" to avoid this message.
2 执行命令规复未生存的更改

[root@hurys22 ~]# vim -r /etc/sudoers
3 删除之前更改进程

[root@hurys22 ~]# sudo rm /etc/.sudoers.swm
留意:/etc/.sudoers.swm进程名不一定一样,而且可能会有多个
4 删除完再执行命令验证一下# vim -r /etc/sudoers


三、在/etc/.sudoers文件中赋予用户root权限

1 不要直接vi命令,而是要用sudo visudo命令

[root@hurys23 sbin]# sudo visudo
2 赋予用户root权限     用户名   ALL=(ALL)       ALL

## Allow root to run any commands anywhere 
root    ALL=(ALL)     ALL
gpadmin ALL=(ALL)       ALL
oceanadmin    ALL=(ALL)       ALL

修改好:wq生存并退出,就完成了!

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4