Solved

User Accounts

Posted on 2002-05-16
9
243 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
  • 6
  • 3
9 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 250 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

808 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