Solved

User Accounts

Posted on 2002-05-16
9
226 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
 

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now