How to set user passwords using passwd without a prompt?Bash script to automaticly change a given user's passwordHow to change password using usermod?How to change passwords in bulk? Ubuntu 16.04Problem running Linux Bash Script and adding password same as usernameSet another password automatically every day for a user sessionHow to setup a list of users using bashWhy am I not asked for password at startup?How to login into Ubuntu after an upgrade to 12.04?chpasswd silently fails to do anything; is there a substitute?How to configure pkexec to not ask for password?Default sudo settings did not require passwordChange expired password via sshUbuntu Keyring on Library Public ComputersCannot change password using passwdOS “Forgets” User PasswordsBash script to automaticly change a given user's password
Hero deduces identity of a killer
Does malloc reserve more space while allocating memory?
How does a computer interpret real numbers?
Recommended PCB layout understanding - ADM2572 datasheet
How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?
Add big quotation marks inside my colorbox
Does IPv6 have similar concept of network mask?
What is the evidence for the "tyranny of the majority problem" in a direct democracy context?
Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?
It grows, but water kills it
Multiplicative persistence
Extract more than nine arguments that occur periodically in a sentence to use in macros in order to typset
How does the math work for Perception checks?
Why is this estimator biased?
Is there a way to get `mathscr' with lower case letters in pdfLaTeX?
Are Captain Marvel's powers affected by Thanos' actions in Infinity War
Why can Carol Danvers change her suit colours in the first place?
How could a planet have erratic days?
What are some good ways to treat frozen vegetables such that they behave like fresh vegetables when stir frying them?
What happens if you are holding an Iron Flask with a demon inside and walk into an Antimagic Field?
Mixing PEX brands
Invalid date error by date command
What is going on with 'gets(stdin)' on the site coderbyte?
Has any country ever had 2 former presidents in jail simultaneously?
How to set user passwords using passwd without a prompt?
Bash script to automaticly change a given user's passwordHow to change password using usermod?How to change passwords in bulk? Ubuntu 16.04Problem running Linux Bash Script and adding password same as usernameSet another password automatically every day for a user sessionHow to setup a list of users using bashWhy am I not asked for password at startup?How to login into Ubuntu after an upgrade to 12.04?chpasswd silently fails to do anything; is there a substitute?How to configure pkexec to not ask for password?Default sudo settings did not require passwordChange expired password via sshUbuntu Keyring on Library Public ComputersCannot change password using passwdOS “Forgets” User PasswordsBash script to automaticly change a given user's password
I am writing a script to add a large amount of users to a system. Part of this involves setting default passwords for each user. How can I set users' passwords without it prompting me for the password up front?
Unfortunately passwd doesn't seem to take an argument stating the new password to set. I'm using Ubuntu 11.10.
password
add a comment |
I am writing a script to add a large amount of users to a system. Part of this involves setting default passwords for each user. How can I set users' passwords without it prompting me for the password up front?
Unfortunately passwd doesn't seem to take an argument stating the new password to set. I'm using Ubuntu 11.10.
password
add a comment |
I am writing a script to add a large amount of users to a system. Part of this involves setting default passwords for each user. How can I set users' passwords without it prompting me for the password up front?
Unfortunately passwd doesn't seem to take an argument stating the new password to set. I'm using Ubuntu 11.10.
password
I am writing a script to add a large amount of users to a system. Part of this involves setting default passwords for each user. How can I set users' passwords without it prompting me for the password up front?
Unfortunately passwd doesn't seem to take an argument stating the new password to set. I'm using Ubuntu 11.10.
password
password
edited Apr 1 '16 at 4:09
muru
1
1
asked Nov 18 '11 at 11:06
Jake PetroulesJake Petroules
183116
183116
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Try usermod:
usermod --password PASSWORD USERNAME
The only thing is this needs a pre-encrypted password string which you'd have to generate first.
1
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
13
You can also use openssl to generate the encrypted password. For example:usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
add a comment |
You should look at the chpasswd
command (if available in your linux flavor):
echo 'userid:newpasswd' | chpasswd
Or, you can cat a file listing userid:passwd for each account on a separate line.
That's it.
this worked for me inDockerfile
– Vishrant
Jan 27 at 18:58
add a comment |
Inspired by Eric Smith's idea, combining openssl passwd
and usermod -p
command worked. Generate hashed value of password along with salt value.
$ openssl passwd -1 -salt 5RPVAd clear-text-passwd43
$1$5RPVAd$vgsoSANybLDepv2ETcUH7.
Then, copy the encrypted string to usermod. Make sure to wrap it with single quote.
$ usermod -p '$1$5RPVAd$vgsoSANybLDepv2ETcUH7.' root
Check it out in shadow file.
$ grep root /etc/shadow
root:$1$5RPVAd$vgsoSANybLDepv2ETcUH7.:17774:0:99999:7:::
add a comment |
You should use password aging, and set the users so that they must change their password on the first login. See this article.
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f80444%2fhow-to-set-user-passwords-using-passwd-without-a-prompt%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try usermod:
usermod --password PASSWORD USERNAME
The only thing is this needs a pre-encrypted password string which you'd have to generate first.
1
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
13
You can also use openssl to generate the encrypted password. For example:usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
add a comment |
Try usermod:
usermod --password PASSWORD USERNAME
The only thing is this needs a pre-encrypted password string which you'd have to generate first.
1
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
13
You can also use openssl to generate the encrypted password. For example:usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
add a comment |
Try usermod:
usermod --password PASSWORD USERNAME
The only thing is this needs a pre-encrypted password string which you'd have to generate first.
Try usermod:
usermod --password PASSWORD USERNAME
The only thing is this needs a pre-encrypted password string which you'd have to generate first.
answered Nov 18 '11 at 11:18
CaesiumCaesium
11.6k33147
11.6k33147
1
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
13
You can also use openssl to generate the encrypted password. For example:usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
add a comment |
1
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
13
You can also use openssl to generate the encrypted password. For example:usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
1
1
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
...which I can generate using mkpasswd. Excellent, thanks!
– Jake Petroules
Nov 18 '11 at 11:27
13
13
You can also use openssl to generate the encrypted password. For example:
usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
You can also use openssl to generate the encrypted password. For example:
usermod --password $(echo my_new_password | openssl passwd -1 -stdin) USERNAME
– Eric Smith
Jan 16 '15 at 19:34
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:
usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
Three years too late. I couldn't make the answer @EricSmith, but I did discover a simpler version of the command that did work:
usermod --password $(openssl passwd -1 password) username
– BoCoKeith
Nov 29 '18 at 15:36
add a comment |
You should look at the chpasswd
command (if available in your linux flavor):
echo 'userid:newpasswd' | chpasswd
Or, you can cat a file listing userid:passwd for each account on a separate line.
That's it.
this worked for me inDockerfile
– Vishrant
Jan 27 at 18:58
add a comment |
You should look at the chpasswd
command (if available in your linux flavor):
echo 'userid:newpasswd' | chpasswd
Or, you can cat a file listing userid:passwd for each account on a separate line.
That's it.
this worked for me inDockerfile
– Vishrant
Jan 27 at 18:58
add a comment |
You should look at the chpasswd
command (if available in your linux flavor):
echo 'userid:newpasswd' | chpasswd
Or, you can cat a file listing userid:passwd for each account on a separate line.
That's it.
You should look at the chpasswd
command (if available in your linux flavor):
echo 'userid:newpasswd' | chpasswd
Or, you can cat a file listing userid:passwd for each account on a separate line.
That's it.
edited Jan 2 '14 at 21:22
Eric Carvalho
42.2k17115147
42.2k17115147
answered Jan 2 '14 at 21:02
AllanAllan
9111
9111
this worked for me inDockerfile
– Vishrant
Jan 27 at 18:58
add a comment |
this worked for me inDockerfile
– Vishrant
Jan 27 at 18:58
this worked for me in
Dockerfile
– Vishrant
Jan 27 at 18:58
this worked for me in
Dockerfile
– Vishrant
Jan 27 at 18:58
add a comment |
Inspired by Eric Smith's idea, combining openssl passwd
and usermod -p
command worked. Generate hashed value of password along with salt value.
$ openssl passwd -1 -salt 5RPVAd clear-text-passwd43
$1$5RPVAd$vgsoSANybLDepv2ETcUH7.
Then, copy the encrypted string to usermod. Make sure to wrap it with single quote.
$ usermod -p '$1$5RPVAd$vgsoSANybLDepv2ETcUH7.' root
Check it out in shadow file.
$ grep root /etc/shadow
root:$1$5RPVAd$vgsoSANybLDepv2ETcUH7.:17774:0:99999:7:::
add a comment |
Inspired by Eric Smith's idea, combining openssl passwd
and usermod -p
command worked. Generate hashed value of password along with salt value.
$ openssl passwd -1 -salt 5RPVAd clear-text-passwd43
$1$5RPVAd$vgsoSANybLDepv2ETcUH7.
Then, copy the encrypted string to usermod. Make sure to wrap it with single quote.
$ usermod -p '$1$5RPVAd$vgsoSANybLDepv2ETcUH7.' root
Check it out in shadow file.
$ grep root /etc/shadow
root:$1$5RPVAd$vgsoSANybLDepv2ETcUH7.:17774:0:99999:7:::
add a comment |
Inspired by Eric Smith's idea, combining openssl passwd
and usermod -p
command worked. Generate hashed value of password along with salt value.
$ openssl passwd -1 -salt 5RPVAd clear-text-passwd43
$1$5RPVAd$vgsoSANybLDepv2ETcUH7.
Then, copy the encrypted string to usermod. Make sure to wrap it with single quote.
$ usermod -p '$1$5RPVAd$vgsoSANybLDepv2ETcUH7.' root
Check it out in shadow file.
$ grep root /etc/shadow
root:$1$5RPVAd$vgsoSANybLDepv2ETcUH7.:17774:0:99999:7:::
Inspired by Eric Smith's idea, combining openssl passwd
and usermod -p
command worked. Generate hashed value of password along with salt value.
$ openssl passwd -1 -salt 5RPVAd clear-text-passwd43
$1$5RPVAd$vgsoSANybLDepv2ETcUH7.
Then, copy the encrypted string to usermod. Make sure to wrap it with single quote.
$ usermod -p '$1$5RPVAd$vgsoSANybLDepv2ETcUH7.' root
Check it out in shadow file.
$ grep root /etc/shadow
root:$1$5RPVAd$vgsoSANybLDepv2ETcUH7.:17774:0:99999:7:::
edited 1 hour ago
nyg
1033
1033
answered Aug 31 '18 at 21:29
Joon ByunJoon Byun
111
111
add a comment |
add a comment |
You should use password aging, and set the users so that they must change their password on the first login. See this article.
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
add a comment |
You should use password aging, and set the users so that they must change their password on the first login. See this article.
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
add a comment |
You should use password aging, and set the users so that they must change their password on the first login. See this article.
You should use password aging, and set the users so that they must change their password on the first login. See this article.
answered Nov 18 '11 at 21:37
waltinatorwaltinator
22.7k74169
22.7k74169
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
add a comment |
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
These intended to be FTP-only accounts, but good advice. ;)
– Jake Petroules
Nov 18 '11 at 22:49
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f80444%2fhow-to-set-user-passwords-using-passwd-without-a-prompt%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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