File group issues

Hi All,

I have a script which called by user id (mftp) . The set up is working on two server and not working one server.

Working Server :

-rw-rw-r-- 1  mftp   csp 0 Jan 17 00:14 117001.log

Non working server

-rw-rw-r-- 1  mftp   mftp 0 Jan 17 00:14 117001.log

from the above comparison I thought that mftp id was not csp group.So I added the mftp id to csp group. Even after that I am seeing the file is created like .

-rw-rw-r-- 1  mftp   mftp 0 Jan 17 00:14 117001.log

What should I make to create them as

-rw-rw-r-- 1  mftp   csp 0 Jan 17 00:14 117001.log

This is what the o/p of groups

groups mftp   
mftp  : mftp csp amp

Thanks in Advance

We might guess that the output you showed us from the groups command is from the non-working server.

What output do you get from that groups command on each of your three servers.

To add to what DonCragun already remarked: in which way does your script "not work"? Is there any error message (if yes: post it), diagnostic message (if yes: post that either), return code (if yes: which one), etc..

Always keep in mind that we a seeing your problem through your description and only know what you tell us.

I hope this helps.

bakunin

Hi bakunin,
I agree that a much more explicit statement of what is wrong would help. My assumption is that the group ID on the log file on the working server ( csp ) is the desired result and the group ID on the non-working server ( mftp ) is the wrong result.

Hi arunkumar_mca,
My first guess was that the primary group of user mftp is csp on the working servers and is mftp on the non-working server. Another likely possibility is that the directory in which the files are located is configured to use the GID of the containing directory on some of the servers and is configured to use the effective GID of the creating process on some of the servers. In addition to showing us the output of the command:

groups mftp

on each server, please also show us the output from the commands:

ls -ld .
df .
mount
uname -a

on each server while sitting in the directory where 117001.log is located on that server. (Note that the mount command might not be in your normal command search path and might not appear in section 1 of your man pages. On many systems, the command might be /sbin/mount or /etc/mount .) What we are looking for is the permissions on the directory where 117001.log is being created, the filesystem type being used to store that directory, and the operating system (including the release number) being used on each system.

1 Like

You are right, this is perhaps the most likely reason. another would be that "failing" means that another (hypothetical) script is relying on the group permissions of the file being "csp" and not "mftp". In this case it would not matter if the "mftp" account is in the group csp or not. All would depend on the user the other script is run under being in the mftp group.

Either way, it would be easier to know (instead of hypothetically debug hypothetical scripts) what is going on.

I hope this helps.

bakunin

[/CODE]Thanks for you reply.

There is no error in the log. The issue is there is a script which run for 2 countries. Both uses mftp login. When the script is running it is creating file for the working country it is created as below

-rw-rw-r-- 1  mftp   csu 0 Jan 17 00:14 117001.log

and for the non working countries it is created as below. We are having group as

for the non working country. So I think this is causing the issue

-rw-rw-r-- 1  mftp   mftp 0 Jan 17 00:14 117001.log

You still didn't say WHAT and HOW is "not working", although this has been requested several times. Don't expect any meaningful help unless you supply seriously more detailed info.

By default, the file will be created with the Primary Group of the user creating the file, so field 4 in /etc/passwd although this can be changed with the newgrp but there are things to consider in the manual page for that too.

You can try to set a file to be a certain grep with the chgrp command.

I would also point out that it would be sensible to ensure that the ID number of the groups should match between the servers. The files are marked as owned by a user number and group number. These number are translated for humans when you use ls -l and similar commands.

If you copy files from one server to another keeping the permissions then the displayed names may change if the user account numbers and group numbers are not consistent.

Robin

1 Like

How it is not working.

The file will be created by mfpts user and will be accessed and modified by another program. Since the other program which modify the file is not having access to this file because it is not created with the csp group. The program is not getting executed and no error in log file it is a zero byte file

Thanks
Arun

This is exactly what i suspected in my post #5 above. You need to make sure that the file is created with the correct group membership. There are several ways to achieve this, but the perhaps most safe one is to set the sticky bit for the group membership of the directory in which the file is going to land. You have shown us a direcctory listing of the file but not one for the directory in which it resides. If the files full path name is /path/to/file issue:

ls -ld /path/to

to find out about that. This directory should have a group membership of "csp" AND it should have a file mode of "2775" (or rwxrws-r-- in the ls -output, what counts is the "s" in the middle). This will make all created files in this directory to be owned by the same group as the directory owners group, hence, "csp".

I hope this helps.

bakunin

1 Like

On each server, could you show us the output from:-

uname -a
id mfpts
egrep "^mfpts:|^csp:|^csu:" /etc/group
ls -lin                                              # From within the correct directory

This may help us understand. Please wrap each block of output in CODE tags for clarity so it's easy to see which is a working server and which is a failing server.

Thanks, in advance,
Robin

As a matter of fact, none of the files shown has any contents. Are we looking in the right direction?

May be below should shed some lights
Can you please let me know why this is happening . If you see below the file I created with one login is having the user as the same id I logged. The other one it getting different user id than I logged in

(Lnx01:frn:/frn/log>)  touch test
(Lnx01:frn:/frn/log>) ll test
-rw-rw-r-- 1 frn ffr 0 Jan 17 10:31 test


(Lnx01:sfd:/sfd/log>) touch test
(Lnx01:sfd:/sfd/log>) ll test
-rw-rw-r-- 1 pproc ffs 0 Jan 17 10:35 test

This looks like duplicate user id numbers.

Can you show us the output from the following for each server?:-

egrep "^frn:|^sfd:|^pprn:" /etc/passwd

Thanks,
Robin

Did some more analysis and find that mftps is id that is creating the file. And the program running is from different id don't have access

In the not working place the file created is like below and the running program ffrprocess group is like

-rw-rw-r-- 1  mftp   mftp  0 Jan 17 00:14 117001.log
lnx001:fzaprocess>) groups fzaprocess 
fzaprocess :  csu
lnx001:fzaprocess>) groups  mftp  
mftp  : mftp  csu  cfr 

In the working place the file created is like.and the running program fzaprocess group is like

-rw-rw-r-- 1  mftp   cfr Jan 17 00:14 117001.log
lnx001:ffrprocess>) groups ffrprocess 
ffrprocess :  cfr
lnx001:ffrprocess>) groups  mftp  
mftp  : mftp  csu  cfr 

mftp is the login that is creating the file. But how.. for one process it is created with right group csu and other it is not creating with the mft even though the groups is set and added

---------- Post updated at 09:51 PM ---------- Previous update was at 09:32 PM ----------

 egrep "^frn:|^mftp:" /etc/passwd
mftp:x:628:23016:Transfer mftp:/opt/mftp:/bin/bash

 egrep "^sfd:|^mftp:" /etc/passwd
mftp:x:628:23016:Transfer mftp:/opt/mftp:/bin/bash

I already told you why - in fact i told you twice! Do the following two commands

ls -ld /frn/log
ls -ld /sfd/log

and post their output. It is most probably exactly what i told you in post #5 and post #10. You can of course choose to ignore my help further. Miracles have been described in all the holy books worldwide and one might just happen for you.

bakunin

1 Like

Hi bakunnin... Offcourse not ignoring you. Sorry missed it. Below is the result of the command

ls -ld /frn/log
drwxrwxr-x 3 mgreu frn 307200 Jan 18 09:43 /frn/log

ls -ld /sfd/log
drwxrwsr-x 3 mgreu sfd 2084864 Jan 18 19:20/sfd/log

Thanks in Advance

Now compare what you see below to what i wrote in post #10. I have marked the relevant part bold:

You need to get the other directory the same rights and group membership. Issue:

chown mgreu:sfd /frn/log
chmod 2775 /frn/log 

to change /frn/log . I hope this helps.

bakunin

1 Like

Hurrayyyy.... That worked thanks a ton for help