Two Ubuntu 14.04 share data through lan port - ubuntu-14.04

I am trying to share some big data through Lan port in my two Ubuntu 14.04 pcs.
Is there any tutorial I can find so that I can step by step setting up?

Sure, You could use netcat commands.
Source
Open socket to send a file:
cat file | ncat -v -l -p 5989
source is ready to send data through port 5989
Destination
Go to destination machine and read data from source (192.168.1.10) which is sending data on port 5989 in above command
ncat 192.168.1.10 5989 > file
Note that 192.168.1.10 is source IP entered from destination machine. Read further here:Netcat Tutorials
EDIT:
I just noticed that you said Big Data. How big the data is? Netcat will work really well for any size as long as you have stable connection. But for big files it is recommended to have tools which could handle interrupted transfers. You could look into Rsync

I suggest NFS (Network file system) which permits you to mount/umount filesystems with file and directory permissions.
https://help.ubuntu.com/community/SettingUpNFSHowTo

Related

Sandboxing to allow multiple processes open the same port

Background
I have a command-line application that I use to connect to a remote device on port 1234. I cannot change the port number, and I do not have access to the source to rebuild this tool. I'm currently working in a lab where all ports except SSH are blocked. To get around this, I create a tunnel, i.e.:
ssh -L 1234:remotehost:1234 sshuser#remotehost
Now, I can just point my CLI program at localhost:1234 to connect with my CLI tool to the desired host.
Problem
This CLI tool needs to run for about an hour straight, and I have about 200 remote hosts to test with it. I would like to parallelize this task. Unfortunately, I can only create a single tunnel on my local machine using port 1234.
Question
Is there a (trivial/simple/automated) way to jail/sandbox my CLI tool so that I can launch 100 instances in parallel (i.e. via a shell script) so that each instance "thinks" it's talking to port 1234? For example, does Docker or KVM provide some sort of anonymous/on-demand compute node feature that I could setup rapidly? I'd rather not have to resort to manually deploying and managing a slew of VirtulBox hosts via vagrant.
The simple answer is that you can use multiple IP addresses locally. Each local IP address on the client will allow you to create another tunnel. Currently, you are using localhost. But your client also has an IP address. You can prove my point by trying this syntax:
ssh -f -N -L 127.0.0.1:1234:remotehost1:1234 sshuser#remotehost1 # this is default
ssh -f -N -L <local-IP1>:1234:remotehost2:1234 sshuser#remotehost2 # specifying non-default value <local-IP1>
Now, you just need to figure out how to give your client multiple IP addresses (secondary addresses). Then you can expand this beyond 2 parallel sessions.
I've also added -f and -N to your ssh syntax to put ssh into the background (-f) and to not issue any commands.
Using -R tunnels in the past, I've found that I need to enable GatewayPorts on the server (/etc/ssh/sshd_config). In the case of -L , I don't see the need. However, the ssh man-page explicitly mentioned GatewayPorts associated with the -L function. You may need to play around a bit. I just tried this out on my Mac and I was able to get it going without any GatewayPorts considerations.

Sending .csv file from linux to windows

I want to send files (txt or csv) from linux to windows.
I already have a script to get information and put it into a .txt or .csv file, tried with many ways to send this file from linux to my computer.
there is a ping from server to my computer IP, but when i use below commands it gives:
ssh: connect to host 10.10.X.X port 22: Connection timed out
scp -r fname.lname#10.10.X.X:/home/ test.txt
or
scp test.txt fname.lname#10.10.X.X:/C:/Data
Please could you help, simply I wanna have a copy of file (that I have it in server) in my computer, to use it.
there is some similar questions with no answer here.
You need a ssh server installed on windows. Windows does not currently have out of the box ssh server. They are thinking of implementing OOB ssh servers in future releases of windows 10.
Have a look at this link https://winscp.net/eng/docs/guide_windows_openssh_server
Also, if the file transfer that you want is a one time transfer, you can use putty with a reverse scp to retrieve the file or you can use WINscp ( https://winscp.net/eng/download.php )
I usually use the command 'nc' for file transmission.
But since on Windows you have to install a cygwin to use nc, so I think the simplest solution may be like the following.
On linux, go to the directory of those files, and then type:
python -m SimpleHTTPServer 1234
Then on windows you can visit 10.10.X.X:1234 in your browser, and download those files.
Note that 1234 can be replaced by any other port which is not currently used on linux.

Trouble locating my serial ports using bash on Windows 10

I want to be able to read from serial ports on my computer and write to a file. Inside /dev (using Bash shell on Windows 10) I can't seem to locate my USB serial ports (I have tty, tty0, tty1, and that's it for tty).
Is it located somewhere else, or even accessible through the bash shell? I just want to be able to know how to access it at this point.
In device manager, COM4 shows up under ports when I plug in my USB. I also ran the command wmic path Win32_SerialPort in the Windows command prompt and it said "No Instance(s) Available." So I'm very confused as to how I can view my Serial Ports and why they aren't showing up in certain instances.
Any clarification on how serial ports work, especially with USB, would be greatly appreciated, as I am pretty new with this stuff.
Soon, Windows will officially support serial on the Windows Subsystem for Linux (WSL). The COM_n_ ports will be available at /dev/ttyS_n_
Mapping:
COM1 >> /dev/ttyS0
COM2 >> /dev/ttyS1
...
COM192 >> /dev/ttyS191
A good functional description can be found here:
https://blogs.msdn.microsoft.com/wsl/2017/04/14/serial-support-on-the-windows-subsystem-for-linux/
NOTE: At time of writing this feature is only available on the insider builds.
I have the same problem. Apparently you still can`t use serial ports in Bash on Ubuntu on Windows (BoUoW).
You can do basic read and write operations using socat. I used Cygwin to create a socat server that sees my serial ports. I had problems with DTR and RTS pins though.
With socat you can create virtual serial ports or forward a serial port over TCP. (And much more.)
In Cygwin serial ports are listed under /dev/ as ttyS*.
For example COM3 is /dev/ttyS2 and COM4 is /dev/ttyS3.
Start the server in Cygwin with
socat -d -d -d TCP4-LISTEN:2022,reuseaddr,fork /dev/ttyS3
Start the client on BoUoW with
socat PTY,link=/tmp/vmodem0 TCP:localhost:2022
This will create a virtual serial port in BoUoW at /tmp/vmodem0 that is connected to COM4 on your machine.

noVNC Multiple Localhost Servers

Ive got 4 dev VMs for four projects (all VMware Player VMs w/ubuntu 15.04 host) where each is running VNC (ports 5900, 5901, 5902, 5903) respectively.
I downloaded noVNC and saved to /var/www/html (my apache2 server on same host). Based on the ReadMe I then ran on my terminal
./utils/launch.sh --vnc localhost:5900
I received a missing websockify error, so downloaded it and placed it into the util folder. I then ran the same command and it worked! The terminal told me to Navigate to a url and sure enough I could control my VM.
However -- I'm wondering how can I use noVnc to access all 4 VM's? Is there some simple way to extend the port to a range like in iptables or firewalld?
./utils/launch.sh --vnc localhost:5900-5903
Okay, Ill answer for myself here in case it helps someone in the future...
First, create a token file where each line has a nickname, ip address, and port.
I created a file named token.list where each line looks like:
localhostnickname1: localhost:5900
localhostnickname2: localhost:5901
...
Then I use my terminal to go into the websockify folder so I can see the run file. I issue it the command:
./run --web /path/to/noVNC --target-config /path/to/token.list localhost:6080
Finally, I open my web browser and go to :
http://localhost:6080/vnc_auto.html?path=?token=localhostnickname1
Where localhost1 is the nickname of my first server on the first line of token.list
This link was my reference. If you want to serve this outside of localhost -- change the parameter localhost:8060 from localhost to an IP

NT_STATUS_ACCESS_DENIED Error in Samba share

So, I tried to set up a public SMB share with Samba on CentOS 7. Now, I have it set up, and I have a headache. But, sweet victory. I'm posting this here for all y'all so that you don't need to waste your time. It's actually easy, you just need to know the hoops you need to jump through. I'll also edit the Samba wiki.
The first problem was that it wouldn't connect at all, except locally:
Remote Connection (my Linux desktop):
-------
[root#my-desktop ~]# smbclient //sambaserver/PublicDocs -N
Error connecting to 192.168.100.97 (No route to host)
Connection to cgybkp01 failed (Error NT_STATUS_HOST_UNREACHABLE)
On Windows 8, using Windows Explorer, after typing "\\sambaserver" into the address bar, the progress bar would wait, wait, wait, then time out. The error message was:
Remote Connection (my Windows 8 desktop):
Windows cannot access \\sambaserver
Check the spelling of the name. Otherwise, there might be a problem with your network. To
try to identify and resolve network problems, click Diagnose.
This ended up being a problem with firewalld. To unblock Samba, I needed to add this line to /etc/firewalld/zones/public.xml :
<service name="samba"/>
Perfect, now I can connect!
But, I was actually mounting an NFS share, so I had one more issue, with SELinux. Now, when I attempt to connect with smbclient...
smbclient //sambaserver/PublicDocs -N
I can connect, but when I try to ls, I get the error: "NT_STATUS_ACCESS_DENIED" in CentOS 7. So, how do I connect?
The first thing everyone recommended that I try was file permissions. If you're not familiar with file permissions in Linux, I'd recommend trying those first. But for me, that didn't work, because SELinux was blocking me.
To see all of the SELinux options for Samba, type:
getsebool -a | grep samba
getsebool -a | grep smb
The one I needed to change was samba_share_nfs, because I was sharing an NFS mounted directory:
setsebool -P samba_share_nfs on
CentOS maintains a list of these booleans here.

Resources