Have to get through with the disclaimer before continuing:

Do not void your warranty, please understand that SSH access can void your warranty. Im not responsible for any damages that might occur.

PROBLEM AT HAND:

This article explains How to change the password of the admin and root user in the readynas from the backend. This should work on Readynas with firmware 4.x, 5.x, and 6.x.

SIMPLE WAY:

Anyhow to change the password:

passwd admin
passwd root
smbpasswd admin

Note: you can test your new password with: ssh root@localhost , after confirming type  exit  to get back to your old shell (which will for all intensive purposes look the same)

Note: in the Readynas the admin and root password always match (so when you change the password from the GUI, the system essentially does the above 3 commands)

Note: the admin user has a samba account (thus there is an entry in the samba trivial database); the samba password also has to be changed with smbpasswd to match the regular admin (and root password) to be consistent.

If you need to include them in a script. There are 2 ways, 1 way using passwd, and another way using chpasswd.

#SCRIPT1 – using passwd

# change password for admin and root to Password123
# note double the password because they ask for confirmation
echo -e "Password123\nPassword123" | passwd root
echo -e "Password123\nPassword123" | passwd admin
echo -e "Password123\nPassword123" | smbpasswd -s admin

#SCRIPT2 – using chpasswd

# change password for admin and root to Password123
echo "root:Password123" | chpasswd
echo "admin:Password123" | chpasswd
echo -e "Password123\nPassword123" | smbpasswd -s admin

Note: You can change Password123 with $VARIABLE if you want to use variables, or even ${VARIABLE} just do some experimenting.

Note: Why need to change smbpasswd admin and passwd admin, because samba uses different files for storing users then the system. Check out the trivial database: samba trivial database

Leave a Reply

Your email address will not be published. Required fields are marked *