Operating System - HP-UX
1825803 Members
2700 Online
109687 Solutions
New Discussion

Re: querry about while creating users

 
shan_7
Advisor

querry about while creating users

Hi Experts,

See while creating the users we are adding an entry for home directory. So now after creating the user with their home any area other than /home/xxx. Now how the new users taking the ownership of some others home dir & files /home/xxx/.exrc
/../../.dt
/../../.csrc etc...
How its happening..

Explian me in deatils .

Thanks in advance.

Shankar



9 REPLIES 9
Victor BERRIDGE
Honored Contributor

Re: querry about while creating users

The easiest way to explain is:
To create an account you:
1) add an entry specifying its home directoy and shell to use in the /etc/passwd file
2) copy the /etc/skel/.[celp]* with cp -p to the new home directory
3) chown -R uid:gid home_directory.

All thes is done by SAM when you use it
.dt etc.. is put at the first X connection

All the best
Victor
T G Manikandan
Honored Contributor

Re: querry about while creating users

I did not understand your question.Pls summarize in steps!
Bharat Katkar
Honored Contributor

Re: querry about while creating users

Hi Shankar,
I tried to understand the question and this is what i would like to share with you.

1. When users are created with home directory i.e. /home/user1 then he has all rights by defualt on that directory.
2. There some .(dot) files in the home directory which are used to set the environment of that User. e.g.
.dt is profile for X windows session
.cshrc set the C Shell environment
.exrc sets VI settings etc. etc.
3. Now if user belongs to group "grp", then all files and directory that belong to this "grp" are allowed to be used by this user as per the group permissions they have.

Don't know if this what you were looking for.
Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: querry about while creating users

Hi shankar ,
I reread the question and the first reply ( he has almost judged your question) and now i conclude " How the DOT files are getting created in the User's Home Directory and how come the User is owner of those files? " must be your question ( Correct me If i am wrong )

Ans.: When you create user with -k option with useradd command it copies this template files from /etc/skel directory with user as a owner into his home directory. This template files allows user to customize his environment.

Regards,


You need to know a lot to actually know how little you know
shan_7
Advisor

Re: querry about while creating users

ok.
for example
* i am creating one user named user1 with home directory in /home/user1.
* So this home dir of user1 will have the comman set of files with full rights {rw}like .profile,.sh_history,.csrc,.exrc..& so on.
* Now user1 is the owner of that{/home/user1} directory. group of the dir will be which we are giving while creating user. say for ex: users.
*up to now clear.

* We creating some other users with home dir /home/user2.same repeat last setps.

NOW, My Q is how this user2 can be owner of the user1 home directory & inside the files.
Note : all users were created by SAM only.

When I saw the user1 home dir ownership got changed. HOW ???

Shankar
Naveej.K.A
Honored Contributor

Re: querry about while creating users

hi shankar,

if user1 and user2 belongs to the same group and if the permission on the directory, /home/user1 is group writable, group readalbe and group executable both user1 and user2 has the same rights on /home/user1... hope u understand it now???

so whether user1 is the owner or user2 is the owner, it doesn't make much difference. It all matters in the group permissions.

regds
Naveej
practice makes a man perfect!!!
Bill Hassell
Honored Contributor

Re: querry about while creating users

Verify the permissions of /home and the user's directories. It MUST be 755 or drwxr-xr-x. Way too many sysadmins try to fix problems by change things with chmod 777, or they have forgotten the most important change that *EVERY* HP-UX system must have: umask 022 must be added to /etc/profile and /etc/csh.login. If directories have 777 permissions, anyone on the system can trash both the directory as well as any file in that directory. You don't need any ownership of those directories to do that.

Now if newly-created user2 now shows as the owner of user1's files and directories, you've got a much bigger problem. Start with /etc/passwd and verify it's integrity:

pwck
logins -d

There should be no warnings from either command. If logins -d shows user1 and user2 have the same UID, something is seriously wrong with your SAM installation, *OR* /home is NOT a local directory (ie, NFS). If /home is NFS (or part of a NAS system), you'll need to do some extra work to ensure new users have proper ownerships. The reason is that the NFS server knows nothing about your users without special steps being taken.


Bill Hassell, sysadmin
Jan Sladky
Trusted Contributor

Re: querry about while creating users

Hi,

could you post output from ll commands of all concerned files and /etc/hosts /etc/apsswd and /etc/groups ?

br Jan
GSM, Intelligent Networks, UNIX
R. Allan Hicks
Trusted Contributor

Re: querry about while creating users

I'm having a really rough time understanding your question. My apologies in advance if I'm totally off the mark.

Is there _any_ chance that you are re-using the user id?

SAM assigns a user id at the time the user is created. However, if you choose you can override that id.

For example you create user1 and SAM gives him user id 101.

Then you create user2 and SAM gives you user id 102.

But you decide that you really want user2 to have id 101, you can change user2 to have the 101.

The directories ownership is determined by the user id. So whichever user has say 101, then any directories owned by 101 will have that user's name on them.

The more common form of the problem is to let SAM assign ids for users on different systems and at some point in time, you take user2 from system 2 and restore his files to system 1. If user1 has the same id as user2, then as if by magic, user1 will own user2's files.

It's a simple mistake, but common, but if you are new to UNIX it's easy to make.

Check your /etc/passwd file for duplicate user ids.

-Good Luck
"Only he who attempts the absurd is capable of achieving the impossible