南大通用GBase 8a采用sudo安装时出现输入密码等待300秒超时现象的原因

GBase 8a支持sudo安装,但现有版本不支持在执行sudo命令时输入密码,否则操作系统在等待密码输入[sudo] password for gbase的信息,而安装程序在等待命令返回,直到300秒的超时时间到了报错。现有解决方案是调整操作系统sudo策略,让gbase用户执行sudo时无需输入密码,包括第一次运行sudo。

报错现象

sudo 时让输入密码We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

报错信息为

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.
[sudo] password for gbase:

原因

sudo用户默认策略是第一次执行命令时,要输入当前sudo用户的密码,如上就是要输入gbase操作系统用户的密码。 一旦运行成功,后续sudo则不再需要输入了。

解决方案

调整sudo用户的策略,明确不需要输入密码 NOPASSWD。

[root@gbase_rh7_001 ~]# cat /etc/sudoers.d/gbase
gbase ALL=(ALL) NOPASSWD:ALL
[root@gbase_rh7_001 ~]#

只有再su 进入gbase用户,则不再需要输入密码了,即使第一次使用。