![]() In case you need a finer grained control of which environment variables are exported to sudo, use -preserve-env=list option instead of -E. Notice that you're using sudo -E twice: One to call the script, and another to call git inside the script. To achieve that, you can rely on sudo again :) sudo -E -u $(logname) git pull Heres the git version and update information (latest available in RH) git -version git version 1.7.11.3 sudo yum check-update git Loaded plugins: downloadonly, rhnplugin, security This system is receiving updates from RHN Classic or RHN Satellite. ![]() Inside your script, run the git command "as the user" instead "as root". sudo PAGERsh -c exec sh 0<&1 git -p help. Run your script using sudo -E: The -E preserves your user environment variables to be defined when running on sudo (some SSH variables, I think SSH_AUTH_SOCK and/or SSH_AGENT_LAUNCHER will be required, but I don't know much about the details). The help system can also be reached from any git command, e.g., git branch. When you run something with sudo without specifying a particular user, you are running it as root user.Īs it seems you cloned your repository via SSH, git (actually SSH I guess) is looking for the SSH private key for the root user instead of the one of your user: /root/.ssh/ vs. To interact with an existing SUID binary skip the first command and run the program using its original path. Allow User git to run git pull as As far as i understand. This example creates a local SUID copy of the binary and runs it to maintain elevated privileges. If it is used to run commands (e.g., via system()-like invocations) it only works on systems like Debian (<= Stretch) that allow the default sh shell to run with SUID privileges. ![]() It should already be installed when you set up your WSL installation, but if it isn't. It is also used to create remote-tracking branches for each branch in the cloned repository. In WSL distros like Ubuntu and Debian you can install Git using the command sudo apt install git. If the binary has the SUID bit set, it may be abused to access the file system, escalate or maintain access with elevated privileges working as a SUID backdoor. The git clone is a git command, which creates a clone/copy of an existing repository into a new directory. So what you need to run is sudo apt install git. Sudo git -C "$TF" commit -allow-empty -m x In order for you to run commands with root permissions you must add the command sudo to the beginning of your command string. git clone ssh://URL.com/soft.git softgit the ssh key idrsa and idrsa.pub are under /home/user/.ssh my purpose is the execute git with sudo but I got the following error Cloning into '/home/user/git/soft'.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |