Friday, April 30, 2021

Creating and logging in to a Windows Containers user with a password

Windows Containers by default uses ContainerAdministator user account with blank password. Creating a new user with password can be done but cannot be used in DockerFile for example. If you want to use another user in a container you have to create a user with blank password!

To login to a container with a password, do the following:
PS C:\> $cert = New-SelfSignedCertificate -DnsName "dontcare" -CertStoreLocation Cert:\LocalMachine\My
PS C:\> winrm create winrm/config/Listener?Address=*+Transport=HTTPS ('@{Hostname="notimportant"; CertificateThumbprint="' + $cert.Thumbprint + '"}')
PS C:\> winrm set winrm/config/service/Auth '@{Basic="true"}'
PS C:\> $cred = New-Object pscredential 'timus', (ConvertTo-SecureString -String 'P@$$w0rd' -AsPlainText -Force)
PS C:\> Enter-PSSession -Credential $cred -ComputerName localhost -Authentication Basic -UseSSL -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck)

No comments:

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04 I am planning to run qemu-system-ppc to play around QEMU ...