Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-14-2008, 03:28 PM   #1
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?

Old 02-14-2008, 03:32 PM   #2
Registered: Oct 2004
Location: Brooklyn
Distribution: Slackware 14.1, 14.2; Debian Buster; Kali
Posts: 320

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

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

it-etch:~# passwd test1
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Old 02-14-2008, 03:50 PM   #4
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 03:52 PM.
Old 02-14-2008, 05:31 PM   #5
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-14-2008, 11:56 PM   #6
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,850

Rep: Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585Reputation: 2585
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, 12:52 AM   #7
LQ 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


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 12:00 PM
ssh : is there a way to not have to enter the password? xutopia Linux - Security 2 04-28-2004 09:55 AM
can't enter password riverbed Linux - Newbie 2 01-30-2004 01:31 AM
Cant enter password lex0429 Mandriva 1 09-26-2003 10:33 AM
I canīt enter the password!! Andres_age Linux - General 3 11-11-2002 01:33 PM > Forums > Linux Forums > Linux - Newbie

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

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