Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3623420
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:22:53+00:00 2026-05-18T23:22:53+00:00

The dilemma: a Linux program that I’m working on should: Fetch a package over

  • 0

The dilemma: a Linux program that I’m working on should:

  1. Fetch a “package” over git+ssh:// protocol (using Git).
  2. Install that “package” in the system.

For git+ssh to work, Git needs to see my keys.

For the “package” installation, the program must have superuser privileges.

A limitation: the program should not elevate privileges (call sudo) by itself. User must explicitly invoke it with sudo. (Lets ignore the case when user runs the program while begin logged in as root — assuming he will setup keys correctly then.)

So, the question is: how to do ssh access with user keys from the program that is invoked with sudo?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:22:53+00:00Added an answer on May 18, 2026 at 11:22 pm

    use the -i identity_file ssh parameters. To tell git to use the proper command you should set the GIT_SSH variable to a file that will call ssh -i “$@”.

    If you can’t do that then you should drop privileges while you do the git pull command.

    sudo -u <original_user> git fetch git+ssh:// 
    

    You can use the ${SUDO_USER} enviroment variable to find out who the original user was.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The dilemma I'm using a before_filter in my controller that restricts access to admins.
I ran into this dilemma when working on an ASP.net web application using Web
I have a little dilemma that maybe you can help me sort out. I've
We have a dilemma; developing desktop application using Matisse or Jigloo.. Matisse has this
I have a dilemma that I've encountered before. What's the best in terms of
I'm facing a dilemma (!). In a first scenario, I implemented a solution that
My dilemma is that I need to compile a large amount of projects and
Here's my dilemma. I have 2 animations that need to run sequentially. The first
My dilemma: I'm passing my function a string that I need to then perform
Basically my dilemma is this. I have a list of x servers that host

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.