编辑/root/.bash_profile文件,添加
export TMOUT=300 #300秒超时自动退出root
vi /etc/profile
export TMOUT=300 #TMOUT=0 表示自动注销超时时间为无限长
编辑好文件后,保存,退出,重新登录,即可生效