Setting up a ReadyNAS Shutdown Button in Ubuntu
If you’re as lazy as me, you’ll hate having to login to the web front end for your ReadyNAS every time you want to shut it down or getting up and holding down the power button for 5 seconds (it isn’t just me that hates doing this, right?). I finally decided to make an easier means of doing this which I thought I’d share with you all.
Although the title says this is for Ubuntu it should work in pretty much any Linux distribution seeing as it’s all pretty standard stuff. If you are using a different distribution you’ll have to use your distribution’s alternative to apt-get if it isn’t Debian.
The first thing you will need to do is install the Expect package using the following command:
sudo apt-get install expect
The reason we need Expect is to make the automation of the commands easier.
The second thing you will need to do is install the EnableRootSSH addon which is available from the official Netgear site (http://www.readynas.com/download/addons/4.00/EnableRootSSH_1.0.bin). Once you have downloaded this, login to your ReadyNAS web panel and make sure you are in Advanced Mode. Once logged in click the “Update” option underneath the System section and then click the “Local” tab. This screen will allow you to select the bin file you have just downloaded and install it to your ReadyNAS by pressing the “Upload and verify image” button. After the installation is complete you will have to restart your ReadyNAS.
Now that we have root access via SSH to the ReadyNAS and have Expect installed create a new document on your desktop and call it “ShutdownNAS.sh” and open it up in a text editor.
Copy and paste the following into the file, replacing IPADDRESSOFTHENAS with the I.P address of the ReadyNAS and YOURPASSWORD with the password you use to login to the web panel for the ReadyNAS (be sure to leave the \r at the end of the password) and save it:
Note: for some reason my blog is replacing the double quotation marks with a different character that will not work, so if you copy and paste this be sure to replace any quotation mark manually.
#!/usr/bin/expect
spawn ssh IPADDRESSOFTHENAS -l root
expect “*password:”
send “YOURPASSWORD\r”
send “\r”
expect “*:~#”
send “poweroff\r”
expect eof
Now run the following command to make the file executable:
chmod 755 ~/Desktop/ShutdownNAS.sh
Now if you drag the file into a terminal or double click and press Run it will login to your NAS and shut it down for you; simples
If you have any problems with this or want any help / information for expanding on this script feel free to ask.

This year my university decided to enter all the third year BSc computing students into a competition held by 







