Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing ssh keys

Suppose that I have a remote server and GitLab private repository.

I do not want to add key from my server to ssh keys in GitLab account, so I make ssh key forwarding.

However, when I try to run my initial installation scripts with sudo, I cannot pull the repository because with sudo my ssh keys are not accessible on the server.

How can I handle it?

like image 564
Alex Rozhnov Avatar asked Mar 18 '26 19:03

Alex Rozhnov


1 Answers

Check first, as in here, if you can allow the other user (sudo -u otheruser) to access $SSH_AUTH_SOCK file, and it's directory.

That way, you would still benefit from the original SSH tunnel: simply giving more permission to $(dirname $SSH_AUTH_SOCK) can be enough.

like image 68
VonC Avatar answered Mar 21 '26 20:03

VonC