I have a linux repository in my school that allows me to access my own root. Could I give my team a private key that only allows them to R/W on certain folders in my own directory?
For instance I would have two folders like so: path/to/folder1 & path/to/folder2.
Could I specify a specific private key to only having access to those two folders and nothing else? In any other folder, an attempt to R/W would result in (access denied). They would be logging in as me, but the private key would default to this limited access.
Edit: Even better. All I really want them to be able to do is git merge main. That's it. I want them to be able to be inside of my root, and do the command git merge main. Only access I want them to have.
CodePudding user response:
Yes. You can use the command
parameter in your authorized_keys
file for that. See AUTHORIZED_KEYS FILE FORMAT in https://man7.org/linux/man-pages/man8/sshd.8.html:
command="command"
Specifies that the command is executed whenever this key is used for authentication. The command supplied by the user (if any) is ignored. ... This option might be useful to restrict certain public keys to perform just a specific operation. An example might be a key that permits remote backups but nothing else.