Since I upgraded to 16.04, the following command fails:

sshpass -p password ssh user@host

with the error:

Could not create directory '/home/mylocaluser/.ssh'.

(~/.ssh folder already exists).

The following command:

ssh user@host

still works.

Before upgrade the first command used to work perfectly.


Discovered that .ssh directory in my home folder was only a symlink to /home/mylocaluser/Dropbox/Mockup/.ssh (and that one doesn't exist)!!! I removed the symlink and now the command sshpass still fails with no errors.


With the last openssh upgrade, I had to reauthorize all of my connections before forwarding them to sshpass.


It's possible that the folder /home/mylocaluser doesn't have the right permissions.

Try running the following commands:

sudo chown mylocaluser:mylocaluser /home/mylocaluser
sudo chmod u+rwx /home/mylocaluser

(Obviously replacing all "mylocaluser" with the appropriate username.)

The first line changes the ownership of the folder to your user and the group (also of the same name).

The second line adds the read, write, and execute (or access) permissions to the directory.

You should now be able to create a folder under that directory, which is what sshpass appears to be complaining about.

  • my home has already the correct permissions. Anyway, read my first edit, please... – jasmines May 17 '16 at 8:05
  • sshpass is saying it cannot create the directory because it already exists, not because of permissions. The question I see as far as that concerned is why it is trying to create that directory. – anonymous2 May 17 '16 at 12:33
  • I did. You said that it was a symlink so you removed the symlink. What do you mean by "sshpass still fails", then? – tu-Reinstate Monica-dor duh May 18 '16 at 0:46

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.