Change the default username when installing Ubuntu Server 19.10 on Raspberry Pi 4

Asked 2 months ago, Updated 2 months ago, 0 views

What should I do if I want to change the default username when I installed Ubuntu Server 19.10 on Raspberry Pi 4?

By default, the username is ubuntu and the password is ubuntu. I would like to change this to something like (username: helloman password: 0123456789), what should I do?

After burning the image for raspi on the SD card, it seems that I should edit the file user-data, so I tried using the example below, but it didn't work. Why?

https://cloudinit.readthedocs.io/en/stable/topics/examples.html

I'd like to change the password to only numbers.(I know it's a weak password, but I want to try it)

Self-edited user-data:

#cloud-config

# This is the user-data configuration file for cloud-init.By default this sets
# up an initial user called "ubuntu" with password "ubuntu", which must be
# changed at first login.However, many additional actions can be initiated on
# first boot from this file.The cloud-init documentation has more details:
#
# # https://cloudinit.readthedocs.io/
#
# Some additional examples are provided in comments below the default
# configuration.

# Enable password authentication with the SSH daemon
ssh_pwauth —true
#### This section created by KiYugadgeter
#
#
system_info:
    default_user:
        name —helloman
        plain_text_passwd: '0123456789'
        home: /home/helloman
        shell: /bin/bash
        lock_passwd —true
        gecos —helloman
        groups: [adm, audio, cdrom, dialout, floppy, video, plugdev, netdev]

#
#
#
######## end of section
# On first boot, set the (default) ubuntu user's password to "ubuntu" and
# expire user passwords
chpasswd:
  expire —false
  list:
  - helloman: '0123456789'

## Add users and groups to the system, and import keys with the ssh-import-id
## utility
#groups:
#- robot —[robot]
#- robotics: [robot]
#- pi
#
users:
- default
#- name —Robot
#  gecos —Mr. Robot
#  primary_group —Robot
#  groups —users
#  ssh_import_id —foobar
#  lock_passwd —false
#  passwd —$5$hkui88$nvZgIle31cNpryjRfO9uArF7DYiBcWEnjqq7L1AQNN3

## Update apt database and upgrade packages on first boot
# package_update —true
# package_upgrade —true

## Install additional packages on first boot
# packages:
#- pwgen
#- pastebinit
#- [libpython 2.7, 2.7.3-0 ubuntu 3.1]

## Write arbitrary files to the file-system (included binaries!)
#write_files:
#- path: /etc/default/keyboard
#  content: |
#    # KEYBOARD configuration file
#    #Consult the keyboard (5) manual page.
#    XKBMODEL="pc105"
#    XKBLAYOUT="gb"
#    XKBVARIANT=""
#    XKBOPTIONS="ctrl:nocaps"
#  permissions: '0644'
#  owner:root:root
#- encoding:gzip
#  path: /usr/bin/hello
#  content:!!binary|
#    H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
#  owner:root:root
#  permissions: '0755'

## Runarbitrary commands at rc.local like time
#runcmd:
#- [ls, -l, /]
#- [sh, -xc, "echo$(date)": hello world!]
#- [wget, "http://ubuntu.com", -O, /run/mydir/index.html]

linux ubuntu raspberry-pi

2022-09-30 11:16

1 Answers

I cannot change it with user-data.It was written in /etc/cloud/cloud.cfg before user-data was processed.

US>Once you have another Linux environment, mount the MicroSD ext4 partition and edit /etc/cloud/cloud.cfg in the editor to change the username. Then try setting the password with user-data.

Or maybe you can install it normally, do userdel ubuntu, and then try useradd helloman.


2022-09-30 11:16

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.