I can restrict a key installed into ~/.ssh/authorized_keys to only allow file transfers by forcing an in-process SFTP server:
command="internal-sftp" ssh-rsa AAAAB3NzaC1...(the key follows)
However, using sftp connection it is possible to transfer a new version of authorized_keys to the server, with the restriction removed, new keys added and so on. Afterwards, it is possible to connect interactively.
File transfers are exceptionally dangerous due to this possibility. Is there any way to prevent this, for example, to forbid access to anything within ~/.ssh/ when using internal-sftp?