====== Remote Management using SSH ====== If you prefer (or have to use) a command line for managing Blocks, here's a video showing you how to do this. SSH is a terminal command available on all major operating systems, allowing you to log in to a remote computer, execute commands, copy files back and forth, etc, all using a secure and encrypted connection.
==== List of Commands ==== Here's an overview of commands demonstrated in this video.
# In Blocks server's terminal window, to see its IP address
ip a
# Use the "sudo" prefix under the pixi-admin user to run system level command XXX
sudo XXX
# E.g., Blocks server's terminal window, after logging in as pixi-admin
sudo systemct enable --now ssh
# Alternatively, use webmin to enable ssh
# Now you can log in from remote computer over network
ssh pixi-server@
# First time, need to accept the Fingerprint" of the Blocks server
# You can use domain name in place of IP-of-Blocks-server if you
# have a DNS pointing to your Blocks server.
# Enter the pixi-server user's password when requested
# IMPORTANT: If you open up a port for SSH from the Internet.
# Do NOT use password-based ssh login. Use key authentication instead.
# Then also DISABLE password authentication. Google for:
# ssh key authentication disable password
# Stopping and starting Blocks from within /home/pixi-server
./stop.sh
./start.sh
# stop.sh and start.sh are shell script files (similar to Windows BAT files).
# See what's inside
cat start.sh
# The shell scripts use the systemctl command to manipulate a user service (here Blocks).
# For example, to check on Block's status
systemctl --user status blocks
# Note that "systemctl --user xxx" works only when logged in as the pixi-server user
# (not under pixi-admin)
# The leading period represents the "current working directory",
# and must be specified to run the shell scripts in the current directory.
# To see the current working directory, use
cwd
# To change directory to one inside the current directory
cd name-of-subdirectory
# To move one level up
cd ..
# To see what's inside the current directory
ls
# To see details on what's in the current directory (including hidden files)
ls -al
# Navigate to log directory:
cd ~/PIXILAB-Blocks-root/logs
# View the entire log file:
cat latest.log
# View the last couple of lines in the current log file:
tail latest.log
# Follow what's added to the log file in real time
tail -f latest.log
# To stop following, press Ctrl-C
# Open a second terminal to start/stop blocks while
# following the log file in the other terminal window.
# Edit the config file
nano PIXILAB-Blocks-config.yml
# Or perhaps just config.yml if inside the Blocks root
# View general performance and running processes
htop
# display free disk space
df
# Move files
mv
# Copy files
cp
# Remove files and directories
rm
rm -r
# Using a new terminal window on your local machine (not logged in over ssh)
# Copy files TO your Blocks server
scp XXXX pixi-server@:/home/pixi-server
# Copy file FROM your blocks server
scp pixi-server@:/home/pixi-server/PIXILAB-Blocks-root/logs/latest.log .
# Notice the period at the end of the command, representing the current directory on your local computer
# Terminate the ssh session
exit
# Logging in as the admin user (from the remote terminal)
ssh pixi-admin@
# Update OS and system software
sudo apt update
sudo apt upgrade
# Commands requiring the use of sudo don't work under pixi-server
# Enable/Disable Start/Stop system services
sudo systemctl enable webmin
sudo systemctl enable smbd
sudo systemctl start webmin
# Describe the difference between enable/disable and start/stop
sudo systemctl status webmin
sudo systemctl stop webmin
# Rebooting the remote computer
sudo reboot now