You've hit the nail on the head: Ubuntu Core mounts the root filesystem as squashfs which is read-only. All the DEFAULT user authentication files /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow all live on a read-only filesystem. By Snapcraft's DESIGN you can't modify these users.
Only users added with:
sudo adduser --extrausers testusername
Can be modified by the
passwd command. The root user is not one of these. The user authentication files for these supplemental users live in a different path which IS RW:
Where you'll find writable user authentication files which can be altered by the
NOTE: There is a way of working with System users in the following link, but I'm not sure you'll be able to alter the
root user which is your goal:
Preface the remote command with
ssh yourUser@22.214.171.124 -t 'sudo /bin/sh -c cd /home/yourUser;sudo ./test.sh'
In test.sh you can specify commands which require root perms and the
sudo will execute them successfully. I guess there's other ways of doing it, but it's a starting point. HTH bud- T