Support / Knowledge Base / How to create multiple users in Digi Embedded Linux (5.7 onwards)

How to create multiple users in Digi Embedded Linux (5.7 onwards)


1. Create a default FULL Project in DEL , build and update these images onto target (eg: ccwmx51).

2. Connect to serial console of target.

3. By default you will be having a user 'default' UID:1000 with group 'users' GID:100 .
p { margin-bottom: 0.08in; }

BusyBox v1.18.4 (2011-11-24 14:43:35 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.
~ # cat /etc/passwd
root:$1$o/c1Q/E4$jLGsldHxRdlYpEI3v6Sdv1:0:0:root:/root:/bin/sh
www-data:*:33:33:www-data:/var/www:/bin/sh
nobody:*:65534:65534:nobody:/nonexistent:/bin/sh
default::1000:100:default user:/home/default:/bin/sh
ftp:x:50:50:Anonymous FTP user:/var/ftp:/bin/sh


Read more about /etc/passwd

~ #
~ # cat /etc/group
root:*:0:
www-data:*:33:
users:*:100:
nogroup:*:65534:
ftp:x:50:

Read more about /etc/group

~ #
~ # ls -l /home/
drwxr-xr-x 2 default users 0 Feb 16 2012 default

d rwx r-x r-x
| | | |
directory user permissions group permissions group permissions

r - read
w - write
x - execute
s - setUID (this field will be in 3rd bit of permissions if USER ID is NOT set)
- - No Permissions

Read more about Linux File Permissions

So now we have one user :- default and one group :- users

We are going to create two users with in one group

'User1' in 'Mygroup'
'User2' in 'Mygroup'

Follow as below:-

~ # mkdir /home/User1 {Creating Home Folders for new users}
~ # mkdir /home/User2
~ # ls -l /home/
drwxr-xr-x 2 root root 0 Jan 1 00:31 User1
drwxr-xr-x 2 root root 0 Jan 1 00:31 User2
drwxr-xr-x 2 default users 0 Feb 16 2012 default
~ #
~ # addgroup Mygroup -g 5000 {Creating a group for new users}
~ # cat /etc/group
root:*:0:
www-data:*:33:
users:*:100:
nogroup:*:65534:
ftp:x:50:
Mygroup:x:5000:
~ #

{Creating two new users}

~ # adduser User1 -h /home/User1 -s /bin/sh -G Mygroup -u 1001
Changing password for User1
New password:
Bad password: too short
Retype password:
Password for User1 changed by root
~ #
~ # adduser User2 -h /home/User2 -s /bin/sh -G Mygroup -u 1002
Changing password for User2
New password:
Bad password: too short
Retype password:
Password for User2 changed by root
~ #
~ # cat /etc/passwd
root:$1$o/c1Q/E4$jLGsldHxRdlYpEI3v6Sdv1:0:0:root:/root:/bin/sh
www-data:*:33:33:www-data:/var/www:/bin/sh
nobody:*:65534:65534:nobody:/nonexistent:/bin/sh
default::1000:100:default user:/home/default:/bin/sh
ftp:x:50:50:Anonymous FTP user:/var/ftp:/bin/sh
User1:$1$mnAi/Cvy$i30859j6SO7IdOqvyJTqs1:1001:5000:Linux User,,,:/home/User1:/bin/sh
User2:$1$.wSqi3al$g7U8wZVB8c7Jc5BAcF9Nv1:1002:5000:Linux User,,,:/home/User2:/bin/sh

~ #

Second field in /etc/passwd shows encrypted form of user's password.
In common Linux Hosts this field will be having a character 'x' which indicates that password is stored in encrypted format in /etc/shadow file.
Here we dont have /etc/shadow file so password is stored in /etc/passwd itself. $1$ indicates that MD-5 algorithm was used for encryption.


Read more About /etc/shadow

Now you need to copy /etc/passwd & /etc/group file to local host machine so that you can use this file in your project.

In your FULL Project /configs/dev_table.txt file
add the following

/bin/busybox f 4755 0 0 {This is used to add 'su' applet in non-root users. }
/home/User1 d 755 1001 5000 0
/home/User2 d 755 1002 5000 0

In your FULL Project and copy the above /etc/passwd & group files to project workspace /home/{user_on_host}/workspace/multiple_users/

open add_files.sh and add the following lines.

cp '${DEL_PROJ_DIR}/passwd' '${ROOTFS_DIR}/etc/'
cp '${DEL_PROJ_DIR}/group' '${ROOTFS_DIR}/etc/'

{NOTE:- please replace single quotes ( ' ) with double quotes }

Install the roofs onto tftp folder and update flash again.

Boot from target and cross verify :-

~ # ls -l /home/
drwxr-xr-x 2 User1 Mygroup 0 Feb 17 2012 User1
drwxr-xr-x 2 User2 Mygroup 0 Feb 17 2012 User2
drwxr-xr-x 2 default users 0 Feb 16 2012 default
~ #
~ #
~ # cat /etc/passwd
root:$1$o/c1Q/E4$jLGsldHxRdlYpEI3v6Sdv1:0:0:root:/root:/bin/sh
www-data:*:33:33:www-data:/var/www:/bin/sh
nobody:*:65534:65534:nobody:/nonexistent:/bin/sh
default::1000:100:default user:/home/default:/bin/sh
ftp:x:50:50:Anonymous FTP user:/var/ftp:/bin/sh
User1:$1$mnAi/Cvy$i30859j6SO7IdOqvyJTqs1:1001:5000:Linux User,,,:/home/User1:/bin/sh
User2:$1$.wSqi3al$g7U8wZVB8c7Jc5BAcF9Nv1:1002:5000:Linux User,,,:/home/User2:/bin/sh
~ # cat /etc/group
root:*:0:
www-data:*:33:
users:*:100:
nogroup:*:65534:
ftp:x:50:
Mygroup:x:5000:User1,User2
~ #

Now login using newly created user:-

~ # login
ccwmx51js login: User1
Password:

BusyBox v1.18.4 (2011-11-24 14:43:35 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $
~ $ whoami
User1
~ $

To get user login prompt in Linux boot follow How do I get a user login prompt in Digi Embedded Linux bootup on Connect & ConnectCore devices ?
Last updated: Aug 08, 2017

Recently Viewed Articles

No recently viewed articles
Contact a Digi expert and get started today! Contact Us