LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 08-05-2008, 04:32 AM   #1
Tim356
LQ Newbie
 
Registered: May 2006
Distribution: RHEL 5.2
Posts: 27

Rep: Reputation: 15
Manually adding users and the shadow file...


Adding a user manually to the /etc/passwd file, by tacking on this line:

Code:
testuser:x:500:500:Test User:/home/testuser:/bin/bash
then saving, I get this:
Code:
[root@localhost ~]# vipw
You are using shadow passwords on this system.
Would you like to edit /etc/shadow now [y/n]?
Now, if I enter y, I get taken to the shadow file, obviously. What should I enter here?? If I just enter a random password string such as this line:
Code:
testuser:asdfweusljasdfunwdfsasasf
First I have to force it to write to a readonly file, then when I do the following, I get an error.
Code:
[root@localhost ~]# passwd testuser
Changing password for user testuser.
passwd: Authentication token manipulation error
How am I actually meant to do this? I know I can do this with useradd and through x, but how can I manually do it?
 
Old 08-05-2008, 05:30 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Instead of editing the shadow file you can use the pwconv utility.
Code:
pwconv
That utility will reconcile all of the user accounts listed in the passwd file with the shadow file entries. Then you can use the passwd utility to create a passwd for the new user account.
 
Old 08-05-2008, 05:46 AM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Use the useradd program instead to add a new user. That's what its there for.
 
Old 08-05-2008, 06:00 AM   #4
Tim356
LQ Newbie
 
Registered: May 2006
Distribution: RHEL 5.2
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by stress_junkie View Post
Instead of editing the shadow file you can use the pwconv utility.
Code:
pwconv
That utility will reconcile all of the user accounts listed in the passwd file with the shadow file entries. Then you can use the passwd utility to create a passwd for the new user account.
Cheers! That did the trick. Thanks for helping.


jschiwal: you might notice in my first post that I mentioned this:
Quote:
I know I can do this with useradd and through x, but...
 
  


Reply

Tags
manually, user


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding users from file using PERL? happy13 Programming 3 12-22-2007 07:26 PM
manually adding rules w/ firestarter installed jonfa Linux - Security 1 03-11-2007 12:34 PM
/etc/shadow and local users deepclutch Linux - Software 2 12-22-2005 10:29 PM
Users unable to use crontab unless in /etc/shadow atnan Linux - General 2 05-03-2005 11:43 PM
Help on Administrative Utility (adding users & data from input file) NightWolf_NZ Linux - Software 0 09-10-2003 08:43 PM


All times are GMT -5. The time now is 07:16 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration