?
Solved

User Accounts

Posted on 2002-05-16
9
Medium Priority
?
259 Views
Last Modified: 2013-12-15
I have tried to add a user account by editing the /etc/passwd file these are the steps that I have taken:
1)This is the line for the new user:joe::503:503:joe:/home/joe:/bin/bash
2)made home dir for joe
3)change owner of dir an group of dir to joe
4)made group for joe 503 is gid
5)change passwd for joe

where I am having trouble is copy the default init. files from /etc/skel t ohis home dir and when I try to login recv login incorrect.I am using RHv6 2.2 kernel,any help greatly appreciated.
0
Comment
Question by:dezmond
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 1000 total points
ID: 7014476
Is your system using a shadow password file? If so then your entry in /etc/passwd is incorrect and needs an 'x' in the second field and you have to edit the shadow file to add the users there also. So the steps would be:

1) edit /etc/group and add the user's group
2) edit /etc/passwd
3) make /etc/shadow writable and edit, changing mode back to ro when done
4) set a password
5) create the home dir and set perms with 'chmod 750 /home/user'
6) copy skel files (cp /etc/skel/.??* /home/some-user)
7) set ownership with 'chown user:user-grp /home/user'

Of course a far easier method would be to just do:

# useradd some-user
# passwd some-user

See man useradd for more information.
0
 

Author Comment

by:dezmond
ID: 7014552
How do I tell if I'm using a shadow passwd file and how do I make it writeable, use the chmod command? Also when I copy the /etc/skel/.??* can you explain the .??* what am I copying?
0
 

Author Comment

by:dezmond
ID: 7014558
I've used the useradd,adduser and the linuxconf,but I'm really trying to learn all admin tools.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dezmond
ID: 7014568
I've used the useradd,adduser and the linuxconf,but I'm really trying to learn all admin tools.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 7014594
To edit the shadow file do:

# chmod +w /etc/shadow
# vi /etc/shadow
# chmod -w /etc/shadow

You can tell, by simple inspection of the passwd file, if the system is using a shadow file. When using a shadow file there are no encrypted passwords in the second field of /etc/passwd. Instead there'll be a placeholder, normally x in that field.

By default, cp will not copy any "dot" files, those like .xinitrc, .bashrc, etc. And ordinarily you don't see them with ls. If you do a simple 'ls /etc/skel' you won't see anything, nor will 'cp /etc/skel/* /home/user' copy anything. However, if you do 'ls -a /etc/skel' you can see the files. You wouldn't want to try to 'cp /etc/skel/.* /home/user' because there are two special dot files in each dir (. & ..) that you don't want to copy. Using 'cp /etc/skel/.??* /home/user' says to only copy files that begin with . and are followed by two characters (??) that are then followed by zero or more characters (*). That means that ., .. or .a wouldn't be copied, but .aa, .aaa, .aaaa, etc would be.
0
 

Author Comment

by:dezmond
ID: 7014736
when I add user to the /etc/passwd file and run passwd command the x is palced in passwd file.  How do I know if the home dir is etup correctly because when I try to log in recv login incorrect am I missing something?
0
 

Author Comment

by:dezmond
ID: 7014743
so in order to add user thru passwd file i also need to add to the shadow file? If that is the case do I stil need to run the passwd command?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 7015098
Yes, there is a line for each user in the password and shadow file. I don't know what would happen with the passwd command if the line was missing from the shadow file, but if the system is configured to use a shadow file and the user's record isn't there you will certainly get a "login incorrect" error.

If the home dir isn't set up correctly and you do a text login, like on the console, via ssh, telnet, etc., you'll be able to login but will get an "no home dir" error. That's assuming that passwd, shadow, and group are correct.
0
 

Author Comment

by:dezmond
ID: 7016028
Thanks I got it working now! That was the problem the shadow file didn't have an entry.
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question