Score:0

Is it possible to have different ssh keys for ssh login and sftp on the same ubuntu user

mr flag

Is it possible to have different ssh keys for ssh login and sftp on the same ubuntu user, I've tried a lot of things until now and I was not successful, through chatGPT,i tried searching on google but could not find anything, my use case is that a have some services that I give online, and i want the user to only have access to the SFTP, but not the ssh login with that key.

Is there a workaround

hr flag
The usual way to do that would be to match the *user* or *group* rather than the key - see for example [Restrict users to sftp access only](https://askubuntu.com/questions/534675/restrict-users-to-sftp-access-only)
Score:0
kr flag

You can set up this in ssh's authorized_keys.

According to manual

# Forced command, disable PTY and all forwarding
restrict,command="dump /home" ssh-rsa ...

So the same login with different keys will get different level of access. I can't help with exact command for that though.

Anyway, proper way for that is to use different users and according configs in sshd.

Bardhyl Sllamniku avatar
mr flag
Thanks, I ended up setting different users for their respective requirements, as I think what I wanted to achieve was not possible.
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.