简体   繁体   中英

Can I give my team a private key for an ssh linux repository that limits access?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM