How to change password using script

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















#OUTFILE=out.xml
prefix='EDSAD150'
password="asdf1234"
pass=$(perl -e 'print crypt($ARGV[0], "asdf1234")' $password)

for i in 01..02;do

usname=$prefix""$i
yes $pass | yppasswd $usname

done


I want to change the password of the users but when I run this script I have to give the server password every time because I am usingyppasswd command . But when I used passwd command the NIS files won't change.










share|improve this question
























  • What distribution are you using?

    – terdon
    Nov 9 '15 at 12:59















1















#OUTFILE=out.xml
prefix='EDSAD150'
password="asdf1234"
pass=$(perl -e 'print crypt($ARGV[0], "asdf1234")' $password)

for i in 01..02;do

usname=$prefix""$i
yes $pass | yppasswd $usname

done


I want to change the password of the users but when I run this script I have to give the server password every time because I am usingyppasswd command . But when I used passwd command the NIS files won't change.










share|improve this question
























  • What distribution are you using?

    – terdon
    Nov 9 '15 at 12:59













1












1








1








#OUTFILE=out.xml
prefix='EDSAD150'
password="asdf1234"
pass=$(perl -e 'print crypt($ARGV[0], "asdf1234")' $password)

for i in 01..02;do

usname=$prefix""$i
yes $pass | yppasswd $usname

done


I want to change the password of the users but when I run this script I have to give the server password every time because I am usingyppasswd command . But when I used passwd command the NIS files won't change.










share|improve this question
















#OUTFILE=out.xml
prefix='EDSAD150'
password="asdf1234"
pass=$(perl -e 'print crypt($ARGV[0], "asdf1234")' $password)

for i in 01..02;do

usname=$prefix""$i
yes $pass | yppasswd $usname

done


I want to change the password of the users but when I run this script I have to give the server password every time because I am usingyppasswd command . But when I used passwd command the NIS files won't change.







shell-script password nis






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 '15 at 10:32









terdon

133k33267446




133k33267446










asked Nov 9 '15 at 10:17









AnnAnn

85




85












  • What distribution are you using?

    – terdon
    Nov 9 '15 at 12:59

















  • What distribution are you using?

    – terdon
    Nov 9 '15 at 12:59
















What distribution are you using?

– terdon
Nov 9 '15 at 12:59





What distribution are you using?

– terdon
Nov 9 '15 at 12:59










1 Answer
1






active

oldest

votes


















0














Use chpasswd command to change the password using script



root@SHW:cat password.list
user1:pass1
user2:pass2
user3:pass3

root@SHW:chpasswd < password.list


Above example illustrate an example of given command to change password of users namely user1,user2,user3.






share|improve this answer

























  • the chpasswd is not Working $usname:$pass|chpasswd

    – Ann
    Nov 9 '15 at 12:33







  • 1





    @Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

    – terdon
    Nov 9 '15 at 12:35











  • changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

    – Ann
    Nov 9 '15 at 12:36












  • @Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

    – terdon
    Nov 9 '15 at 13:01











  • Have you tried above script with your existing username/password pair ?

    – SHW
    Nov 10 '15 at 6:24











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f241820%2fhow-to-change-password-using-script%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Use chpasswd command to change the password using script



root@SHW:cat password.list
user1:pass1
user2:pass2
user3:pass3

root@SHW:chpasswd < password.list


Above example illustrate an example of given command to change password of users namely user1,user2,user3.






share|improve this answer

























  • the chpasswd is not Working $usname:$pass|chpasswd

    – Ann
    Nov 9 '15 at 12:33







  • 1





    @Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

    – terdon
    Nov 9 '15 at 12:35











  • changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

    – Ann
    Nov 9 '15 at 12:36












  • @Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

    – terdon
    Nov 9 '15 at 13:01











  • Have you tried above script with your existing username/password pair ?

    – SHW
    Nov 10 '15 at 6:24















0














Use chpasswd command to change the password using script



root@SHW:cat password.list
user1:pass1
user2:pass2
user3:pass3

root@SHW:chpasswd < password.list


Above example illustrate an example of given command to change password of users namely user1,user2,user3.






share|improve this answer

























  • the chpasswd is not Working $usname:$pass|chpasswd

    – Ann
    Nov 9 '15 at 12:33







  • 1





    @Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

    – terdon
    Nov 9 '15 at 12:35











  • changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

    – Ann
    Nov 9 '15 at 12:36












  • @Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

    – terdon
    Nov 9 '15 at 13:01











  • Have you tried above script with your existing username/password pair ?

    – SHW
    Nov 10 '15 at 6:24













0












0








0







Use chpasswd command to change the password using script



root@SHW:cat password.list
user1:pass1
user2:pass2
user3:pass3

root@SHW:chpasswd < password.list


Above example illustrate an example of given command to change password of users namely user1,user2,user3.






share|improve this answer















Use chpasswd command to change the password using script



root@SHW:cat password.list
user1:pass1
user2:pass2
user3:pass3

root@SHW:chpasswd < password.list


Above example illustrate an example of given command to change password of users namely user1,user2,user3.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 '15 at 10:42

























answered Nov 9 '15 at 10:37









SHWSHW

8,34053971




8,34053971












  • the chpasswd is not Working $usname:$pass|chpasswd

    – Ann
    Nov 9 '15 at 12:33







  • 1





    @Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

    – terdon
    Nov 9 '15 at 12:35











  • changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

    – Ann
    Nov 9 '15 at 12:36












  • @Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

    – terdon
    Nov 9 '15 at 13:01











  • Have you tried above script with your existing username/password pair ?

    – SHW
    Nov 10 '15 at 6:24

















  • the chpasswd is not Working $usname:$pass|chpasswd

    – Ann
    Nov 9 '15 at 12:33







  • 1





    @Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

    – terdon
    Nov 9 '15 at 12:35











  • changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

    – Ann
    Nov 9 '15 at 12:36












  • @Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

    – terdon
    Nov 9 '15 at 13:01











  • Have you tried above script with your existing username/password pair ?

    – SHW
    Nov 10 '15 at 6:24
















the chpasswd is not Working $usname:$pass|chpasswd

– Ann
Nov 9 '15 at 12:33






the chpasswd is not Working $usname:$pass|chpasswd

– Ann
Nov 9 '15 at 12:33





1




1





@Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

– terdon
Nov 9 '15 at 12:35





@Ann "not working" doesn't tell us anything. You need to explain exactly how it fails. Is there an error message? No error but the password is unchanged? Some passwords changed but problems with the NIS?

– terdon
Nov 9 '15 at 12:35













changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

– Ann
Nov 9 '15 at 12:36






changepwUser1.sh: line 9: EDSAD15001:asbTyBDRLWRmQ: command not found changepwUser1.sh: line 9: EDSAD15002:asbTyBDRLWRmQ: command not found this the error I am getting the list of the user is generating along with password when the script is running

– Ann
Nov 9 '15 at 12:36














@Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

– terdon
Nov 9 '15 at 13:01





@Ann and what are you running? We don't have access to yours scripts, please edit your question and show us what you did exactly.

– terdon
Nov 9 '15 at 13:01













Have you tried above script with your existing username/password pair ?

– SHW
Nov 10 '15 at 6:24





Have you tried above script with your existing username/password pair ?

– SHW
Nov 10 '15 at 6:24

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f241820%2fhow-to-change-password-using-script%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay