There is a server with CentOS 6.4 and remote sftp storage (without Linux). I connect to it with the command:

sshfs пользователь@адрес: /var/spool/asterisk/ftpserver -o allow_other,reconnect,ServerAliveInterval=30,uid=1000,gid=1000,umask=000,nonempty 

Then you need to enter a password. How can I connect automatically without manually entering a password? For example, in curlftpfs there is such a function:

 -o user=юзер:пароль 

But curlftpfs seemed very slow to me.

I tried to copy the rsa key to the storage with the command:

 ssh-copy-id -i ~/.ssh/id_rsa.pub '-p 22 юзер@адрес' 

But this error appears:

 exec request failed on channel 0 

    2 answers 2

    $ ssh-copy-id -i ~ / .ssh / id_rsa.pub '-p 22 user @ address'
    exec request failed on channel 0

    It is logical, if only allow sftp .

    if the ssh server at all allows you to use keys, try adding them manually:

    1. Mount this user's home directory somewhere in an empty directory:

       $ sshfs пользователь@адрес: /локальный/пустой/каталог 
    2. create a .ssh directory in it:

       $ mkdir -p /локальный/пустой/каталог/.ssh 
    3. Add your public key to the authorized_keys file in this directory:

       $ cat ~/.ssh/id_rsa.pub | tee -a /локальный/пустой/каталог/.ssh/authorized_keys 
    4. make the .ssh and its contents inaccessible to other users:

       $ chmod -R go= /локальный/пустой/каталог/.ssh 
    5. unmount the home directory:

       $ fusermount -u /локальный/пустой/каталог 

    Now try to remount what you need.

    if you still request a password, then most likely the local ssh server either does not support key authorization at all, or it is prohibited (for this user).

    then you can try to pass the password through stdin . according to man sshfs , the program must understand the password_stdin option:

     $ echo пароль | sshfs -o password_stdin,другие-опции ... 

      Solved the problem like this:

       echo 'password' | sshfs user@remote.host:/somedir /somemydir -o password_stdin 

      Thank!