免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1781 | 回复: 6
打印 上一主题 下一主题

如何看到远程用户操作的命令? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-24 17:19 |只看该作者 |倒序浏览
有时候在linux平台上遇到故障,需要对方工程师远程ssh协助。

那我在本地,如何能看到对方操作的详细情况,即我可以看到他输入了什么命令,产生哪些输出?

linux下有没有这样的工具呢?

请教。

论坛徽章:
0
2 [报告]
发表于 2008-09-24 17:26 |只看该作者
让他用screen

论坛徽章:
0
3 [报告]
发表于 2008-09-24 17:44 |只看该作者
screen是什么工具?

论坛徽章:
0
4 [报告]
发表于 2008-09-24 17:47 |只看该作者
我自己研究出来了
cat /dev/pts/1 >> /tmp/pts1.log
然后
tail -f /tmp/pts1.log
就行了

论坛徽章:
34
亥猪
日期:2015-03-20 13:55:11戌狗
日期:2015-03-20 13:57:01酉鸡
日期:2015-03-20 14:03:56未羊
日期:2015-03-20 14:18:30子鼠
日期:2015-03-20 14:20:14丑牛
日期:2015-03-20 14:20:31辰龙
日期:2015-03-20 14:35:34巳蛇
日期:2015-03-20 14:35:56操作系统版块每日发帖之星
日期:2015-11-06 06:20:00操作系统版块每日发帖之星
日期:2015-11-08 06:20:00操作系统版块每日发帖之星
日期:2015-11-19 06:20:00黄金圣斗士
日期:2015-11-24 10:43:13
5 [报告]
发表于 2008-09-24 18:01 |只看该作者
lz的办法是实时的么?

论坛徽章:
0
6 [报告]
发表于 2008-09-24 18:12 |只看该作者
是实时的,不过没尝试过多个remote用户登录的情况

论坛徽章:
0
7 [报告]
发表于 2008-09-24 21:55 |只看该作者

回复 #2 maitr 的帖子

screen是个很好的工具
参见http://www.ibm.com/developerwork ... /index.html?ca=drs-
我把其中有用的一段摘出来了
Trick 3: Collaboration with screen
David, the high-maintenance user from product engineering, calls: "I need you to help me understand why I can't compile supercode.c on these new machines you deployed."
"Fine," you say. "What machine are you on?"
David responds: " Posh." (Yes, this fictional company has named its five production servers in honor of the Spice Girls.) OK, you say. You exercise your godlike root powers and on another machine become David:
# su - david
Then you go over to posh:
# ssh posh
Once you are there, you run:
# screen -S foo
Then you holler at David:
"Hey David, run the following command on your terminal: # screen -x foo."
This will cause your and David's sessions to be joined together in the holy Linux shell. You can type or he can type, but you'll both see what the other is doing. This saves you from walking to the other floor and lets you both have equal control. The benefit is that David can watch your troubleshooting skills and see exactly how you solve problems.

At last you both see what the problem is: David's compile script hard-coded an old directory that does not exist on this new server. You mount it, recompile, solve the problem, and David goes back to work. You then go back to whatever lazy activity you were doing before.
The one caveat to this trick is that you both need to be logged in as the same user. Other cool things you can do with the screen command include having multiple windows and split screens. Read the man pages for more on that.
But I'll give you one last tip while you're in your screen session. To detach from it and leave it open, type: Ctrl-A D . (I mean, hold down the Ctrl key and strike the A key. Then push the D key.)
You can then reattach by running the screen -x foo command again.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP