我已经安装了rootsh,而且它在CentOS 6中工作正常。但是它的日志被写入/var/log/messages和/var/log/rootsh/ 。
我只想将日志写入/var/log/rootsh/ ,而不是/var/log/messages 。 当我从根目录运行命令时,我可以禁用syslog:
rootsh --no-syslog
我希望能够与我的普通用户禁用系统日志。 我login到我的普通用户并编辑.bashrc添加以下行
rootsh --no-syslog
它创build了225个进程:
[root@testing ~]# ps aux | grep rootsh | wc -l 225 [root@testing ~]# ps aux | grep rootsh | less code 16521 0.0 0.0 8256 832 pts/1 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16535 0.0 0.0 8256 816 pts/3 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16549 0.0 0.0 8256 820 pts/5 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16563 0.0 0.0 8256 816 pts/6 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16577 0.0 0.0 8256 820 pts/7 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16591 0.0 0.0 8256 820 pts/8 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16605 0.0 0.0 8256 820 pts/9 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16619 0.0 0.0 8256 824 pts/10 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16633 0.0 0.0 8256 820 pts/11 S+ 14:43 0:00 /usr/bin/rootsh --no-syslog code 16647 0.0 0.0 8256 820 pts/12 S+ 14:43 0:00 /usr/bin/rootsh --no-sysl
这里发生的事情是,你陷入了一个循环 – 看看pstree的这个输出
sshd───bash───rootsh───bash───rootsh───bash───rootsh...
每次运行bash时,都会运行.bashrc,它运行的是rootsh,它是bash的包装,所以它运行bash,运行.basrc …
你可以把调用放在.bash_profile中,然后它只会运行loginshell
~/.bash_profile The personal initialization file, executed for login shells ~/.bashrc The individual per-interactive-shell startup file
和pstree的输出结合在一起
sshd───bash───rootsh───bash───pstree
不要在你的.bash_profile中使用rootsh -i 。