Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi
i have a little problem.
i want to know that can i set different permissions of a file or directory for different users in solaris. like i can do this in NT.
for example i have some users
user1 , user2 , user3 , user4
and file : file1
i want to give permissions of read to user1 and user2
and oermissions of write to user3 and user4.
can i do this in solaris.

You need to read up on 'chmod', the command to set file permissions.
In UNIX/Linux you can set permissions for three different sets of users:
- the user/owner of the file
- the group (users who are in the same group as the group that owns the file)
- others (everyone else)
Since you want to give read permission to two users and write permission to two users, I think that you'll have to use 'group' and 'other' because two users can't both 'own' a file.So if I'd suggest putting user3 and user4 in a group (ie writeGroup) and giving read/write permission to the 'writeGroup' and then setting the 'others' permissions to readonly. This actual will let anyone else (not just user1 & user2) have read permission, but I don't see a way around that.
So first, set the 'group' owner of the file to 'writeGroup':chgrp writeGroup file1
Then, to set the permissions so that the owner has read/write, the group has read/write and the 'others' have readonly:chmod 664 file1
There are other ways to use the 'chmod' command but I'm most used to using this form to set permissions. It's the quickest & easiest but requires that you can do a little bin to decimal conversion.
664 translates to permissions ofrw-rw-r--
where the first "rw-" is the permissions for the user/owner (read/write)
the second "rw-" is the permissions for the group (read/write)
the "r--" is the permissions for the 'others' (read only)
You'll note that 6 corresponds to rw- and 6 in binary is 110. 4 corresponds to r-- and 4 in binary is 100. Note that the 0 bits in the binary number correspond with the - in the permission sets.
Setting permissions isn't that hard, but there is a lot to explain. So, if this explanation is as clear as mud, you might just need to find a tutorial or chaptor or read 'man chmod'. But, the good news is that permissions in UNIX and Linux work the same, so you should be find with a Linux tutorial, which should be easy to find.Good luck.
If you have specific questions about the above explanation, feel free to post them. It's just too much to explain.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |