non-interactive password change of nspawn container
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I want to change passwd of root of nspawn container, as I am creating container via ansible just after I created rootfs, as at very first it doesn't have any root password.
is it a good idea to change passwd by using replace module to replace root line in /etc/shadow
file ?
is there any other way too to update the password non-interactively ?
I have tried :
echo user:pass | /usr/sbin/chpasswd
but echo is not working, a I am getting execv() failed: No such file or directory
systemd-nspawn
add a comment |Â
up vote
0
down vote
favorite
I want to change passwd of root of nspawn container, as I am creating container via ansible just after I created rootfs, as at very first it doesn't have any root password.
is it a good idea to change passwd by using replace module to replace root line in /etc/shadow
file ?
is there any other way too to update the password non-interactively ?
I have tried :
echo user:pass | /usr/sbin/chpasswd
but echo is not working, a I am getting execv() failed: No such file or directory
systemd-nspawn
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to change passwd of root of nspawn container, as I am creating container via ansible just after I created rootfs, as at very first it doesn't have any root password.
is it a good idea to change passwd by using replace module to replace root line in /etc/shadow
file ?
is there any other way too to update the password non-interactively ?
I have tried :
echo user:pass | /usr/sbin/chpasswd
but echo is not working, a I am getting execv() failed: No such file or directory
systemd-nspawn
I want to change passwd of root of nspawn container, as I am creating container via ansible just after I created rootfs, as at very first it doesn't have any root password.
is it a good idea to change passwd by using replace module to replace root line in /etc/shadow
file ?
is there any other way too to update the password non-interactively ?
I have tried :
echo user:pass | /usr/sbin/chpasswd
but echo is not working, a I am getting execv() failed: No such file or directory
systemd-nspawn
edited Jul 12 at 9:39
asked Jul 12 at 9:21
mkmayank
36310
36310
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
passwd
works for this case. It has an option --stdin
. Do not use echo my-secret-password | passwd --stdin
, because echo my-secret-password
may become visible if someone runs ps
, or maybe even in a log file if you are unlucky.
#!/bin/sh
PASSWORD=...
passwd root --stdin <<EOF
$PASSWORD
EOF
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
passwd
works for this case. It has an option --stdin
. Do not use echo my-secret-password | passwd --stdin
, because echo my-secret-password
may become visible if someone runs ps
, or maybe even in a log file if you are unlucky.
#!/bin/sh
PASSWORD=...
passwd root --stdin <<EOF
$PASSWORD
EOF
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
add a comment |Â
up vote
1
down vote
accepted
passwd
works for this case. It has an option --stdin
. Do not use echo my-secret-password | passwd --stdin
, because echo my-secret-password
may become visible if someone runs ps
, or maybe even in a log file if you are unlucky.
#!/bin/sh
PASSWORD=...
passwd root --stdin <<EOF
$PASSWORD
EOF
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
passwd
works for this case. It has an option --stdin
. Do not use echo my-secret-password | passwd --stdin
, because echo my-secret-password
may become visible if someone runs ps
, or maybe even in a log file if you are unlucky.
#!/bin/sh
PASSWORD=...
passwd root --stdin <<EOF
$PASSWORD
EOF
passwd
works for this case. It has an option --stdin
. Do not use echo my-secret-password | passwd --stdin
, because echo my-secret-password
may become visible if someone runs ps
, or maybe even in a log file if you are unlucky.
#!/bin/sh
PASSWORD=...
passwd root --stdin <<EOF
$PASSWORD
EOF
answered Jul 12 at 9:40
sourcejedi
18k22375
18k22375
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
add a comment |Â
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
Thanks for the answer, but this is working fine in host, even the echo one which I mentioned above is running fine too in host, but failing in nspawn container
â mkmayank
Jul 12 at 9:52
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
my shadow file was messed up somehow, pwconv helped and its working now
â mkmayank
Jul 12 at 10:03
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454860%2fnon-interactive-password-change-of-nspawn-container%23new-answer', 'question_page');
);
Post as a guest
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
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
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