User problem. Someone made a shell account for me.
Now, I will be needing to edit some files. User f has permission to edit the dir /var/www/htdocs/site. Now, he wants to give the user refalm the same rights as user f. What is the command for such a thing?
Very n00b question
is the right command?
Code: Select all
groupadd newgroup
usermod -g newgroup refalm
To expand on what Tux said.. I assume that one of you have root access? You'll need that to create a group and add your userids to that group. Once you have a group that you are both in you can make sure that the directory and files/directories under that directory are assigned to that group:
# chgrp -R group /var/www/htdocs/site
Now you also have to make sure that the group can read/write to that directory:
# chmod g+rwx /var/www/htdocs/site
The above command only changes permission on the directory itself. You surely would not want to make all files executable but you would probably want to give read write access to the group on all files/directories under it:
# chmod -R g+rw /var/www/htdocs/site
The above will set the "group" permissions to at least read/write (if they also have execute permissions they will retain the execute permissions).
Of course any new file created by either of you will initially be created group owned by whatever your primary group is for your userid. In addition the permissions will be set based on what your current "umask" is set to (type "umask" to see what your umask value is). If your umask is "0002" then when you create a file it will have the proper permissions (rw-rw-r) but it's assigned group would be whatever your primary group is as I said. You could change the group using "chgrp group filename" or if youboth change your primary group to this new group you will not have to do that.
To add a group you just "groupadd groupname" but then you have to add users to the group. This can be done with the "usermod" command. These have to be run by root. To change your primary group you would use the "-g groupname" param to usermod. To just add the user to the group you would use the "-G groupname1,groupname2,etc":
http://voidmain.is-a-geek.net/man?param ... d&mode=man
# chgrp -R group /var/www/htdocs/site
Now you also have to make sure that the group can read/write to that directory:
# chmod g+rwx /var/www/htdocs/site
The above command only changes permission on the directory itself. You surely would not want to make all files executable but you would probably want to give read write access to the group on all files/directories under it:
# chmod -R g+rw /var/www/htdocs/site
The above will set the "group" permissions to at least read/write (if they also have execute permissions they will retain the execute permissions).
Of course any new file created by either of you will initially be created group owned by whatever your primary group is for your userid. In addition the permissions will be set based on what your current "umask" is set to (type "umask" to see what your umask value is). If your umask is "0002" then when you create a file it will have the proper permissions (rw-rw-r) but it's assigned group would be whatever your primary group is as I said. You could change the group using "chgrp group filename" or if youboth change your primary group to this new group you will not have to do that.
To add a group you just "groupadd groupname" but then you have to add users to the group. This can be done with the "usermod" command. These have to be run by root. To change your primary group you would use the "-g groupname" param to usermod. To just add the user to the group you would use the "-G groupname1,groupname2,etc":
http://voidmain.is-a-geek.net/man?param ... d&mode=man