我已经安装了 rootsh 并且它在 CentOS 6 中运行良好。但是它的日志同时写入/var/log/messages
和/var/log/rootsh/
.
我想日志只写到/var/log/rootsh/
,不/var/log/messages
。当我从 root 运行命令时,我可以禁用系统日志:
rootsh --no-syslog
Run Code Online (Sandbox Code Playgroud)
我也希望能够用我的普通用户禁用系统日志。我登录到我的普通用户并编辑.bashrc
以添加以下行
rootsh --no-syslog
Run Code Online (Sandbox Code Playgroud)
它正在创建 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
Run Code Online (Sandbox Code Playgroud)
这里发生的事情是你陷入了一个循环 - 看看这个来自 pstree 的输出
sshd???bash???rootsh???bash???rootsh???bash???rootsh...
Run Code Online (Sandbox Code Playgroud)
每次运行 bash 时,它都会运行 .bashrc,后者运行 rootsh,它是 bash 的包装器,因此它运行 bash,后者运行 .basrc ...
您可以将调用放在 .bash_profile 中,然后它只会为登录 shell 运行
~/.bash_profile
The personal initialization file, executed for login shells
~/.bashrc
The individual per-interactive-shell startup file
Run Code Online (Sandbox Code Playgroud)
以及 pstree 的输出到位
sshd???bash???rootsh???bash???pstree
Run Code Online (Sandbox Code Playgroud)
不要rootsh -i
在你的 .bash_profile 中使用。
归档时间: |
|
查看次数: |
1206 次 |
最近记录: |