LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-14-2008, 04:28 PM   #1
ssy68
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Rep: Reputation: 0
command to skip enter current password


I'm in root, and added a user test1 by useradd command.
Now I want to do something like 'su - test1 -c passwd' to change the password for test1 as user test1.

The prompt will be:
Changing password for test1
(current) UNIX password:

But the test1 doesn't have a current password. Is there a command to let me su to be test1 from root but it will not prompt for the current password, and just let me type the new password?

Thanks.
 
Old 02-14-2008, 04:32 PM   #2
apolinsky
Member
 
Registered: Oct 2004
Location: Brooklyn
Distribution: Slackware 13.1,12.1,12.2; Debian Sqeeze; Centos 5,6
Posts: 254

Rep: Reputation: 34
If you are root, you could just say passwd test1 to add a password.
 
Old 02-14-2008, 04:33 PM   #3
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
how about skipping the su step and just changing the password.


Code:
it-etch:~# passwd test1
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
 
Old 02-14-2008, 04:50 PM   #4
ssy68
LQ Newbie
 
Registered: Jan 2008
Posts: 10

Original Poster
Rep: Reputation: 0
I want to change passwd as test1 not as root. Because I want test1 password to apply pam restirctions. If I don't su, pam restrictions will not work.

Last edited by ssy68; 02-14-2008 at 04:52 PM.
 
Old 02-14-2008, 06:31 PM   #5
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
What about changing the password via "# passwd test1" and -then- su'ing over and changing it?
 
Old 02-15-2008, 12:56 AM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Try writing a short Expect script and call that
su - test1 -c myscript
Expect is designed to automate manual stuff like the paswd cmd
 
Old 02-15-2008, 01:52 AM   #7
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
ssy, if you change test12's password, you change tests1's password - it doesn't matter who does it (onlu root or test1 can probably).

Take up up the suggestion to either be root and

passwd test1

or as another user sudo passwd test1

PAM will use test1's password just fine
 
  


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
why does the terminal ask for a password and not let me enter on ??? KRossKoWolf Linux - Newbie 1 06-26-2006 01:00 PM
ssh : is there a way to not have to enter the password? xutopia Linux - Security 2 04-28-2004 10:55 AM
can't enter password riverbed Linux - Newbie 2 01-30-2004 02:31 AM
Cant enter password lex0429 Mandriva 1 09-26-2003 11:33 AM
I canīt enter the password!! Andres_age Linux - General 3 11-11-2002 02:33 PM


All times are GMT -5. The time now is 03:11 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