Skip to content

create sshd.pid under logs folder by default #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AbhijitNagaraj opened this issue Jan 23, 2017 · 17 comments
Closed

create sshd.pid under logs folder by default #493

AbhijitNagaraj opened this issue Jan 23, 2017 · 17 comments
Assignees

Comments

@AbhijitNagaraj
Copy link

I am getting the below error while installing OpenSSH Win64 0.0.7.0 on Windows 2012 R2 machine.

Couldn't Create pid file "./sshd.pid": Permission Denied

OpenSSH folder has full access,

Thanks,
Abhijit

@bagajjal
Copy link
Collaborator

are you running in administrator mode?

@AbhijitNagaraj
Copy link
Author

Yes, I do. I am not getting this error if I install v.0.0.1.0.

@pkt1237
Copy link

pkt1237 commented Feb 7, 2017

I did have this same issue, with version .0.0.6.0 on a Win2k8 R2 64bit box. To get around the issue, in the sshd_config file i uncommented out the PidFile setting and replaced the ./sshd.pid, with "OpenSSH Install Path"\sshd.pid, and this corrected the issue, in my case it was installed under C: Programs, so the line in my config file looked something like this PidFile "C:\Program Files\OpenSSH\logs\sshd.pid", i believe you can specify it to write the pid file anywhere you wish, i just happened to put it in the logs folder with the rest of the logs files that get created.

@bagajjal
Copy link
Collaborator

bagajjal commented Feb 7, 2017

Hi AbhijitNagaraj, Can you please try and let us know if it works.. if not the share your configuration details like sshd_config, server configuration

@nightwish47
Copy link

nightwish47 commented Feb 9, 2017

@bagajjal
I also encounter the same error message.
I upgraded from v5_30_2016 to v0.0.8.0 hope it can fix issue #241. Good thing is it actually does but a new one comes up.

Couldn't Create pid file "./sshd.pid": Permission Denied

I tried @pkt1237 solution but no luck.
Please see sshd.log and sshd_config. Thanks
sshd_config.txt
sshd.log.txt

@pkt1237
Copy link

pkt1237 commented Feb 9, 2017

@nightwish47
I was looking over your config.txt i see that there are 2 entries for the PID, i know one is commented out but cant help but wonder if it still is somehow conflicting with the override entry, the only other thing i saw is it looks like some of the paths are using / instead of a backslah \ I think / is more of a unix/linux style, but could be wrong. I did notice and error in the sshd.log.txt that stood out almost as if a \ was being escaped,

#############################
PidFile C:\OpenSSH-Win64\logs\sshd.pid
#############################
#PidFile /var/run/sshd.pid
Subsystem sftp C:/OpenSSH-Win64/sftp-server.exe

Executing command: C:\\OpenSSH-Win64\\internal-sftp
not saying that is causing the error but did strike me as odd, the only other thing i can think of is to put double quotes around your windows paths to help escape the slashes easier.

@nightwish47
Copy link

nightwish47 commented Feb 10, 2017

@pkt1237
Thanks for your suggestion. I retry as your 1st post and it works.
In my opion OpenSSH can handle / and \ since their default sshd_config also use /.
For 2 PID, I deleted the once with #.

Error seems random, so I'll keep monitoring.

@bagajjal
Copy link
Collaborator

Can this be closed?

@manojampalam manojampalam changed the title Error while doing sftp in version 0.0.7.0 create sshd.pid under logs folder by default Mar 26, 2017
@manojampalam manojampalam added this to the March-End milestone Mar 26, 2017
@manojampalam manojampalam modified the milestones: Beta, March-End Apr 4, 2017
@bagajjal bagajjal self-assigned this Apr 27, 2017
@GoateePFE
Copy link

I solved this by doing two things:

  1. In sshd_config I changed the PidFile line to:
    PidFile .\sshd.pid
    This creates the file under C:\Program Files\OpenSSH .
  2. I granted the sshd account full control to C:\Program Files\OpenSSH
    Now the SSHD service start successfully and the permission denied message is gone from the sshd.log file.

@DarwinJS
Copy link

Keep in mind that this would allow the sshd service to write malicious code to it's bin folder.

@bagajjal
Copy link
Collaborator

@GoateePFE - step2 is not required? sshd requires write permissions to only logs folder under C:\Program Files\OpenSSH folder.

@alex-rowden
Copy link

I followed the instructions which @GoateePFE listed but I am still getting:
6160 17:21:21 005 error: Error retrieving user environment variables. RegOpenKeyExW returned 5
6160 17:21:21 005 fatal: ERROR. Cannot create process (2).\n
in my log file. I don't know what details I should add to help add clarity to my issue.

@snboisen
Copy link

I had the same error. Solved by specifying the logs folder for the PID file in sshd_config. The configuration file should be changed to have that as default to solve this bug.

@nightwish47
Copy link

nightwish47 commented Jul 28, 2017

@bagajjal
Error is still occurring and seems random.
But when set parameter PidFile is none. The issue is already solved.

So the question is, if PidFile is set as none, is there any impact?

Current: PidFile C:/OpenSSH-Win64/sshd.pid
→PidFile none

@bagajjal
Copy link
Collaborator

No.. Pid file is used to store the process id, it is useful in automation to kill the spawned sshd process

@nightwish47
Copy link

@bagajjal : Got it and will check on our side.

Btw, although we received below message but target files are already transferred successfully.
May we ask you about the cause and solution for this issue?

Related message:
Couldn't Create pid file "./sshd.pid": Permission Denied

@leodotcloud
Copy link

leodotcloud commented Sep 22, 2017

PidFile .\logs\sshd.pid

worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests