Results 1 to 6 of 6
Hi all,
Im not sure if I should put this in the newbie forum but here it goes anyway.
I have a Centos 5 machine and I would like to ...
- 09-01-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 6
[SOLVED] Editing config files under Windows..
Hi all,
Im not sure if I should put this in the newbie forum but here it goes anyway.
I have a Centos 5 machine and I would like to edit a config files (iptables ). I edit this file on my windows machine, using winSCP (nice free software) to transfer files betweet my linux and windows machine. Now if i edit the config file, and add a # on an empty line and save it, put it back on the linux,. restart iptables it fails. Even when I delete this # again, save it and put it on linux it still fails.
It gives me the following error:
"Error occured at line: 1
Try iptables-restore -h or iptables-restore --help for more information.
[FAILED]"
the first line is:
*nat
Its not that windows changed the extension or something. And when I edit localy with VI it works just fine.
So any help would be much appreciated
Zufira
- 09-01-2010 #2
probably you are putting microsoft carriage returns in the file, do you see any ^M in the file at the end of the lines?
what are you using to edit them on windows?
Why not just use SSH connection and then edit in vi?
- 09-01-2010 #3
You probably experience the different handling of linefeeds between unix and windows.
Unix uses LF
windows uses CR/LF
That´s why your iptables script is invalid after editing under windows.
You can either use a windows editor, that can save in unix style (like notepad++)
or edit your linux files natively.
I would prefer the second option, as it saves you from copying files each time.You must always face the curtain with a bow.
- 09-01-2010 #4Just Joined!
- Join Date
- Sep 2010
- Posts
- 6
@coopstah13: Yes im using the enter button(this is what you mean right?) but I dont see any ^M. I remotely controll the servers but I dont really like VI. I could install another text editor but as I had all the necessities to do it in windows I just prefered that.
@Irithori: Im using notepad. Ill try notepad++ soon thanks. I prefer that as its not much copying and I got to copy some other stuff anyway.
Thanks guys!
- 09-01-2010 #5
you'd have to look for ^M characters on linux machine, windows won't show them
you can try nano for a different editor if you don't like vi/vim
- 09-01-2010 #6Just Joined!
- Join Date
- Sep 2010
- Posts
- 6
Ye i understood that :P though I dont see any ^M on the linux machines (in VI).
Just tried it with notepadd++ 5.7 and it works without any problems
Thanks guys for your time and help!



