1. 程式人生 > 實用技巧 >CentOS7一些設定

CentOS7一些設定

1.CentOS系統中,使用預設建立的使用者執行sudo命令時終端提示以下資訊:

tom is not in the sudoers file. This incident will be reported.

原因是CentOS預設建立的使用者並沒有sudo命令的執行許可權,而且CentOS中也並不存在sudo使用者組。
提示資訊中提到的sudoers file位於/etc/sudoers,使用root許可權可對其進行修改,命令如下:

su root
vim /etc/sudoers
                 ...
                 ...
                 ...
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
tom     ALL=(ALL)       ALL
                 ...
                 ...
                 ...

2.CentOS7在登入介面使用者列表中隱藏指定賬號

CentOS中有多個賬戶,不想禁用使用者列表,也不想全顯示,使用root許可權修改對應使用者檔案,命令如下:

vim /var/lib/AccountsService/users/<username> 
[User]
Language=zh_CN.utf8
XSession=
SystemAccount=true

3.CentOS7修改開機等待時間

使用root使用者許可權修改grub.cfg檔案,命令如下:

vim /boot/grub2/grub.cfg
                 ...
                 ...
                 ...
terminal_output console
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=1 # 建議改成1秒鐘
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=1
fi
                 ...
                 ...
                 ...