Solved

User Accounts

Posted on 2002-05-16
9
237 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to install Ubuntu 16 in DELL venue 8 pro 20 149
linux redhat 7.2 10 72
curl SSL certificate unable to get local issuer certificate 15 68
error log using ftp 7 41
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

773 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