Let's say you have named your computers main and spare, where main is your main computer running out of space, and spare is your headless NAS.
Step 1: Install openssh-server
ssh stands for secure shell. It is one of the key means of controlling a headless server remotely. Open a terminal in the computer spare and use the command:
sudo apt install openssh-server
to install the ssh-server in your headless server computer.
Step 2: Test ssh
Now open a terminal in main and type the command:
ssh username@spare.local
where username is the username of the sudo user of the computer spare. If username in spare is identical to username in main, then you can ommit username@ and can just enter:
ssh spare.local
If ssh to spare.local does not work then try the local IP address instead:
ssh username@192.168.x.y
Your local IP address may look different. x and y are numbers.
Answer the question about trusting the host and enter the sudo password for the spare computer. If all goes well you will be logged on to the computer spare while sitting at the computer main. You will know this by the change in the command prompt of the terminal from:
YourUserName@main:~$
to:
YourUserName@spare:~$
If you see this change in your terminal, congratulations! Now you can exit spare by typing exit. Your command prompt will return to:
YourUserName@main:~$
The test is complete.
Step 3: Turn off spare
Use the following command to turn off spare:
ssh -t username@spare.local "sudo systemctl poweroff"
This command sends the command inside the quotation marks to spare. Since that command starts with sudo you will be asked for your spare password twice, once for the ssh command, and the second time for the sudo to power off.
Step 4: Write a script
You can create a little script so that you don't have to type all that every time. The script can be called stopspare.sh and it can be saved in /home/$USER/bin folder of your main computer. The /home/$USER is your Home folder, $USER is your user name. If the bin folder does not exist in Home, create it.
The script will have two lines:
#!/bin/bash
ssh -t username@spare.local "sudo systemctl poweroff"
Remember to change username to the user name you use in spare. If you save the script in the location I suggested above, you can just open a terminal in main and type
stopspare.sh
to turn off the spare computer.
Bonus!
See the Ubuntu to Ubuntu section of this answer for how to use ssh based sftp in nautilus to access files in spare.
You may also want to read How to harden an SSH server? for more about security of ssh server.
Hope this helps