Results 1 to 8 of 8
I was wondering is there any way to send commands to terminals (bash sessions like /dev/pts/0) on which other users are logged in?
For example I am on /dev/pts/1 and ...
- 07-12-2009 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 14
send commands to terminal other users are logged in
I was wondering is there any way to send commands to terminals (bash sessions like /dev/pts/0) on which other users are logged in?
For example I am on /dev/pts/1 and i want to send commands from that terminal to /dev/pts/0.
- 07-12-2009 #2
I just tried it. You can echo a command to a terminal by typing e.g
but the command isn't actually executed.Code:echo -e "ls \n">/dev/pts/0
If on the other hand you typethe command doesn't appear on the other terminal but the expected output does. Of course if the terminal belongs to someone else, you'd have to be root to write to it.Code:ls>/dev/pts/0
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 07-12-2009 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
If you are asking how you can remotely execute commands on another tty, the short answer is "you can't". The long answer is "you can, but not easily". I'd have to do some research since it has been a long time since I implemented a tool to do just that (on Unix systems). Effectively, it's a matter of inserting data into the tty's input buffer so that it thinks it has been typed by the user. Not simple to do, but possible for a root process. It might require a kernel module in Linux to accomplish, but at this point, I cannot say for sure.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-15-2009 #4Just Joined!
- Join Date
- Jun 2007
- Posts
- 14
Thanks for reply.
Root previliges are not an issue but it seems that echoing commands to another tty is not a feasable option.
- 07-15-2009 #5Just Joined!
- Join Date
- Jun 2009
- Location
- Toronto
- Posts
- 18
What about the 'write' and 'talk' commands?
- 07-15-2009 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
All that echoing them does is display what you echo to them. It doesn't execute the command in their environment. To do that, you need to plug it into the input buffer of the tty they are using.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 07-15-2009 #7Just Joined!
- Join Date
- Jun 2009
- Location
- Toronto
- Posts
- 18
- 07-15-2009 #8Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Yeah. The biggest issue is hacking into the input stream of the user or tty. Remote desktop software does that, but the window server software is set up with a means to do that. If the user you are trying to "hack" is not running a x-server of some sort, such as just an ssh or telnet session, then it's a bit more difficult. Not impossible, but not simple either. Since I haven't done this for Linux I don't know if it would require a custom kernel module or if it could be done from user space entirely. In any case, it would be a tool to keep out of the hands of the "innocent"!
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
