redmine_git_hosting icon indicating copy to clipboard operation
redmine_git_hosting copied to clipboard

Could not create directory '/var/www/.ssh' - error message after pushing an existing repo

Open ruigoncalves opened this issue 12 years ago • 2 comments

Hi there!

After pushing an existing git repo into Redmine, the following error message is constantly logged in the apache error log file: Failed to add the host to the list of known hosts (/var/www/.ssh/known_hosts). Could not create directory '/var/www/.ssh'.

Some information about my system configuration:

  • Redmine 1.3.2 stable (mysql)
  • Redmine git hosting plugin 0.4.2

Does anyone know why this is happening? Thanks for the help, Regards!

ruigoncalves avatar Aug 28 '12 10:08 ruigoncalves

note: i got here searching on a diff issue with perl's Net::OpenSSH package but it has similar error to yours.

probably the apache2 user (www-data for ubuntu users) trying to use ssh to connect to another machine default location to store known_hosts for ssh is ~/.ssh/known_hosts so the home (~) directory of www-data is /var/www, that translates to /var/www/.ssh/known_hosts since www-data cannot write to /var/www, you get error.

i found that i can ignore the "Could not create directory '/var/www/.ssh'." if i just created a empty /var/www/.ssh file there just to hold that spot. -rw-r--r-- 1 root root 0 2013-02-07 16:11 .ssh

i tried creating the .ssh directory as the error suggested and gave it permissions for www-data to write in it and it didnt seem to try to write anything in there anyway so it's probably ok to ignore.

borgified avatar Feb 08 '13 00:02 borgified

This worked for me as well.

wonjun27 avatar Mar 20 '15 19:03 wonjun27