Oracle Linux issue - all files FTPed to it from windows need to to be processed with dos2UNIX


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Oracle Linux issue - all files FTPed to it from windows need to to be processed with dos2UNIX
# 1  
Old 08-25-2016
Oracle Linux issue - all files FTPed to it from windows need to to be processed with dos2UNIX

Hello Friends,

I have observed one recent issue about ftp from windows to Linux.

Initially we had Solaris unix and any file sent from windows to solaris via ftp (binary or ascii) worked smoothly.
Say for e.g if I sent a shell script to soalris from windows, that script used to run corectly. So did an encrypted file which got successfully decrypted on Solaris.
Things changed when we got Redhat linux which replaced solaris and now all the above file transfers have caused issues. In that, once the file was successfully transferred to Linux, and if you open the file in Vi editor, you will see [dos] at the bottom. This is not about ^M characters. I assure that files are sent in correct mode. So we dont get ^M chars. Only the [dos] at the bottom when opened in Vim. so the shell scripts having [dos] at the bottom dont run and error out.
The binary files sent via ftp also dont work when ran on Linux.
Thus, all these files run only when dos2unix is ran on them. On text files the [dos] symbol goes away and bainary files get run successfully then.

My question to experts here is, why in solaris, a file which is sent in correct mode from win to solaris does not need a dos2unix processing and why those files need dos2unix processing when sent from win to Redhad or Oracle Linux.

Thanks,
Albert
# 2  
Old 08-25-2016
Quote:
Originally Posted by Albert_Pinto7
My question to experts here is, why in solaris, a file which is sent in correct mode from win to solaris does not need a dos2unix processing and why those files need dos2unix processing when sent from win to Redhad or Oracle Linux.
Most probably because Solaris ftp had a default mode of "binary" whereas Linux ftp has "ASCII" or thereabouts.

ftp (the command, not the protocol) has two modes: "binary" sends files as they are. "ASCII" becomes aware on which system type it runs and translates line-ending sequences to the respectively correct sequence on the target system. I have written a lengthy explanation about what is going on and why which you can read if interested.

Perhaps the Linux ftp can be configured to do the same as the Solaris client did.

I hope this helps.

bakunin
# 3  
Old 08-25-2016
Hi Bakunin,

Thanks for your reply!

But, the mode is not the issue. I have sent the same file from win to Linux in both, binary and ascii modes. In both cases [dos] sign att he bottom of the file when received at linux end says that it has some dos chars.

Sorry if I have missed your actual point which you wanted to convey. But, modes are not the issue as in both the modes we have to run dos2unix on the said file when received on linux.
# 4  
Old 08-25-2016
Quote:
Originally Posted by Albert_Pinto7
But, the mode is not the issue.
Believe me, it is.

Quote:
Originally Posted by Albert_Pinto7
I have sent the same file from win to Linux in both, binary and ascii modes. In both cases [dos] sign att he bottom of the file when received at linux end says that it has some dos chars.
What do you mean by "[dos] sign" this is definitely not a diagnostic message of the ftp command, yes?

Quote:
Originally Posted by Albert_Pinto7
But, modes are not the issue as in both the modes we have to run dos2unix on the said file when received on linux.
Of course they are, but you have probably not yet identified the culprit. The only thing "dos2unix" and similar tools do is to replace <CR><LF>-styly line ends (DOS/Win) to <NL>-style line ends (UNIX). Use a hex editor on what you call a DOS-file and on what you call a UNIX-file and you will see this exact difference described in the post i linked to above.

Create a test file (in UNIX) of two lines, like this:

Code:
AB
CD

and use this command in UNIX to display it:

Code:
# od -ax /path/to/testfile

then transfer it, so that it is converted to "DOS" mode, then do the same again. You will see the difference easily.

I hope this helps.

bakunin
# 5  
Old 08-25-2016
To my knowledge the [dos] tag in vim says that there are CRLF line endings and the ^M sequences are not displayed.
I remember some time ago the vsftp FTP-server on RedHat ignored ascii mode and always used binary mode, no matter what the client set.
# 6  
Old 08-25-2016
I agree with cero. Redhat says it's doing a ASCII mode transfer but it lies and does a binary mode transfer anyway. I think that you have to force this. Please post the content of /etc/vsftpd/vsftpd.conf
# 7  
Old 08-25-2016
A recent vim, when the majority of lines have <CR><LF>, does not display the <CR>s as ^M, but goes into [dos] mode. New lines will get the extra <CR>. So you can directly edit DOS files.
--
DOS (United States) Department of State
DOS Denial Of Service [attack]
DOS (Microsoft) Disk Operating System
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File processed in Unix had issue open using notepad

Dear all, I had a columned based file after processed from my script. In unix platform, my file is ok, with all columns sorted out nicely. But when i open in windows notepad, the columns are running out of order. Can some one help?? Thanks alot in advance (4 Replies)
Discussion started by: ymeyaw
4 Replies

2. Shell Programming and Scripting

copy files from linux to windows

is there any way to copy files from linux to windoes with out mounting ideally using a script in linux or windows which ever possible (4 Replies)
Discussion started by: robo
4 Replies

3. Shell Programming and Scripting

Issue regarding dos2unix perl script

Hi All, I have pearl script which will check and convert the file: INFO("dos2unix_cmds".$#{$dos2unix_cmds}); if ( $#{$dos2unix_cmds} == 0 ) { my $convert_cmd = $$dos2unix_cmds; my $rename_cmd = $$dos2unix_cmds; --conversion going here else INFO ("No need to... (8 Replies)
Discussion started by: saps19
8 Replies

4. Shell Programming and Scripting

Connect to Oracle in Windows XP from Linux HOST

Hi everyone, I have oracle 9i installed in Windows XP and i have ubuntu in VM WARE. I would like to know how to connect to Oracle in windows xp from Linux through shel scripting...... (3 Replies)
Discussion started by: Zimbu
3 Replies

5. Linux

Trying to FTP files from Windows to Linux

I am trying to FTP some files from a box running Windows XP to a Linux box and cannot get the right syntax for the file path. (5 Replies)
Discussion started by: Brian Miller
5 Replies

6. Shell Programming and Scripting

remember processed files

Hello dear community! I have the following task to accomplish: there is a directory with approximately 2 thousand files. I have to write a script which would randomly extract 200 files on the first run. On the second run it should extract again 200 files but that files mustn't intersect with... (5 Replies)
Discussion started by: sidorenko
5 Replies

7. Shell Programming and Scripting

Need year to display from ftped files list

Hi All, p_ftp=dummy time ftp -niv 192.0.0.2 << EOF user dummy dummy cd prt/$p_ftp ascii ls -ltr quit output is -rw-r--r-- 1 500 500 5137 Mar 04 11:21 dummy.csv can any one suggest how to get year while using ftp (1 Reply)
Discussion started by: Vrgurav
1 Replies

8. UNIX for Dummies Questions & Answers

How can I make dos2unix in hp without renaming files?

Hello all It seams that in HPUX when Im using dos2unix program I need to rename the file to new file and then back if I like to Format the file. Is there shorter way to do this? Thanks (2 Replies)
Discussion started by: umen
2 Replies

9. UNIX for Dummies Questions & Answers

View Files In Linux/Windows

I have a bunch of text files that currently reside on a red hat linux machine. I'd like to zip them up and copy them to a windows machine. I'm not sure about how to do this though since I believe zipping files up creates a totally different format that will be unreadable on windows. Is there any... (3 Replies)
Discussion started by: doublek321
3 Replies

10. UNIX for Dummies Questions & Answers

Is there a linux version of dos2unix command?

I'm having some probs and i know in unix i can do a dos2unix command and fix it, and it looks like that may be my problem now, but linux doesn't have dos2unix of course, anything comparable? (4 Replies)
Discussion started by: kymberm
4 Replies
Login or Register to Ask a Question