Consider two common user: A & B, neither has sudo privilage.
/home/A A A rwx------ /home/B B B rwx------ A wanted to build git from source code:
cd /home/A/third-src wget & extract git.source ./configure --prefix=/home/A/third/git make install # install without root export PATH & LD_LIBRARY_PATH # Here A can use git correctly Now B wanted to reuse A's git, so B asked root to
cp -r /home/A/third/git /home/B/third/git chown -R B:B /home/B/third/git B exported PATH & LD_LIBRARY_PATH for B's git, and expected to use git correctly, but it does not work!! git complains no permission to read file in /home/A/third/git:
git init fatal: unable to access '/home/A/third/git/etc/gitconfig': Permission denied It seems --prefix put absolute path into executable files.
strings bin/git # it really lists /home/A/third/git How to fix it? Is there a canonical way to share locally installed program to others without using root?
Thank you in advance.
1 Answer
There is issue with your permission which includes user, group etc. Here is some reason for git behaviour:
Git reads config settings from a variety of paths and the
<USER>doesn't have access to some of them.Git tries to read root config setting instead of config settings due to the starting script using su command with do not reset environment variables option (-m):
/bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/startup.sh &> /dev/null"
You can try few thing to fix:
Fix the permission:
chown <USER>.<GROUP> -R /home/<USER>/.configchown <USER>.<GROUP> -R /home/<USER>/.gitconfigRecompile using default options:
The second part of your answer that how can two user share locally installed program ?
There few ways I can think of right now is:
- Add user B to user A Access Control List(ACL) list using setfacl command.
- Create a separate group with proper permission setting etc. and add A and B both in that group.
- Install the program in that common space which both can use. Like non-standard path which may include a directory which has access to both or a separate partition which has access to every one depending to your needs.