Can I do ssh-add against identFile , which will remain forever, currently it prevails only for the current active ssh session (i.e. identityFile added with ssh-add is lost when a new ssh session is executed with the server, can be found by running ssh-add -L)
The problem is that our Amazon server has various projects with repos located on github.
Now each repo has user-based access rights, say user A has access right only for project A , and B has access right only to project B
With this set of permissions (on github), now every user can perform a git operation (for example, git fetch, git push, etc.) only there is the corresponding project (this is what we want)
Now all I want is when the user performs the git operation in the corresponding project, I want the ssh-agent to execute all ssh-keys in the accounts and look for the one that matches this specific users
Note
that each ssh key has a phrase (a unique secret known to every user who has it) associated with it, it is proposed to enter it when the git function is executed.
for this we do
ssh-add /root/.ssh/A
or
ssh-add /root/.ssh/B
But, as mentioned earlier, only for an active ssh session , logging out or creating a new ssh session with the ssh -add server information is lost . can be found by running ssh-add -L
I also tried defining IdentityFile in .ssh / config as described in this question
something like that
Host github.com Hostname github.com User git IdentityFile /root/.ssh/A Host github.com Hostname github.com User git IdentityFile /root/.ssh/B
This only works for one user (sometimes it works for "A", and sometimes it does not work, the same goes for "B")
Can this segregation be achieved or am I voicing a bit ambitious
thanks