nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Linux force user to set a password the first time they login

This is a discussion on Linux force user to set a password the first time they login within the Getting started tutorials forums, part of the Linux Getting Started category; A simple question - How do I force user set a password the first time they log in Linux server? ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-19-2006, 07:18 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 917
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default Linux force user to set a password the first time they login

A simple question - How do I force user set a password the first time they log in Linux server?

And here is the answer

Step # 1: Create the user called foo:
Code:
useradd foo
Step # 2: Set the password for user foo:
Code:
passwd foo
Step # 3: Now Lock the user account :
Code:
usermod -L foo
Step # 4: Next force expiration:
Code:
chage -d 0 foo
Step # 5: Finally Unlock the user account:
Code:
usermod -U foo
You can write a script for above procedure. Skip first 2 steps if user exists in system.
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-19-2006, 02:14 PM
Senior Member
User
 
Join Date: Dec 2006
Location: /B!n@ry
My distro: openSuSE 10.2
Posts: 127
Rep Power: 0
B!n@ry
Send a message via MSN to B!n@ry
Default

Nice start,

you can add these as default values for next added users, by defining them in the /etc/default/useradd file

I shall add more to this ASAP
__________________
LivE Free 0r DiE
L!nux rul3z aLL
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 07:43 PM
Junior Member
User
 
Join Date: Sep 2007
My distro: CentOS
Posts: 12
Rep Power: 0
vivekv is on a distinguished road
Default

Interested to get the bash code for this trick.

Regards
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Block Single User Login using root password sayan4u86 Networking, Firewalls and Security 0 09-28-2007 06:47 AM
How to change the login shell for Linux user chimu Getting started tutorials 0 01-26-2007 07:20 PM
HP UX user lock password, change password, password aging rockdalinux HP-UX 0 12-20-2006 02:36 PM
Changing password at first login. Linux sbhupathireddy Linux software 1 07-05-2006 12:29 PM
Login Without asking password sonaikar Linux software 1 02-20-2005 04:46 PM


All times are GMT +5.5. The time now is 08:34 AM.


Powered by vBulletin® Version 3.7.3 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36