1832759 Members
2974 Online
110045 Solutions
New Discussion

File Owner

 
John Rector
New Member

File Owner

I know this is a silly question but how do you stop the system from using the decimal user ID (which is always 1000) and start using the login name when a user creates a file. I have looked, and looked..etc We changed machines (e9000) and went from 10.x to 11.0. HELP! Thank you in advance.

John Rector
Floralife
10 REPLIES 10
A. Clay Stephenson
Acclaimed Contributor

Re: File Owner

Hi:

First, grep "youruser" /etc/passwd as root; if that returns nothing then your user is not defined and you need to add him using SAM or useradd. Next, do an ls -l /etc/passwd; that file should be owned by root and have 644 permissions. rw-r--r--.
If that's ok, do a pwck and see if it returns any errors. Next, do a bdf and see if you have any full filesystems. Finally do a ps -e | grep pwgrd to see if the passwd caching daemon is running. If it is not, man pwgrd for instructions on starting it.

All of the above, assumes that this box is not an NIS client. If it is, do a ypcat passwd | grep "youruser". If that is ok, then you are simply missing the '+' entry in the passwd file and I'll bet the '+' entry in the group file is missing as well.

This should fix you, Clay
If it ain't broke, I can fix that.
John Rector
New Member

Re: File Owner

Hi:
Did all the above steps. User is defined.
permissions are rw-r--r--
pwck returned no errors
ps -e | grep pwgrd returned with an id.

But when a user writes out a new file the owner is still 1000 instead of the login name.

A. Clay Stephenson
Acclaimed Contributor

Re: File Owner

Ok, is there only one passwd entry with a uid of 1000? Also, is this a trusted machine and was the old box one? And again, I assume this is not an NIS box.
If it ain't broke, I can fix that.
Roger Baptiste
Honored Contributor

Re: File Owner

John,

What is the output of
""id"" , ""logname"" and ""whoami"" commands??

If these commands do not
return the same userid values,
there is definitely a problem
with your /etc/passwd file.

Also, does the problem occur
with only one specific user?
How about the "'root"" user?

I understand this is not a
NIS system.

-raj
Take it easy.
John Rector
New Member

Re: File Owner

OK Here is the scoop. The LOGNAME,ID and whoami all come out the user name. The file ownership problem occurs with all users EXCEPT root. All files created by any user EXCEPT root gets a file owner of 1000. and there is UID of 1000 in the /etc/passwd file. This machine came preloaded and configured with HP-UX 11.0. I do I tell if this not a NIS ssytem? AGain thanks for the help so far. It is much appreciated!!!
John Rector
New Member

Re: File Owner

That should have read there is NO user with a UID of 1000
Roger Baptiste
Honored Contributor

Re: File Owner

John,

All leads point to the
/etc/password file having
an error.

To check this quickly:
(if you are allowed the
flexibility )

*** #cp /etc/passwd /etc/passwd.OLD

#cp /usr/newconfig/etc/passwd /etc/passwd

#useradd a test user (through SAM or
command line)

#login as the test user and
create file.
****

otherwise,
If the file
is not huge, can you make
sure the password file has
all the fields right for
all the users? I had a similar problem and it turned
out to be a problem in the
password file.
pwck is not always 100% guaranteed to catch errors.

All the above applies to
/etc/group. Also, is
this a trusted system?

-raj
Take it easy.
T G Manikandan
Honored Contributor

Re: File Owner

Hello,
Check the permissions of the /etc/passwd file.
The permissions should be r--r--r-- or rw-r--r--.
If you change the permissions of the /etc/passwd file to r--------,you have this problem.
Another thing is check whether you have the user in the /etc/passwd file.check whether is user is available on the system.
Darrell Allen
Honored Contributor

Re: File Owner

Grasping at a straw: Is the problem regardless of how the files are created (touch, vi, cp, output redirection, etc) or is it when files are being created by a specific application?

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Frank Slootweg
Honored Contributor

Re: File Owner

I think you are confusing the User ID (UID) with the Group ID (GID). I think the GID is numeric, but the UID is normal. I.e. in the "ll" output you will first see a name (UID) (in the third column) and then a number (GID).

I think this because you wrote "All files created by any user EXCEPT root gets a file owner of 1000" which is impossible (or at least highly unlikely).

So all references to /etc/passwd should be replaced by /etc/group, i.e. I think that in /etc/group, there is no *group* with the number 1000. If so, just add that group (see the other entries in /etc/group for examples).