LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-14-2010, 05:00 PM   #1
mellor
LQ Newbie
 
Registered: Apr 2008
Posts: 7

Rep: Reputation: 0
SSH remote to local chat


May be no one else needs something like this...

I have the need to SSH into a Slackware 12 box to provide remote support.
I got this, but it doesn't provide for a real 2-way communication.

while : ;
do read -p "Enter text to Local: " TXT ;
DISPLAY=:0 Kdialog --inputbox "$TXT" ;
done

So this loops and all, but it doesn't have a history and I have to wait for a return from the Local operator. If the operator has changed focus I can be waiting all day for a response and I would have to start another session to post a second comment.

What is nice is that it's small and I can create the .sh when I remote in.

-----Update since I started

I now have two scripts to take over from the first one. I have to have 4 SSH running to get this to work.

1 SSH to move(archive) and create a chat.txt; it also fires off a .sh that fires off a console that tails a chat.txt so the operator can see the chat history
2nd SSH to fire off a .sh that loops a Local kdialog input box that appends the chat.txt
3rd SSH to tail -f the chat.txt file on the remote so I can see the chat history
4th SSH to loop a read -p on the SSH so I can append the chat.txt

Is there a better way?
Or an open source that will let me have coms without the server overhead?
 
Old 11-14-2010, 06:04 PM   #2
ortho-orange#42
LQ Newbie
 
Registered: Feb 2005
Distribution: Slackware
Posts: 16

Rep: Reputation: 2
There are a few commands you might want to look at: "write" and "talk". "write" worked like a charm ssh'd into a Slackware VM as two different users. I didn't get a good response from "talk" but it looks like it should do the same thing...
 
Old 11-14-2010, 06:53 PM   #3
mellor
LQ Newbie
 
Registered: Apr 2008
Posts: 7

Original Poster
Rep: Reputation: 0
Our product is not very flexible as far as user are concerned....

... Here is where I'm going to get flambeed, but it's not my product...
Everyone logs in as root.

The next release users will not log in as root, but everyone is still going to log in as the same user.
I think this is going to be a limiting factor as far as using a user name to chat with someone.
 
Old 11-14-2010, 07:03 PM   #4
ortho-orange#42
LQ Newbie
 
Registered: Feb 2005
Distribution: Slackware
Posts: 16

Rep: Reputation: 2
That is nasty, but I'll leave the flaming for someone else

Actually, with those apps I mentioned, you can specify a tty, or pseudo-terminal, so if you can get that from whoever's on the other end (perhaps programatically), it should work the same as with a username.
 
Old 11-14-2010, 09:01 PM   #5
mellor
LQ Newbie
 
Registered: Apr 2008
Posts: 7

Original Poster
Rep: Reputation: 0
That write command works great, except for the fact that on the local computer it opens a terminal that will only receive text.
It is not editable on the Local side. I would have to get him to open a terminal on his side so we can chat.
I can open a terminal for him on SSH but since I opened it I get the response back to myself.

I really don't want to take control of the gui via VNC to open a terminal.

It is easier than what I currently got except that I can do what I currently got from the SSH terminal session without grabbing the GUI.
Now I just have to find out how to change what gets opened by the write command or how to open a shell for the client that isn't link back to the remote

Last edited by mellor; 11-14-2010 at 09:05 PM.
 
Old 11-14-2010, 09:57 PM   #6
ortho-orange#42
LQ Newbie
 
Registered: Feb 2005
Distribution: Slackware
Posts: 16

Rep: Reputation: 2
Hmm, you're right about "write", "talk" may be more useful in that regard.

I started looking at your script, which is a neat little bit of code, btw, and added a little to it:

Code:
HIST="";

while : ;
do read -p "enter..: " TXT ;
if [ "$TXT" = "hist" ]; then
	echo -e "History: $HIST" 
else
IV=`DISPLAY=:0 kdialog --inputbox "$TXT"` ;
HIST="$HIST\r\n$TXT\r\n$IV";
if [ "$IV" = "hist" ]; then
	DISPLAY=:0 kdialog --msgbox "$HIST" ;
	IV=`DISPLAY=:0 kdialog --inputbox "$TXT"` ;
fi
echo "return: $IV";
fi
done
This is a super ugly 10 minute job, but it just maintains a history itself, and whenever someone types "hist" it spits it out. Formatting is messed up in the kdialog history, maybe there's a better way to do that. Plus, the only time the local user can see their history is after you've sent your text. This also doesn't write anything to a file, but that should be as easy as a redirected echo.

Anyway, maybe with all this activity someone who knows more will come along & have some clues. Good luck, and if I think of anything else I'll post it
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote shutdown via ssh frozen the local console lchxr Linux - Networking 5 11-08-2008 01:55 PM
How to configure ssh local / remote forwarding at parmanent label. linuxjamil Linux - Server 1 02-21-2008 06:26 AM
mounting local hard drive in a remote shell (SSH) noir911 Linux - General 1 06-24-2005 05:55 AM
Backing up remote Linux Server to Local Win2KPro CD-RW over SSH McK66 Linux - General 3 06-08-2004 09:05 PM
Opening remote files (during ssh session) with applications on local computer? The_Fed Linux - Newbie 3 05-10-2004 04:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration