Tera Term - enable local echo - telnet

Hi everybody,
I have some question about a enable local echo in tera term. How can I enable local echo in tera term via command?
When I send a message from telnet server (device)
"WON'T" Echo
"DO" Echo
Tera term responds:
"WON'T" ECHO
I know i can enable local echo in setup but I want a option to enable echo from my server.
Is exist any other option to enable local echo from server?
Thanks for answer

If using the Tera Term scripting language, you can do something like:
setecho 1
https://ttssh2.osdn.jp/manual/en/macro/command/setecho.html

Related

Get local device IP from connected server

I connected to my ubuntu server from my MacBook using SSH.
I want to know ip address of MacBook from the server.
How can I do that?
[edit] I would like to get ip using bash.
I would comment this but I cant. We need more information. What language are you programming with. What have you tried.
Edit: Here is what you are looking for. This answer was taken from Find the IP address of the client in an SSH session
Please do a more through search for your problem before posting a question
Check if there is an environment variable called:
$SSH_CLIENT
OR
$SSH_CONNECTION
(or any other environment variables) which gets set when the user logs in. Then process it using the user login script.
Extract the IP:
$ echo $SSH_CLIENT | awk '{ print $1}'
1.2.3.4
$ echo $SSH_CONNECTION | awk '{print $1}'
1.2.3.4

How to save a ssh session's whole echo history over tty to a file?

I ssh connect to a Linux server and want to save all the output from the server tty(console) to a log file, for later read/search.
For example, if I do echo "dafds" and then ls in bash, I want the log file to have the following content, or maybe something similar:
bash-4.4$ echo "dafds"
dafds
bash-4.4$ ls
README.md
After I leave this session, this file should have all the contents I saw over the terminal during this session.
Can I achieve this?
Should I do this on server side or on client side? Thanks.
You can also use tmux for this.
:capture-pane -S 100 save the lasts 100 lines in a buffer.
:save-buffer filename.txt write this buffer on a file.
You could use tee to read from stdin and stdout and redirect to a log file:
ssh user#server | tee ssh_session.out
Assuming that you know before making the connection that you want to log the session.

Remote connection mysql in php using virtual machine

Question I was refering
I create three virtual Machine running Ubuntu 14.04 in VMWare Player.
First VM - Client who will access the web pages.
Second VM - Apache Web Server and PHP Server
Third VM - MYSQL Database Server.
I was able to create user in third vm , providing it all the privileges .
Using two commands
Create User using this command.
mysql> CREATE USER 'user'#'%' IDENTIFIED BY '123456';
mysql> GRANT ALL PRIVILEGES ON project_2.* TO 'user'#'%' WITH GRANT OPTION;
Checking it is working
mysql -u root -h your.mysql.server.address –p
I have reach to this step without any error and is able to access database and perform operations on it.
Now i am looking to write a php script to access the database in web browser
but unable to do it.
Php script is kept in Second VM.
My code For php script is
<?php
$conn = mysql_connect('database','user','123456');
if(!$conn){
echo "bye";
}
else{
echo "hi";
}
mysql_select_db('project_2',$conn);
$query="select * from test";
$result=mysql_query($query);
echo "<table border='1'>";
echo "<tr>";
echo "<th>Name</th>";
echo "</tr>";
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>",$row['name'],"</td>";
echo "</tr>";
}
?>
Try
sudo apt-get install php5-mysql
this may solve your problem

creating a shell script to modify and/or create bookmarks in firefox

I have several applications that change IP addresses every-time they are deployed.
I am wondering how I can create a bash shell script to:
Modify/update existing Firefox bookmarks
If the bookmarks don't exist, then create them.
After some research, I found that I need to modify places.sqlite, so I downloaded sqlite. I looked at the schema, and I think moz_places and moz_bookmarks are what I need to insert to, but I am not sure. If so, how would connect the ids if I need to 2 separate inserts. I already have a way to get the new ip address for every new deployment, so I would just stick that into a variable.
My use case looks something like this:
Deployment 1: URL: 192.168.1.**10**/app1
Deployment 2: URL: 192.168.1.**20**/app1
Brownie points if I can create multiple folders 1st and insert bookmarks inside them. Like {Folder#1: app1, app2}, {Folder#2: app3}, {Folder#3: app4, app5, app6}.
A shell script might not be the best tool for this problem; but you could use a script like this to redirect your browser to a new location each time your application redeploys, and bookmark localhost:<port>:
#!/bin/bash
# redirect localhost:<port> to another address with HTML
local_port="${1:?provide local port to listen on}"
redirect="${2:?provide application ip address}"
while :; do
(
echo "HTTP/1.1 200 OK"
echo ""
echo "<head>"
echo " <meta http-equiv=\"refresh\" content=\"0; url=$redirect\" />"
echo "</head>"
echo ""
) | ncat -l -p "$local_port" > /dev/null
done
This would let you bookmark localhost:8000 in Firefox, and call the script when you redeploy. You could have an instance of the script running for each app; you'd just need to change the listening port. If you have a script that redeploys your app, you could add these lines there.
$ bash redirect.sh 8000 192.168.1.10/app1
$ bash redirect.sh 8001 192.168.1.11/app1

Using ssh to echo text on remote server console

ssh -n -l <login> <server> "echo hello"
Displays the output of the ssh command as "hello". Instead I would like to print the "hello" on the serial console of the remote (freebsd) server. Is this possible ?
see the manpage of wall.
alternatively, if you just want to write to (the first physical, not usb) serial port you could do echo hello > /dev/ttyu0, given you have set up COM1 as a terminal and also have the rights to write to that device. (e.g. you are root)