1

I have following questions: If I mounting sshf mail@host:/home/mail ./foo Is it any way to restrict possibilities of mounting and to not give shell access? All I want is remote, secure storage for mail, but sshfs allow too much. Also, It seems, It requeire mail user to have shell. What is better solutions?

Second, does user have to have shell for cron be able to make it's work?

EDIT: Seems I was not clean enough. What I have:

* remote host(server), that fetch mail via `fetchmail` into some directory.
* client, that need rw, key-authorization access to mentioned mail dir.

Preferable, that client will not get access to anything but maildir. In fact, I need nfs with public key authentification.

2 Answers 2

3

sshfs uses SFTP, which only requires to allow execution of the SFTP server program, the full path of which can vary but is always recorded in /etc/ssh/sshd_config; e.g.

Subsystem sftp /usr/lib/ssh/sftp-server

It is easy to write a "sftp-only" shell that only allows executing this single command. Several already exist.

In addition, the Subsystem line can be changed to use internal-sftp, which is built into the sshd daemon and does not require a shell:

Subsystem sftp internal-sftp

This even allows the user to be chrooted into a particular directory.

1

All I want is remote, secure storage for mail,

You can treat this as one of two different problems:

  • Remote secure storage for "generic files", and your mail files are just a special case of ordinary files
  • Remote secure storage for mail specifically

In the former case, I'd go with something like FTP over explicit TLS, which you can set up using e.g. vsftpd on the remote side, and set up a cron job (locally) to push the mail over ftp using lftp command, for instance, which is a scriptable FTP client. No shell access on the remote box would be needed, and you can even set up client certificates so you can do passwordless login without storing the password in the script.

In the latter case, you may want to look into smtp relays and storing a copy of your mailbox itself in an imap mail spool on the remote server, but that's a lot more complicated to set up.

1
  • For mail specifically, IMAP would be a far better choice than FTPS. It's not even necessary to add SMTP to the mix; there exist several IMAP ⇄ maildir synchronization tools such as OfflineIMAP. Aug 13, 2012 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .