By default, OpenWRT has one only user: the root admin.
We will create a new user, without privilege, only the one to administrate
correctly the system with the tool
As root, execute all those commands:
# opkg update
# opkg install shadow-useradd sudo
shadow-usermodpackage; this intents to set the user account.
Now, config the user account:
# useradd ego:
egois the account name - it’s up to your convenience…
# passwd ego: define the password
# mkdir -p /home/ego/.ssh: make the main home, and the ssh folder.
# touch /home/ego/.ssh/authorized_keys: create empty file (to copy your SSH public keys)
# chown -R ego:ego /home/ego: give the user rights on his home.
# chmod 0700 /home/ego: auth only this user.
I would only talk about the sudo most secure method of configuration:
This method allows you to simply use the administrator’s password without having to login with the administrator account. The command
sudo must be preceded by any other necessary command.
We edit the
/etc/sudoers with the
Place at the bottom of the file, and uncomment the both lignes, to remove
# Defaults targetpw # Ask for the password of the target user
# ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw'
After saving and quit, your user can use any administration commands.
Now, it’s the good time to add your ssh auth key into the
Think to edit the file
/etc/sysupgrade.conf to add:
- your home folder,
/etc/sudoers.d(only if you add config into this folder)
and check with the command
So, for the future upgrade, yours personals datas will be saved.