加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – rootsh在普通用户中运行问题

发布时间:2020-12-13 17:08:20 所属栏目:Linux 来源:网络整理
导读:我已经安装了rootsh,它在CentOS 6中运行良好. 但它的日志都写入/ var / log / messages和/ var / log / rootsh /. 我希望日志只写入/ var / log / rootsh /,而不是写入/ var / log / messages.当我从root运行命令时,我可以禁用syslog: rootsh --no-syslog
我已经安装了rootsh,它在CentOS 6中运行良好.
但它的日志都写入/ var / log / messages和/ var / log / rootsh /.

我希望日志只写入/ var / log / rootsh /,而不是写入/ var / log / messages.当我从root运行命令时,我可以禁用syslog:

rootsh --no-syslog

我希望能够与普通用户一起禁用syslog.我登录到普通用户并编辑了.bashrc以添加以下行

rootsh --no-syslog

它正在创建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中,然后它只会运行登录shell

~/.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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读