Create new user on Embedded Linux without useradd tools
This is used on Linux systems without utilities such as useradd. This guide was written when configuring a Beaglebone Black after linux installation using buildroot.
First go to /etc/passwd. Edit this file with vi.
Example line to add 'alex:x:1010:1010:,:/home/alex:/bin.bash
username:alex passwd:x meaning stored in /etc/shadow user id:1010 group id:1010 additional text field: seperate by commas, nothing added in this example shell prompt:bash
- Ensure user id is unique.
Second go to /etc/shadow. Edit file with vi.
Example line 'alex:x:1010:'
Third ensure home directory has been created as defined in /etc/passwd. This can be done using a template.
cp -r /etc/skel /home/alex. If not available use mkdir /home/alex for now.
Ensure permissions are correct for home and alex.
'chown alex:alex /home/alex' AND 'chmod 0755 /home/alex'
Fourth edit /etc/shadow file.
Use the passwd alex command to change this. Now the user has been edit this command should work fine and populate /etc/shadow