linux查看远程用户进程,Linux不使用密码远程登陆的方...-Linux 查看用户登陆后操作记录...-CentOS6.2关闭tty的方法_169IT.COM...

在linux系统中,一般情况,只需开启两个tty终端,没有必要开启多余的tty进程,以减少tty进程对系统资源的开销。

代码示例:

[root@nginx etc]# ps -aux|grep tty   #查看tty进程

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root      1636  0.0  0.0   4056   552 tty2     Ss+  09:07   0:00 /sbin/mingetty /dev/tty2

root      1638  0.0  0.0   4056   548 tty3     Ss+  09:07   0:00 /sbin/mingetty /dev/tty3

root      1640  0.0  0.0   4056   548 tty4     Ss+  09:07   0:00 /sbin/mingetty /dev/tty4

root      1642  0.0  0.0   4056   552 tty5     Ss+  09:07   0:00 /sbin/mingetty /dev/tty5

root      1648  0.0  0.0   4056   552 tty6     Ss+  09:07   0:00 /sbin/mingetty /dev/tty6

root      1723  0.0  0.1 108328  1776 tty1     Ss+  09:07   0:00 -bash

root      2344  0.0  0.0 103244   840 pts/0    S+   10:29   0:00 grep tty

[root@nginx etc]# vi /etc/init/start-ttys.conf

代码示例:

# This service starts the configured number of gettys.

start on stopped rc RUNLEVEL=[2345]

env ACTIVE_CONSOLES=/dev/tty[1-2]     #将tty[1-6]修改为[1-2]

env X_TTY=/dev/tty1

task

script

. /etc/sysconfig/init

for tty in $(echo $ACTIVE_CONSOLES) ; do

[ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue

initctl start tty TTY=$tty

done

end script

[root@nginx etc]# vi /etc/sysconfig/init

代码示例:

# What ttys should gettys be started on?

ACTIVE_CONSOLES=/dev/tty[1-2]    #将tty[1-6]修改为[1-2]

# Set to '/sbin/sulogin' to prompt for password on single-user mode

# Set to '/sbin/sushell' otherwise

SINGLE=/sbin/sushell

修改以上配置文件需重启系统生效,如果要临时停止tty终端,可使用 如:initctl stop tty TTY=/dev/tty6 [停止tty6]。

代码示例:

[root@nginx etc]# ps -aux|grep tty

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root      1636  0.0  0.0   4056   552 tty2     Ss+  09:07   0:00 /sbin/mingetty /dev/tty2

root      1638  0.0  0.0   4056   548 tty3     Ss+  09:07   0:00 /sbin/mingetty /dev/tty3

root      1640  0.0  0.0   4056   548 tty4     Ss+  09:07   0:00 /sbin/mingetty /dev/tty4

root      1642  0.0  0.0   4056   552 tty5     Ss+  09:07   0:00 /sbin/mingetty /dev/tty5

root      1723  0.0  0.1 108328  1776 tty1     Ss+  09:07   0:00 -bash

root      2358  0.0  0.0 103244   844 pts/0    S+   10:31   0:00 grep tty

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值