0

I have created a group in RHEL with one user in it. This user will need full rwx access to /home/anotheruser/ ,recusively. How do I change the user/group permission to allow that user/group to rwx in /home/anotheruser/

If I do a vi group in /etc/ this is what is says:

usergroup:x:505:user123

Also, what is the :505: mean?

Thank you for any input!

1 Answers1

2

505 is the group ID.

You need to put the both users in one group and make the /home/anotheruser/ can be writable by group:

usermod -a -G usergroup anotheruser
chmod -R g+w /home/anotheruser/ 

Change umask to 0002 so newly created folder will has permission 775.

echo "umask 0002" > /home/anotheruser/.bashrc

Set SGID bit for all folders in /home/anotheruser/ to make all folders created by user1 will be owned by usergroup group:

find /home/usergroup -type d -print0 | xargs -0 chmod g+s /home/usergroup
quanta
  • 50,327
  • 19
  • 152
  • 213
  • Great, before I execute these commands... do I have to be in root? Any specific place as to where I should execute them? Can this mess up my files or permissions in the /anotheruser/ directory? – mcfan123 Aug 17 '11 at 03:03
  • 1
    @mcfan123 - Yes to being root and the potential to mess stuff up. No to needing to be in a specific directory when you run those commands. You seem unfamiliar with Unix permissions concepts. I suggest reading up on them before taking any action to make sure you don't create unintended nasty surprises. http://www.zzee.com/solutions/unix-permissions.shtml is a good starting point. – voretaq7 Aug 17 '11 at 03:07
  • will the umask 0002 change all umasks? – mcfan123 Aug 17 '11 at 03:18
  • my current bash setup is if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then umask 002 else umask 022 fi – mcfan123 Aug 17 '11 at 03:26
  • it means that if uid is greater than 99 and effective user ID and effective group ID is the same, set umask to 002. – quanta Aug 17 '11 at 03:34
  • both umasks should be 002 in bashrc? – mcfan123 Aug 17 '11 at 03:42
  • Do you want `anotheruser` can write to the folder that created by `user`? – quanta Aug 17 '11 at 03:55
  • I want user123 to be able to write in anotheruser – mcfan123 Aug 17 '11 at 03:58
  • Do it for only `anotheruser` user. – quanta Aug 17 '11 at 04:16
  • This may seems silly to ask but, what am I do to exactly? – mcfan123 Aug 17 '11 at 04:17
  • Exactly what? I think you should **really** understand what you do. – quanta Aug 17 '11 at 05:56