I’m learning the importance of permissions across groups as I work more with different distros on the same network. It’s not anything I had done much with in the past — if you use the same distro and the same user name and the same user identity, chances are everything will mesh perfectly without your effort.
But, just as an example, there is a slight difference in the way Arch and Crux assign user names and identities. You can check the information on your user identity with the id command, like this.
The output of that command on my Arch machine, which is the “server” for the network, is this:
uid=1000(kmandla) gid=101(kmandla) groups=101(kmandla),4(adm),10(wheel),91(video),92(audio),93(optical),95(storage),100(users)
But on my Crux machine, it’s slightly different.
uid=100(kmandla) gid=100(users) groups=4(adm),6(disk),10(wheel),16(audio),17(video),21(cdrom)
Some of those groups exist between systems, but some don’t. All of those were set or made by me, when I built the user accounts on each machine.
The problem is that just assigning the user name “kmandla” to both machines doesn’t give me access to files and folders across the network. As you can see, the uid’s for each system is different — kmandla is 1000 in Arch (I think it’s the same in Ubuntu too; I forget), but 100 in Crux, and as a result if I try to access my own files or folders on another machine, I am denied.😯
The easy solution (aside from rebuilding each account to be mirror images, which sounds like a lot of extra work to me) is to rely on group 100 — users — to allow myself to use and access files between machines. In other words, rather than set my own files to be owned by kmandla:kmandla, I set them to kmandla:users, like this.
chown kmandla:users file.txt
Then make sure the group has access permission to the file, for reading, writing or executing, as is appropriate. And remember that “executing” a directory means you’re allowed to move into it — it can be a little frustrating if you forget that.
chmod g+rwx folder
You could also mess with the “others” setting in your file permissions, but I prefer to leave that as inaccessible, even just as a learning exercise. I suppose you could just arbitrarily change the entire folder tree and everything in it to 777 (read, write and execute across every user, group and other field), but that strikes me as vaguely unnecessary.
Anyway, that’s how I handle that little cross-distro quirk. If I rebuild both machines in the future I’ll probably take the added step of assigning both users to the same uid, hopefully avoiding the issue altogether. But for now, if there’s a better or easier way, please let me know.