mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-05-19 14:51:49 +00:00
Remove root login. Ubuntu user keeps generated password.
This commit is contained in:
parent
b9363e97fb
commit
1cc6041cd6
@ -69,11 +69,9 @@ chroot ${mount_d} apt-get install --no-install-recommends -y virtualbox-guest-ut
|
|||||||
chroot ${mount_d} apt-get clean
|
chroot ${mount_d} apt-get clean
|
||||||
|
|
||||||
# Create and setup users inside the image.
|
# Create and setup users inside the image.
|
||||||
# Vagrant users expect a "vagrant" user with a "vagrant" username, and that the
|
# Vagrant users expect a "vagrant" user with a "vagrant" username.
|
||||||
# root password is set to "vagrant" as well.
|
|
||||||
# See https://www.vagrantup.com/docs/boxes/base.html
|
# See https://www.vagrantup.com/docs/boxes/base.html
|
||||||
chroot ${mount_d} useradd -m vagrant -s /bin/bash
|
chroot ${mount_d} useradd -m vagrant -s /bin/bash
|
||||||
echo "root:vagrant" | chroot ${mount_d} chpasswd
|
|
||||||
echo "vagrant:vagrant" | chroot ${mount_d} chpasswd
|
echo "vagrant:vagrant" | chroot ${mount_d} chpasswd
|
||||||
|
|
||||||
# The vagrant user should have passwordless sudo.
|
# The vagrant user should have passwordless sudo.
|
||||||
@ -82,7 +80,7 @@ vagrant ALL=(ALL) NOPASSWD:ALL
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# We should permit root login with password :(
|
# We should permit root login with password :(
|
||||||
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/g' ${mount_d}/etc/ssh/sshd_config
|
#sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/g' ${mount_d}/etc/ssh/sshd_config
|
||||||
|
|
||||||
# Add the insecure vagrant pubkey to the vagrant user, as is expected by the
|
# Add the insecure vagrant pubkey to the vagrant user, as is expected by the
|
||||||
# vagrant ecosystem (https://www.vagrantup.com/docs/boxes/base.html)
|
# vagrant ecosystem (https://www.vagrantup.com/docs/boxes/base.html)
|
||||||
@ -125,7 +123,7 @@ cdrom_vmdk_f="${box_d}/${prefix}-configdrive.vmdk"
|
|||||||
# except via local host.
|
# except via local host.
|
||||||
cat > ${seed_d}/user-data <<END
|
cat > ${seed_d}/user-data <<END
|
||||||
#cloud-config
|
#cloud-config
|
||||||
chpasswd: { expire: False }
|
chpasswd: { expire: True }
|
||||||
password: ${ubuntu_user_pass}
|
password: ${ubuntu_user_pass}
|
||||||
ssh_pwauth: True
|
ssh_pwauth: True
|
||||||
manage_etc_hosts: localhost
|
manage_etc_hosts: localhost
|
||||||
@ -169,8 +167,8 @@ load include_vagrantfile if File.exist?(include_vagrantfile)
|
|||||||
## We also have an "ubuntu" user with pass "${ubuntu_user_pass}"
|
## We also have an "ubuntu" user with pass "${ubuntu_user_pass}"
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
config.vm.base_mac = "${macaddr}"
|
config.vm.base_mac = "${macaddr}"
|
||||||
config.ssh.username = "vagrant"
|
config.ssh.username = "ubuntu"
|
||||||
config.ssh.password = "vagrant"
|
config.ssh.password = "${ubuntu_user_pass}"
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
|
vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user