LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 07-13-2010, 01:51 PM   #1
Feetloaf
LQ Newbie
 
Registered: Apr 2010
Distribution: Slax (incl. BT), Ubuntu, RHEL, Deb, CentOS
Posts: 3

Rep: Reputation: 0
Ubuntu 9.04, chpasswd & /usr/sbin/nologin


Hi, all,

Built a new system, imported my list of users and updated their passwords with chpasswd easily enough, but the email-only users are getting their passwords rejected. If I use passwd on the console to set the same password, the account starts working. What do you think would cause this, and is there a way to fix it without re-writing that script I keep losing that uses passwd?

Thx,
Feetloaf
 
Old 07-15-2010, 07:30 AM   #2
rdgreenlaw
Member
 
Registered: May 2007
Distribution: Ubuntu 14.04 LTS
Posts: 59

Rep: Reputation: 16
Can you post the script that sets the passwords? Replace the user names and passwords with dummy values to protect your system integrity.
 
Old 07-15-2010, 10:42 AM   #3
Feetloaf
LQ Newbie
 
Registered: Apr 2010
Distribution: Slax (incl. BT), Ubuntu, RHEL, Deb, CentOS
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you for replying.

I first used a simple command (while sudo -i):

Code:
chpasswd < userlist.txt
Where the userlist.txt contents are like:

Code:
user1:password1
user2:password2
which returned no errors, and I could see that the password field of /etc/shadow was changed.

I also believe chpasswd is defaulting to the right enc. type (SHA512), because I can use passwd on a user, and then subsequently change that users' password with chpasswd and the user can check email using the newest password.

Last edited by Feetloaf; 07-15-2010 at 10:46 AM. Reason: remove accidental emoticons...
 
Old 07-15-2010, 11:45 AM   #4
rdgreenlaw
Member
 
Registered: May 2007
Distribution: Ubuntu 14.04 LTS
Posts: 59

Rep: Reputation: 16
You should see error messages if chpasswd is not able to assign the chosen password (assuming you are executing this command from root.) Assuming that you are not receiving any error messages then the problem must be located within your email program.

Since passwd seems to fix the problem you can try the following. It should work to resolve your issues.

Create a script that has one line for each user
Code:
passwd user1 < pwfix
passwd user2 < pwfix
...
passwd usern < pwfix
create a file named pwfix that contains the following 2 lines
Code:
thisisanewpassword
thisisanewpassword
execute the script created to set every users password to thisisanewpassword

then run the chpasswd command to change every user to their real password.


To create the passwd script file file you could use

Code:
awk -F ":" '{print "passwd " $1 " < pwfix"}' < userlist.txt > runthisfirst.sh
chmod 766 runthisfirst.sh
sh runthisfirst.sh
chpasswd < userlist.txt
You will still need the second file mentioned above that has the temporary password defined in it.

Note: Check the contents of runthisfirst.sh to check it's contents. Any typo on the awk line will prevent it from having the correct output.
 
Old 07-15-2010, 07:20 PM   #5
Feetloaf
LQ Newbie
 
Registered: Apr 2010
Distribution: Slax (incl. BT), Ubuntu, RHEL, Deb, CentOS
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for the passwd tips; that's pretty similar to what I'd been doing in the past. But I was after chpasswd because it seemed more elegant, and would let me export a file directly from a spreadsheet or db and let me pump it into /etc/passwd & /etc/shadow with a one-liner command.

The solution turned out to be the "newusers" command. It wants the input file to be in the format of /etc/passwd, which isn't quite as simple as I'd like, but using, say Ooo Base, it would be easy enough to generate a large list of users with randomly generated passwords and output a file that lets me use a one-liner.
 
  


Reply


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
/usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_atomic_x dasoberdick Slackware 14 12-18-2010 04:32 AM
What is difference between /usr/sbin/ps & /usr/ucb/ps command rajaniyer123 Solaris / OpenSolaris 6 07-05-2007 12:53 PM
/bin/false vs /sbin/nologin - difference? ziggie216 Linux - General 1 12-22-2005 02:59 AM
sendmail adduser sbin/nologin using php mhatre kedar Linux - Networking 0 04-18-2005 01:12 AM
/sbin/nologin tyccea Red Hat 2 10-22-2003 07:56 AM


All times are GMT -5. The time now is 11:05 AM.

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