LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 05-14-2015, 07:11 AM   #1
prasanth.bbnl
LQ Newbie
 
Registered: May 2015
Posts: 8

Rep: Reputation: Disabled
password changing in shell scripting


Hi,

i am using ubuntu 12.04 i working on scripting i want know how to change set of user passwords in shell scripting .
 
Old 05-14-2015, 07:30 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
Welcome to LQ!!!

Would like to mention that we would not write script for you. Let us know what you have prepared so far?

Did you have a look at passwd man page? If you want to set same password for a user let say testuser you can use:

Code:
echo "password" | passwd testuser --stdin
How to use it in script you have to figure out.

If you want to set random password then you might want to have a look at /dev/urandom + tr. The other tools like fold will depend on the number of characters you want in your password.
 
Old 05-14-2015, 08:51 AM   #3
ondoho
Senior Member
 
Registered: Dec 2013
Posts: 4,176

Rep: Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835Reputation: 835
Quote:
Originally Posted by T3RM1NVT0R View Post
Did you have a look at passwd man page?
just to clarify, open a terminal (Ctrl-Alt-T), type "man passwd".
 
Old 05-14-2015, 09:15 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 4,087
Blog Entries: 10

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
Welcome to LQ. Please post what you have so far for your script.
 
Old 05-15-2015, 12:40 AM   #5
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You may use 'chpasswd' for bulk changing.
 
Old 05-15-2015, 04:22 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Can make scripts with autoexpect in some cases too.
 
  


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
LXer: Shell Scripting Part I: Getting started with bash scripting LXer Syndicated Linux News 0 04-29-2015 09:03 AM
Shell Scripting to automate Process of SSH Trust (Password less Login ) RamTeja Programming 3 02-07-2014 06:58 AM
Shell Scripting - how to handle password management nsm09 Programming 5 12-31-2013 05:02 AM
shell scripting - samba password ravidangaych Linux - General 4 09-22-2009 05:57 AM


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