Skip to content

[Kind: generic_vm] env for VM user and password #440

@BurlyLuo

Description

@BurlyLuo
root@r1:/# ps -ef 
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 02:02 pts/0    00:00:01 python3 /launch.py --username clab --password clab@123 --hostname r1 --connection-mode tc --trace

About generic_vm, we can see the user and passwd is pre-defineded. can we read the user and passwd from clab yaml env parm?

      env:
        QEMU_SMP: 6
        QEMU_MEMORY: 8192
        USER: root
        PASSWD:  yt_xk39b

and Can we also set up passwordless SSH login at the same time?
like:

        sshpass -p "$PASSWD" ssh-copy-id "$USER@$container"
chpasswd:
  list: |
    root: myrootpassword
    clab: clab@123      
  expire: false


            # Disable cloud-init for the subsequent boots
            cfg_file.write("runcmd:\n")

runcmd:
  - sed -i 's/^#*PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
  - sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
  - systemctl restart ssh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions