I can confirm the same thing here. I've just setup a secondary administrator on my development NAS, then SSH'd into the NAS as that user (which is not the way I suggest in the OP, but that process was written long-before QNAP began allowing other users to SSH in
).
Code: Select all
[test@laura ~]$ sudo curl -skL https://git.io/create-autorun | bash
create-autorun.sh (220122b)
info: NAS model: TS-230
info: QTS version: 5.0.0 #20211221
info: default volume: /share/CACHEDEV1_DATA
done: found autorun partition (/dev/mmcblk0p5)
done: created mount-point (/tmp/create-autorun.z0rSeb)
done: mounted (ext2) autorun partition (/dev/mmcblk0p5) at (/tmp/create-autorun.z0rSeb)
done: found tag-file (/tmp/create-autorun.z0rSeb/uLinux.conf) - we're in the right place
mkdir: can't create directory '/share/CACHEDEV1_DATA/.system/autorun/': Permission denied
fail: Unable to create script store! (/share/CACHEDEV1_DATA/.system/autorun/scripts)
done: unmounted (ext2) autorun partition
done: removed mount-point (/tmp/create-autorun.z0rSeb)
If I remove the autorun structure, then login via SSH using the 'admin' account, it works fine:
Code: Select all
[~] # curl -skL https://git.io/create-autorun | bash
create-autorun.sh (220122b)
info: NAS model: TS-230
info: QTS version: 5.0.0 #20211221
info: default volume: /share/CACHEDEV1_DATA
done: found autorun partition (/dev/mmcblk0p5)
done: created mount-point (/tmp/create-autorun.mFCxGp)
done: mounted (ext2) autorun partition (/dev/mmcblk0p5) at (/tmp/create-autorun.mFCxGp)
done: found tag-file (/tmp/create-autorun.mFCxGp/uLinux.conf) - we're in the right place
done: created script store (/share/CACHEDEV1_DATA/.system/autorun/scripts)
done: created script processor (/share/CACHEDEV1_DATA/.system/autorun/autorun.sh)
done: created symlink from (/share/CACHEDEV1_DATA/.system/autorun/autorun.sh) to (/tmp/create-autorun.mFCxGp/autorun.sh)
done: unmounted (ext2) autorun partition
done: removed mount-point (/tmp/create-autorun.mFCxGp)
info: please place your startup scripts into (/share/CACHEDEV1_DATA/.system/autorun/scripts)
So, it works if we follow the original process. However, as QNAP now include 'sudo' and do allow other users to SSH into their NAS, I really should get this working in the conventional manner.
This means I'll need to add a check for $EUID to the script to ensure it's being run as the superuser. Something like:
Code: Select all
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
Good pickup on the output from 'curl' being problematic.
There's a very faint bell ringing in my head as to why this happens, but I just can't put my finger on it. Need to do some research.