Jump to content

"The system deletes the home directory I created while building the system during startup."


li ABB

Recommended Posts

Β I am a developer from China and am not very familiar with English, so the following content is translated through Google Translate.

When I successfully flash the image file of the built system onto the development board, the system seems to delete the directory under /home upon the first boot (from my observation).

The build command being used :./compile.sh build BOARD=firefly-rk3399 BRANCH=current BUILD_DESKTOP=no BUILD_MINIMAL=yes KERNEL_CONFIGURE=no RELEASE=focal 

This is an excerpt from customize-image.sh.

Main() {
	case $RELEASE in
		stretch)
			# your code here
			# InstallOpenMediaVault # uncomment to get an OMV 4 image
			;;
		buster)
			# your code here
			;;
		bullseye)
			# your code here
			;;
		bionic)
			# your code here
			;;
		focal)
			# your code here
			echo "12345678"
			cjia_xxx
			;;
	esac

} # Main


cjia_xxx()
{

		  rm /root/.not_logged_in_yet
        username=cjia
        pass=cjia

        # Check if user already exists.
        grep -q "$username" /etc/passwd
        if [ $? -eq $SUCCESS ] 
        then	
            echo "User $username does already exist."
            echo "please chose another username."
            exit $E_USEREXISTS
        fi  

        #Preerequisite for mkpasswd : whois

        useradd  -d /home/"$username" -m -g users -s /bin/bash "$username"
        #Allow no one else to access the home directory of the user
        chmod 750 /home/"$username" 
        echo "$username":"$pass"|chpasswd
        echo "the account is setup"


        PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQsdfsdfsfsdfa6r2jUg5Wmnk7m97BccU+itsqEUe0IOUKslOdHlGQcos9APLEZk1jec/a/7eGCcCVfTNznW8Wskg+o/nyZDBCeQL7TMs5L2TlBoJpOudo42bxEp0lqTe8nS/cKPv3EZT0mMdFh3JbSqmF0eou6rbui0EjInzh9+CqB/fsuErunJ700N+uZ0l9dJ7Fofj1Ws1rptk0Ezer8YmIaDfvm4mFY7pQTHIqphqZ0IhBRXrBbL5XFv53cevvdfpkLA6y4LplWnIysdfsdfsdfsdeqG+r1licfbQYYqpACr8jFuv7T6Q2BaMfDF5AKZ8UeuIe66lFX+5MpD25WM+LamlEnBmh67d1SYOadSGBXC5RSs5Vp9hX1Nff2tfVN+kyvsfPe/v0D/ScJdqKCCR+w3SResv/aFZPW524tI32ehU1q7G2XYqdayxbA5QLjIxwo+NJn6Bc="
        CJIA_HOME="/home/cjia"
        mkdir -p $CJIA_HOME/.ssh
        echo "$PUBLIC_KEY" >> $CJIA_HOME/.ssh/known_hosts
        chown cjia:cjia $CJIA_HOME/.ssh/known_hosts
        chmod 600 $CJIA_HOME/.ssh/known_hosts
        cat $CJIA_HOME/.ssh/known_hosts
        cd /home/cjia
        ls -al
        pwd
        su cjia -c "pwd"
  }

Corresponding log output

[🐳|πŸ”¨]   the account is setup
[🐳|πŸ”¨]   chown: invalid group: β€˜cjia:cjia’
[🐳|πŸ”¨]   ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQsdfsdfsdfsdphekfmCKihCw5UKzXPhdeMxAsa6r2jUg5Wmnk7m97BccU+itsqEUe0IOUKslOdHlGQcos9APLEZk1jec/a/7eGCcCVfTNznW8Wskg+o/nyZDBCeQL7TMs5L2TlBoJpOudo42bxEp0lqTe8nS/cKPv3EZT0mMsdfsdfsdfsdEjInzh9+CqB/fsuErunJ700N+uZ0l9dJ7Fofj1Ws1rptk0Ezer8YmIaDfvm4mFY7pQTHIqphqZ0IhBRXrBbL5XFv53cevvdfpkLA6y4LplWnIyE5lqESVyp9m5Vj+rYMHdGTiIr2il2aN+xKcAeqG+r1licfbQYYqpACr8jFuv7T6Q2BaMfDF5AKZ8UeuIe66lFX+5MpD25WM+LamlEnBmh67d1SYOadSGBXC5RSs5Vp9hX1Nff2tfVN+kyvsfPe/v0D/ScJdqKCCR+w3SResv/sdfsdfsdfsdyxbA5QLjIxwo+NJn6Bc= cjia@DESKTOP-T9MJO61
[🐳|πŸ”¨]   total 12
[🐳|πŸ”¨]   drwxr-x--- 3 cjia users  120 Mar 26 12:41 .
[🐳|πŸ”¨]   drwxr-xr-x 3 root root    60 Mar 26 12:41 ..
[🐳|πŸ”¨]   -rw-r--r-- 1 cjia users  220 Feb 25  2020 .bash_logout
[🐳|πŸ”¨]   -rw-r--r-- 1 cjia users 3771 Mar 26 12:28 .bashrc
[🐳|πŸ”¨]   -rw-r--r-- 1 cjia users  807 Feb 25  2020 .profile
[🐳|πŸ”¨]   drwxrwxr-x 2 root root    60 Mar 26 12:41 .ssh
[🐳|πŸ”¨]   /home/cjia
[🐳|πŸ”¨]   /home/cjia

Β 

When logging in for the first time

image.png.9afd3a4addb18fe64e1930e653b205bf.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Γ—
Γ—
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines