LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-10-2014, 05:06 AM   #1
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 36

Rep: Reputation: Disabled
Force change password for users in linux, without terminating the shell session


Hello,

I am using CentOS 6.5 64 bit OS. I used chage command to force users to change their password on next login, for ex -

Code:
chage -d 0 admin
This forced the user to change the password, but terminated the session & the user was required to re-login with the new password.

Is there any way, any other command to avoid the session termination at the end of a successful password change?

Another thing I noted was that this command did not work for root user. The root user was not forced to change password. Anything I am missing here?

Thanks
Bhushan Pathak
 
Old 07-10-2014, 06:23 AM   #2
looop
Member
 
Registered: Oct 2011
Location: Denmark
Distribution: Slackware - Mac OS X Lion - RedHat 6 - MS Win 2003 server - A/UX - FreeBSD - FreeNAS - pfsense
Posts: 75

Rep: Reputation: Disabled
To my knowledge you can't force GOD (root) to do anything, including changing the password.
 
1 members found this post helpful.
Old 07-10-2014, 07:12 AM   #3
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: Disabled
ok, what about the session termination on successful password change?
 
Old 07-10-2014, 07:16 AM   #4
looop
Member
 
Registered: Oct 2011
Location: Denmark
Distribution: Slackware - Mac OS X Lion - RedHat 6 - MS Win 2003 server - A/UX - FreeBSD - FreeNAS - pfsense
Posts: 75

Rep: Reputation: Disabled
It is a million years since I did IDM and User mangement. So my memory is a little rusty at this subject, so instead of getting your hopes up.
I hope another person will give you an answer to that question
 
Old 07-10-2014, 07:18 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
I do not really understand: what do you mean by session termination? Kicking of the root user means reboot. If you want to change the password of root just do that.
 
Old 07-10-2014, 07:26 AM   #6
looop
Member
 
Registered: Oct 2011
Location: Denmark
Distribution: Slackware - Mac OS X Lion - RedHat 6 - MS Win 2003 server - A/UX - FreeBSD - FreeNAS - pfsense
Posts: 75

Rep: Reputation: Disabled
@pan64 - He/she wants to be able to change the password of a normal user, without terminating the users sessions. Then he asked if it was possible to force the root to change password.
Two different questions
 
Old 07-10-2014, 07:37 AM   #7
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
see man passwd:
Code:
      -e, --expire
           Immediately expire an account's password. This in effect can force a user to change his/her password at the user's next
           login.
only root can use it. but actually there is no meaning to force myself (root as root) to change password
 
1 members found this post helpful.
Old 07-11-2014, 03:16 AM   #8
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: Disabled
Anyone about the session termination on successful password change - how to avoid that?

Thanks
Bhushan Pathak
 
Old 07-11-2014, 03:49 AM   #9
looop
Member
 
Registered: Oct 2011
Location: Denmark
Distribution: Slackware - Mac OS X Lion - RedHat 6 - MS Win 2003 server - A/UX - FreeBSD - FreeNAS - pfsense
Posts: 75

Rep: Reputation: Disabled
@BhushanPathak as “pan64 writes see the man page, so what you do as root is:

Code:
passwd -e #username#
So the next time he/she tries to logon to the system they have to change the password, this does not kill the current session
 
Old 07-11-2014, 04:52 AM   #10
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: Disabled
I tried that out. I executed the following as root -

Code:
# passwd -e admin
Expiring password for user admin.
passwd: Success
I then opened a new SSH session & logged in as admin user, but I was not forced to change my password.
 
Old 07-11-2014, 04:55 AM   #11
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
how did you try that? With passwordless login?
 
Old 07-11-2014, 04:59 AM   #12
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: Disabled
Nope, I provided username & old password for admin user, but was not prompted for changing the password, like in the case when chage command is used.

Last edited by BhushanPathak; 07-11-2014 at 05:00 AM. Reason: updated the reply with details
 
Old 07-11-2014, 05:01 AM   #13
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,110

Rep: Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268Reputation: 2268
what is the user id of admin?
what is in /etc/nsswitch.conf?
 
1 members found this post helpful.
Old 07-11-2014, 05:10 AM   #14
BhushanPathak
Member
 
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 36

Original Poster
Rep: Reputation: Disabled
Following are the details -
Code:
# id admin
uid=783(admin) gid=783(admin) groups=783(admin)


# cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
#       nisplus                 Use NIS+ (NIS version 3)
#       nis                     Use NIS (NIS version 2), also called YP
#       dns                     Use DNS (Domain Name Service)
#       files                   Use the local files
#       db                      Use the local database (.db) files
#       compat                  Use NIS on compat mode
#       hesiod                  Use Hesiod for user lookups
#       [NOTFOUND=return]       Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files
shadow:     files
group:      files

#hosts:     db files nisplus nis dns
hosts:      files dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files

netgroup:   nisplus

publickey:  nisplus

automount:  files nisplus
aliases:    files nisplus
 
  


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
Linux drops session after asking me to change my password JCW1969 Linux - Newbie 7 08-28-2013 11:47 PM
How to force user to change password after expiration in Linux? ssy68 Linux - Newbie 4 06-30-2011 03:54 PM
[SOLVED] REDHAT missing functionality - force user to change password on login machielr Linux - Security 5 03-17-2011 03:36 PM
How to force a user to change their NIS password at logon? synthol6 AIX 1 08-17-2010 09:47 PM
RH 5.2 - First login: Force root password change le_forban Linux - Enterprise 2 01-20-2009 08:24 AM


All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration