使用su - root切换时速度很慢,求解!!!
考虑到安全关系,禁止了root用户登录,在使用ssh远程登录时,专门提供了一个普通账号。普通账号登录时速度挺快,但是用su - root切换时,速度特别慢,大概要2-3分钟左右。直接用su root切换倒是正常的。请教各位大师们帮忙看看吧,实在是不知道如何下手。。。 跟http://bbs.chinaunix.net/thread-1963282-1-1.html这位仁兄遇到的问题差不多 回复 1# journeyto0405
从你说的现象上看, 应该是 你的 root 用的 .bashrc 或者 .profile 或者 .bash_profile 里可能加载了比较复杂的东西.
检查一下这三个文件看看. .profile 可能没有 回复 3# q1208c
都检查过,看不出什么异常。。
# more.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
ulimit -HSn 32768
# more .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi # more /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so # more /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so 回复 4# journeyto0405
如果 这三个文件没问题.
那可能要查一下 pam 中 有关 su 的配置了.
不知道你是不是所有的机器都这样, 还是只有一台机器是这样的. 回复 7# q1208c
只有这一台服务器有这样的情况。
-------------------------------------------------------------------------------------------------------------------------------------------------------
刚才在群里一个大师,让我在/etc/profile里面加了一个echo语句。
加了之后再source /etc/profile
执行这个命令之后,确实再用su - root登录就很快了,只是在执行source /etc/profile命令的时候 特别慢.
还是不太明白为什么 回复 8# journeyto0405
在执行完source /etc/profile后,切换又变慢了。。。 回复 8# journeyto0405
看一下/etc/profile文件。。。