^M appears in my host files

I keep getting ^M at my sshd_configuration. I might be missing something here. Inside my host configuration, when I input the following into my host parameters for sshd_config_subsystem_sftp. I’m trying to use puppet to push out configuration to my servers. Any help would be appreciated.

Subsystem sftp internal-sftp ^M
Match Group: domain?users ^M
ChrootDirectory: /var/chroot ^M
X11Forwarding: no^M
AllowTcpForwarding: no^M
ForceCommand: internal-sftp

Expected outcome:
Subsystems internal-sftp

Match Group: domain?users
ChrootDirectory: /var/chroot
X11Forwarding: no
AllowTcpForwarding: no
ForceCommand: internal-sftp

Foreman and Proxy versions:

System Information

Version 1.11.4 © 2009-2019 Paul Kelly and [Ohad Levy]

Foreman and Proxy plugin versions:

Plugin for Foreman that helps set up provisioning. Dominic Cleal 3.1.0

Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)


This is typically an issue when you copy files generated/edited on a windows system to linux/unix systems.
^M (Ctrl+M) is part of the windows line break (which is \r\n iirc in contrast to linux \n, don’t quote me on this :wink: ). Depending on how you roll out your sshd.config, there are diffent ways to get rid of those. Here I have found some basic examples.

Hope this helps :slight_smile:

1 Like