在linux進行sudo操作時,有時會提示:
xxxx is not in the sudoers file. This incident will be reported.
xxxx是當前操作的用戶。
這就是說,當前的用戶沒有sudo權限,估計是創建用戶的時候忘記給加sudo權限了,添加的方法如下:
1 切回到root用戶,查看/etc/sudoers的權限,如果只讀,給一個寫的權限
chmod +w /etc/sudoers
2 添加自己用戶的sudo權限:在/etc/sudoers找到
root ALL=(ALL:ALL) ALL
在下面添加自己的用戶:
xxxx ALL=(ALL:ALL) ALL
xxxx是自己的用戶名。
3 保存,退出,切回自己的普通用戶,這個時候應該有sudo權限了