Tuesday, 6 August 2013

How to create a ssh key so that it can only use sshfs?

How to create a ssh key so that it can only use sshfs?

I have an ssh key without a paraphrase that allows a user to log in to a
remote server.
This key is used to mount a folder in the remote server using sshfs and
backup the files in my laptop.
I would like this key to have sufficient privileges to the backup only.
So, since sshfs uses sftp, I thought putting:
command="path to sftp in the server"
in the server's authorized_keys file would work.
Now, when I log in via ssh, I get this:
usage: sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
[-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
[-o ssh_option] [-P port] [-R num_requests] [-S program]
[-s subsystem | sftp_server] host
sftp [user@]host[:file ...]
sftp [user@]host[:dir[/]]
sftp -b batchfile [user@]host
Connection to "my server's name" closed.
I take this to mean that this key can only use sftp, which is what I wanted.
However, when I use sshfs, I get the following:
remote host has disconnected
Please advise. Are there more commands I should include in the "command"
variable in the authorized_keys file?
Thank you in advance for any help provided.

No comments:

Post a Comment