Score:1

How to restrict a SSH Key user access?

hu flag

So, I have a "personal" server, and it is only being used by me at the moment, but now I want some of my friends to be able to download files through scp using a SSH Key that they will provide to me, but I don't want them to be able to enter my server via SSH nor see the files that I have. Is there a way that I can limit what they can and can't do via their SSH Key? If not, is there other alternatives besides restricting a SSH Key?

muru avatar
us flag
Does this answer your question? [How can I chroot sftp-only SSH users into their homes?](https://askubuntu.com/questions/134425/how-can-i-chroot-sftp-only-ssh-users-into-their-homes)
muru avatar
us flag
Restrict them to SFTP only. In newer versions, scp uses the SFTP protocol, but even if it didn't sftp is still the better way
Score:0
cn flag
raj

There is a program called scponly that is used exactly to achieve what you want. You must set this program as a shell for a user that you want to restrict only to scp.

However, the program is not available in Ubuntu repositories, so you need to compile it from source. Here I found a tutorial on how to do it. Of course, you don't have to follow it literally - you eg. don't have to create /pub/upload directory if you don't need it, and also you probably will have to adjust file/directory permissions to your needs, but the key point is that if you set /usr/local/bin/scponly as a user's shell, that user will be able to use scp/sftp, but will be unable to login interactively over ssh.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.