Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am on FreeBSD. Essentially, I am trying to have a php script (run by apache) ssh into another machine. I am running into the problem that nobody does not have a .ssh configuration file and so am getting the error:

Could not create directory '/nonexistent/.ssh'. Host key verification failed.

Is there a way to work around this? Bonus points if you can do this without root access so I do not need to pay my web hosting company to do this.

Thanks.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Try to start ssh with the following options:

ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ...

That way, ssh doesn't try to load and create the .ssh/known_hosts file.

share|improve this answer
add comment

The entire idea behind user nobody is that he has almost no rights on the host. Nobody is not part of any group. Nobody has no home directory.

Without homedir there is no .ssh dir in a homedir. So this is not going to work as nobody.

Possibly you can run the process under an other user? (Though that would require creating another user, which requires root access. Which you stated as undesirable.

share|improve this answer
add comment

What if you assign a shell to the user. On my system, nobody is assigned /sbin/nologin as the shell. what if you changed that to /bin/bash.

I have SSHed into a system plenty of times when no home folder exists, it will create it for you, you just need a shell.

share|improve this answer
    
Root access would still be needed to do this. –  Skaperen Jul 26 '12 at 22:13
    
Assigning a shell to user nobody would give more options to nobody. That might not be bad if the apache/php is the only program using this user. If others also use nobody then you are removing safeties from multiple programs. Creating a separate user for this would be better from a security point of view. –  Hennes Jul 27 '12 at 14:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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