Active FTP Mode not Working in Linux - linux

I am new to Linux and I have my application running on windows for a while and for file Transfer stuff we use third party sftp and it has been running well both on Active and Passive mode.
Now i am migrating my app to support Linux OS, and i'm facing problem in FTP Active mode, where i can transfer files in Passive mode.
I tried through FTP command where i can transfer files in both mode and when it comes implementations it gives me the following error:
500 Invalid PORT Command.
and the before this error the ftp command looks like :
PORT 0,0,0,0,234,96
where for passive it works fine.
Do it need to enable any firewall settings in linux, Please help me out.

PORT 0,0,0,0,234,96
The first four octets represent the IP address, which in this case, seems like is absent. So you either missed out declaring the client's IP address in the application or may be there is some other issue with the IP addresses. Try this link for more info: FTP
Also check if its getting connected when you turn off the Linux firewall.
/etc/init.d/iptables stop

Related

How to connect to an integrated VM without using SSH tunelling

I want to connect to a locked (cannot be modified and I do not have permissions to log into) windows vm which is hosted in a linux machine. Until now these two machines were communicating via port 2277. However for security reasons, the port 2277 is only accessible via localhost (127.0.0.1).
The original proposed solution was to use ssh-tunneling. However since the hosted windows vm will always stay with the linux machine, so I was thinking something simpler.
This Windows virtual machine has ip 192.168.0.1 and the default gateway is 192.168.0.2. The later is the ip address that my linux machine can see.
After searching the internet I tried
socat TCP4:192.168.0.1:2277,reuseaddr,fork TCP4:127.0.0.1:2277
as well as some other random combinations without success.
My understanding is that this failed because for socat to work both sockets must be open.
However the first one is not open by default (checked with ss -ltn) as I need to run the windows service first (which it cannot run as it cannot communicate with iphost:2277)
Any ideas on how to proceed?
Socat provides the retry=N and forever options to handle situations like this. Thus, try something like this:
socat -d -d TCP4:192.168.0.1:2277,reuseaddr,fork,forever TCP4:127.0.0.1:2277
With the interval=<seconds> option you can specify how long Socat waits after each failed attempt.
It turns out that the command that I wanted was the following
socat tcp-listen:2277,bind=192.168.0.1,fork,reuseaddr tcp:127.0.0.1:2277
The retry=N and forever options could be also useful.

Windows is showing rpc server is unavailable when connecting to a SAMBA AD hosted on debian

I have set up SAMBA to act as an AD DC and my machine connects to it fine but when I try to find the Active Directory tools from inside my windows machine I get the error 'naming information cannot be located because: the rpc server is unavailable'
I have no idea what thats bout and the few cases ive seen online deal in different situation not applicable to my case.
The problem can be on either the client or server machine.
Make sure Samba is listening on the right ports. RPC is on port 135. If you don't see Samba listening on port 135, then that's your problem.
Also make sure that, on your client Windows machine, the "TCP/IP NetBIOS Helper" service is running (in services.msc) and set to run automatically. If that was not running, then that's your problem.

Avahi Daemon not resolving (dot)local addresses if queried from different computer

I have two machines, one is Antergos (Arch/Linux) and the other one is Windows 10 connected to each other using LAN. The Antergos PC has a hostname of niffler and the Windows PC has a hostname of phoenix. The IP addresses to both the PCs are assigned by my router and they don't change too often. But still I want to use these PCs using their hostnames instead of their IPs. So I installed avahi and nss-mdns on niffler from the official Arch Wiki and also did everything they mentioned. To double check that I did everything correctly, I pinged niffler (ping niffler.local) using it's own terminal session and it resolved to it's correct IP. However when I use phoenix to ping to niffler, it doesn't work. When I run ping niffler.local from phoenix, it gives the error - Ping request could not find niffler.local. Please check the name and try again.

"421 Active data channel timed out." with FTP client connection from Azure VM from SQL stored procedure

We're migrating from a Windows server box to Virtual Machines on Azure. Our SQL stored procedure uses Integration Services packages to generate feed files and upload them to client ftp servers.
We do this by building script files and using the native ftp.exe client on Windows. My script file looks like this:
open ftp.ourserver.net
myusername
mypassword123
lcd G:\
cd /
prompt
put "G:\DataFeeds\SmithCo_02272017.txt" "SmithCo_DailyFeed.txt"
bye
This works fine on our old server. When I use command prompt to run this code I'm getting:
421 Active data channel timed out.
I can upload the file manually with just a basic connection using WinSCP client on that machine.
I thought it was a port issue so I created an outbound rule in Windows Firewall for port 21, allowed all connection.
Then I created an endpoint in Azure for port 21 as well.
Is there another step to open this up or something I may be missing?
The Windows command-line ftp.exe supports the FTP active mode only. In the active mode, the server has to connect back to the client to establish data connection for a file transfer. More over the ftp.exe does not allow you to pick, what port is used for the data connection. It randomly picks any available port number above 1024. So you would have to create end points for all ports above 1024. That's possibly something you do not want to do. Though you can try.
WinSCP works, because it (as most modern FTP clients) uses the passive mode by default. For the passive mode, you do not need to open any ports on the client side.
Read my article about network configuration for FTP active and passive connection modes for details.
As WinSCP works for you, you can use WinSCP scripting interface to replace your ftp.exe script.
It would be like (ftp.txt):
open ftp://myusername:mypassword123#ftp.ourserver.net/
lcd G:\
cd /
put "G:\DataFeeds\SmithCo_02272017.txt" "SmithCo_DailyFeed.txt"
exit
(Though the lcd is redundant, both in your and WinSCP script).
And run the script like:
winscp.com /script=ftp.txt
See the guide to converting Windows FTP script to WinSCP script.
(I'm the author of WinSCP)

How do you set up a perforce server to work over the internet?

I was setting up a Perforce server and only noticed options for localhosts and such. What I'm trying to do is setup up the server on a desktop machine at one household, and then be able to connect to it using the P4V Client to access the files over the internet form a another household. I no that I'll have to forward some ports and stuff but what set up files do I need to do this? I can only find info for servers that are all being run on the same network like at a business or something nothing that is over the internet. I've set up a team speak server like this where you go to connect and type in the ip address and port and then connect to the server but this dosn't have options like that, that I've seen anyway. This will be done all on Windows 7 64 bit machines. Server on desktop and clients will be on desktops and laptops. All help is appreciated and I'll be posting back with updates on what i'm doing so others can follow this as well if needed.
The server accepts TCP/IP connections, which can be from any client machine which has TCP/IP connectivity. The Perforce server configuration for telling it which IP address and port number to listen at is the P4PORT setting: http://www.perforce.com/perforce/r12.2/manuals/cmdref/env.P4PORT.html
Since you're on a Windows machine, your server will probably be run as a Windows Service, and hence its P4PORT setting will be held in the registry section for that service. You can edit the service's configuration using a registry editor such as RegEdit, or more simply you can use 'p4 set -S Perforce P4PORT=my-host-name:my-port-number' to specify the desired IP address and port.
Then restart your Perforce service from the Services Control Panel and you're good to go!

Resources