How to setup write permission for a user
hai,
i have a directory "test" , with user and group belongs to root. drwxr-xr-x 2 root root 1024 Mar 21 17:53 test i want to set write permission to a particular user(normal) who does not belongs to root group in my system to this folder. What i need to do??? |
You could "chmod 777 test" which would make it drwxrwxrwx meaning anyone can write to it. This is BAD security however.
A better idea would be to change the group to something else. If root owns it then it doesn't need to be in the root group for root to access it. By putting it in a different group then adding your non-root user to that group both root and that user could access it but no one else could. Another way to do it to restrict security would be to do the 777 mentioned above then set ACLs so that only the user would be able to access it. By the way I hope your "test" is NOT so that you can allow a non-root user to access system directories like /etc, /bin and others. That is an extremely BAD idea. If you trust someone enough to access those then you should give them root access as they can do as much damage with writing files (and removing them) as they can with the password. Also many things won't work if the permissions are not what they are expected to be by security mechanisms - this is done on purpose to prevent hackers from simply going in and changing permissions to 777 on everything. So the key question here is WHY are you trying to give a non-root user access to a directory owned by root? |
First, get familiar with the format of the files /etc/passwd and /etc/group:
Code:
head /etc/passwd Code:
snave:x:3001:3000:,,,:/u/snave:/bin/bash Code:
business::6000 Code:
business::6000:snave Code:
business::6000:user1,user2,user3 Code:
testgroup::7654:user1,user2,user3 Code:
chgrp testgroup /wherever/testdirectory Hope this helps. |
Thank you
Thanks a lot |
All times are GMT -5. The time now is 02:00 PM. |