views:

116

answers:

2

Hi,

I have installed a xampp (apache + mysql + php) stack on a portable volume (truecrypt volume on a usb drive) that I use on different linux machines, for webapp development.

This volume is formatted in ext3, so I run into permissions problems as I can't be the same user on each machine. For example I tried to check the git status of a project started on the other machine and access is denied.

Last time I ran into a similar problem I did chmod 777 (or was it chown?) the whole directory, so I guess the permission status of my php files is messy. This time I am also worried about special cases like git files and the symfony web framework I installed lately.

How should I deal with this situation? I would love to set this permission issue properly.

Thanks a lot for your attention.


Edit : I may need to write a script to locally "sudo chown lampp:lamppusers" each time I use a different machine. Or some git voodoo trick with local-only repositories export? Any idea?

+2  A: 

I doubt there is a way round it like that - you could try using SELinux ACLs instead of the usual permission, but I think that'd be overkill for you.

I would advise just setting the whole directory to 777 with chmod (chown changes ownership), as the user and group each user is in will be different on each machine, you can't really do better. Your only problem here is security - but as its on your local box for your own purposes, I don't see a problem. Not until you copy the files to the server, whereupon you'd best set them back correctly.

You could try authenticating against an LDAP server, you'd retrieve the uid for the username you enter, and that would be mapped to the same uid on each PC, so then you could set group or owner once. (I think, you'd have to ask someone more experienced with LDAP ud mappings).

gbjbaanb
Yeah, I was afraid of this answer actually... Let's see if someone comes up with another idea.
Polypheme
the alternative is to ensure the uids you use on each machine are the same.
gbjbaanb
The "same uid" trick is interesting, I wonder if that would work.
Polypheme
A: 

This seems to be the best solution I have found :

sudo chown -R polypheme:lamppusers webdir

This way I can own again the whole directory with my local username and my local group.

  • polypheme is a username
  • lamppusers is a groupname
  • webdir is the directory containing all my web development files

Note that on computer 1 my username is polypheme and I belong to the group lamppusers, and on computer 2 my username is polypheme and I belong to the group lamppusers. The usernames and groupnames are exactly the same. I am not 100% sure this would work perfectly if names happened to be different.

I have not modified any chmod which is good as the problem is much more complex than simply flatten every file permission with a global

chmod -R 744 webdir

It would be the wrong thing to do with protected files in the symfony framework. And .git/ files too I guess. (gbjbaanb was right about this)

At this point, I have recovered the same configuration I used to have on the other machine, which is what I was looking for. I can work again.

Knowing this, my question suddenly seems stupid. Well, the multi-computer context makes it tricky enough to be valuable. (To me at least)

(This answer will be validated as soon as it has been properly tested)

Polypheme
This actually works perfectly, therefore I validate my own answer. I hope it will at least help someone else similarly confused in this special context.
Polypheme