Hi DM,
Recently I've been working on trying to get SlyEdit to behave in a
way that it could be used to edit general files (and specifically,
SSH keys & such, as it seems that might be useful at some point).
I'm at a point where I've started doing a test to make sure SlyEdit
is saving the file correctly:
There's a system set up where I have an SSH key shared with it so
that I can SSH to it without entering a password, and my test is
basically this: 1. Move my local ~/.ssh/id_rsa to a different place,
and open it in a text editor (so I can copy it) 2. Edit ~/.ssh/id_rsa
with SlyEdit (which at this point is a new file), then copy the
contents of id_rsa from the text editor and paste it into my terminal
session with SlyEdit, and save the file 3. Try to SSH to that remote
system from my BBS machine and see if it's successful
After this, id_rsa looks fine, but SSH authentication fails (ssh says
it loads id_rsa but it says "error in libcrypto" and prompts me for a password). I've found that the reason seems to be id_rsa has
DOS-style line endings (with \r\n) - I verified with a hex editor and
saw that was indeed the case. If I convert id_rsa with dos2unix, I'm
able to successfully SSH to the other PC.
SlyEdit is writing the lines using the File.writeln() function. I'm
running my BBS on Linux; should writeln() be expected to write with
\n line endings on Linux?
As a test, I tried having SlyEdit use write() (instead of writln()
and append "\n" at the end of each line, but the lines in id_rsa
still end with \r\n. I also tried opening the file with binary (as
"wb") but the file still had \r\n line endings.
Taking a step back, should I even be worrying about the line endings
when saving files with SlyEdit? I'm not sure what the best course of
action is here.
After this, id_rsa looks fine, but SSH authentication fails (ssh says it loads id_rsa but it says "error in libcrypto" and prompts me for a password). I've found that the reason seems to be id_rsa has DOS-style line endings (with \r\n) - I verified with a hex editor and saw that was indeed the case. If I convert id_rsa with dos2unix, I'm able to successfully SSH to the other PC.
SlyEdit is writing the lines using the File.writeln() function. I'm running my BBS on Linux; should writeln() be expected to write with \n line endings on Linux?
Sysop: | Danilo |
---|---|
Location: | Keeling, VA |
Users: | 1 |
Nodes: | 20 (0 / 20) |
Uptime: | 100:05:33 |
Calls: | 9 |
Calls today: | 9 |
Messages: | 2,894 |
Posted today: | 23 |