Hi I'm building openssh from source. From source primarily because, I want to collect more logs than what openssh already writes in /var/log/auth.log file.

In one of the c files of the source directory, I am trying to print some values to my personal file as follows

FILE* fp = fopen("/home/raghu/openssh/my_log.log", "w");
fprintf(fp,"username: %s,password:%s, ipaddr:%s, port:%d", authctxt->user, password, get_remote_ipaddr(), get_remote_port());

Now , when I rebuild 'sshd' from source and try to connect to server with valid/invalid credentials, it says 'Connection closed'.

Any idea, why this is happening? I don't see any logs too in syslog and auth.log. Is there a better way to write to a custom file?


I would start with increasing the loglevel to Verbose. Open the /etc/ssh/sshd_config file and change LogLevel from INFO to DEBUG

If you still need to recompile ssh then make sure to both have DEBUG log level on server side and use "ssh -v" to connect to get more details on why the connection is closed.

sshd_config Documentation for LogLevel

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.