1826421 Members
3281 Online
109692 Solutions
New Discussion

Re: sftp ^M

 
Erich Donze
Occasional Advisor

sftp ^M

I set up sftp for our developers, but when they upload using reflection with the security components it appends a ^M to each line. This happens in binary and ascii modes. I couldn't find any relavent settings in reflection. Is there some sort of CR/LF setting in the sftpd config file? Thanks in advance,
Erich
6 REPLIES 6
Chris Vail
Honored Contributor

Re: sftp ^M

Pipe it to ux2dos (or dos2ux). Example: dos2ux filename>newfilename.

I can't imagine why sftp isn't removing the extra line feed/carriage returns in each line.



Chris
Steven E. Protter
Exalted Contributor

Re: sftp ^M

I've run into this issue storing scripts from the Syadmin script thread on CIFS/9000 shares. This is only from IE 5.5 to samba shares.

Thats not SFTP, it might be in my case samba.conf settings.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Domenico_5
Respected Contributor

Re: sftp ^M

eric

in add if you have a indent structure you can remove ^M in vi with

:%s/press ^V (ctrl V) and than ^M (ctrl M)//g

bye
Erich Donze
Occasional Advisor

Re: sftp ^M

I'm not interested in removing the ^Ms. My concern is that if I can't prevent them from appearing in the first place I won't be able to use sftp.
Erich
Keith Buck
Respected Contributor

Re: sftp ^M

Another possibility is that the files actually contained the CR/LF in the first place. So, sftp is just copying the existing file. For example, if you create a file within notepad, it will have both CR and LF, so when you transfer that file, it will still have both CR and LF. Options:

1. use an editor that doesn't do this in the first place :)
2. conversion utilities like those mentioned above, either on the windows side or the HP-UX side.
3. wincvs can do the conversion automatically (and I think you can use scp as the transport).
Since you said it was for developers, it may make sense to use a source control system for this sort of thing? Depends on your environment.
4. There may be some option in sftpd to automatically pass files through a filter, such as dos2ux; I wish I could help more on that front but I don't know. Be careful about transfering binaries if you do that...you could definitely corrupt some files that way, which may be a reason why they didn't make it easy :)

Hope that helps some.

-Keith
Steven Sim Kok Leong
Honored Contributor

Re: sftp ^M

Hi,

You can't prevent them from appearing in the first place if you send the documents over directly. If you send documents directly, you can only rely on dos2ux etc. utilities or col -b command to get rid of the ^M characters.

However, if you zip the documents into a zip file in the first place before transmitting over scp and then unzip them at the destination, the ^M issue will not appear.

Hope this helps. Regards.

Steven Sim Kok Leong