By default the linux “fmadio” account is the default user account and can not be removed. Additional SSH user accounts can be added to the system, below are the specific steps.
Step 1) Create the account
Create the account using the usual linux command adduser In the below examples the account is named “service” this can be changed freely.
Run the command to create the account
sudo adduser service -G staffExample output
fmadio@fmadio200v4-636:~$ sudo adduser service -G staff
Changing password for service
New password:
Bad password: too short
Retype password:
passwd: password for service changed by root
fmadio@fmadio200v4-636:~$Step 2) Create .ssh directory (optional)
To create an SSH Key based login
Change to be the service user
sudo su serviceThen create the .ssh directory
cd
mkdir .sshTypically create an authorized_key file for password / key based login
vi .ssh/authorized_keysThen paste in the public access keys
Full command shown below
service@fmadio200v4-636:/home/fmadio$ cd
service@fmadio200v4-636:~$ mkdir .ssh
service@fmadio200v4-636:~$ pwd
/home/serviceThe usual Linux / Bash shell configuration can be done here
Step 3) Enable sudo
Edit the sudoers files to allow the service account run sudo
sudo vi /etc/sudoersThen add the new user account, example shown below for service
service@fmadio200v4-636:~$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
fmadio ALL=NOPASSWD: ALL
service ALL=NOPASSWD: ALL
service@fmadio200v4-636:~$Step 4) Copy system files for persistence
The system files need to be persisted, otherwise the service account will not be preserved
Copy the home directory
sudo mkdir /mnt/store0/home/
sudo cp -Rp /home/service /mnt/store0/home/Copy the system files
sudo cp /etc/passwd /opt/fmadio/etc/
sudo cp /etc/sudoers /opt/fmadio/etc/Step 5) Update boot.lua
For firmware prior to Version XXXXX the following needs to be added to the boot.lua file. Firmware from Version XXXX does this automatically and this is not required.
Edit the file
/opt/fmadio/etc/boot.lua
Append these lines at the end of the file
-- service account
os.execute([[cp -Rp /mnt/store0/home/* /home/]])
os.execute([[cp /opt/fmadio/etc/passwd /etc/]])
os.execute([[cp /opt/fmadio/etc/sudoers /etc/]])Step 6) Reboot
After reboot, confirm login using the service account works correctly.