LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Samba Users & Log File Issue (https://www.linuxquestions.org/questions/linux-newbie-8/samba-users-and-log-file-issue-4175453746/)

gemmajid 03-12-2013 05:19 AM

Samba Users & Log File Issue
 
Samba Users & Log

I'm using Ubuntu 10.10 with samba enabled in it, every staff member has his own UserId & Password. I'm using user nobody and nogroup so may the shared files can be used by every one. Now the problem is that i'm also making samba audit log by Sambauser & Ip address and it's making with log with user nobody.

I have changed my shared files with user & group root by doing this my log is working fine i mean that it's making with the user name, but the problem is if User A is making any file so it's read only to User B.


Kindly let me know the solution.

shivaa 03-12-2013 05:28 AM

You can add main group of user A as supplimentry (secondary) group for user B. It should possibly solve the pb.
To check user A's primary group:
Code:

~$ id -a A
To add user B to main group of user A:
Code:

~$ usermod -G <groupname> B

gemmajid 03-12-2013 06:45 AM

is it necessary to change shared files permission from no body to root ??

and i have a group named Admin-Department,User A & User B are the member of that group but still i'm facing the same problem??

and i have more than 100 users so what should i do ??

shivaa 03-12-2013 07:01 AM

- Is Admin-Department a primary group for both A and B?
- If Admin-Department is primary for both, then does file(s), created by A, have full permissions for group?

Well, if addition of a user to main group of the file solves the problem, then you can add all 100 users to the group (don't worry, a simple script will do that).

gemmajid 03-12-2013 07:18 AM

User A & User B both are the members of that group but i dont have any idea about primary groups..??

& i have given User=root & group=root to my files, and if User A created any files is read only to user B and both are the members of same group.

I have created few groups just like admin-department, Tax-Users, Audit-Users & Corporate-Users and i have added my users to these groups but i don't have any idea about primary group,

can i do this that first i create new group and add all user to that group and make it users primary group, will it solve my problem ??

shivaa 03-12-2013 07:57 AM

First of all post output of:
Code:

~$ id -a A
~$ id -a B

You can see, if a file has root:root as owner and group, and group has only read permission, then how files can be copied? Files created by user A should have A as owner and A's primary group as main group for the file. Then if user B wants to copy that file, then B should be in main group of the file OR the file should have read/write permissions for group as well others.

Once check manual of following: chmod and chown

gemmajid 03-13-2013 12:14 AM

Quote:

user A (Which is Majid)

uid=1000(majid) gid=1000(majid) groups=1000(majid), 0(root), 4(adm), 20 (dialout), 24re), 115 )admin), 1027 (Taxusers), 1028 (IT-Department), 1029 (corporate), 1030 (admin-department)


User B (Which is mahmood)

uid=1004 (mahmood) gid=1005(mahmood) groups=1005(mahmood), 0 (root), 1027(Taxusers), 1030 (admin-department)
These are the outputs and as you can see that both are the members of Taxusers & Admin-department groups

shivaa 03-13-2013 12:42 AM

Add user mahmood to primary group of majid, as:
Code:

~$ usermod -G majid mahmood
After that, using user A i.e. majid, create a file sample.txt (don't change file's owner or group), and do:
Code:

~$ touch sample.txt
~$ chmod g+rwx sample.txt

Then try user B i.e. mahmood, to access or copy the sample.txt file and let's know the result.

gemmajid 03-13-2013 01:15 AM

I did the same thing as you said, i can copy, move and delete the file, but files are still read only.

shivaa 03-13-2013 01:20 AM

File permissions do not change if you move or copy them, but it remains what was set originally.

If a file has read only permissions, then first change it to r/w and then try to copy or move. Also check user A i.e. majid's umask value, becuase all files created by majid will get their permissions assigned on basis of umask value set in majid's profile.
Code:

~$ grep umask /home/majid/*

gemmajid 03-13-2013 01:57 AM

I have changed my Unix File & Directory mode to 755 to 777 and the read only issued is resolved, but now my samba recycle is not working..

shivaa 03-13-2013 02:09 AM

Quote:

Originally Posted by gemmajid (Post 4910506)
I have changed my Unix File & Directory mode to 755 to 777 and the read only issued is resolved, but now my samba recycle is not working..

Do not change permissions of each & every file to 777, but only for those files which you want to give full permission to user B i.e. mehmood. Revert change for any other files.


All times are GMT -5. The time now is 08:23 AM.