You should always enclose the command given to the ssh client for remote executing!
myuser@srv-local:~$ CMD="cat /etc/*release";ssh firstname.lastname@example.org "$CMD"
Gentoo Base System release 2.0.3
myuser@srv-local:~$ CMD="cat /etc/*release";ssh email@example.com $CMD
cat: /etc/lsb-release: No such file or directory
cat: /etc/os-release: No such file or directory
You see the difference! The second line the special character “*” asteriks will be expanded by the shell locally and then the result will be send to the remote server for execution. In the second case the remote server will receive a command “cat /etc/lsb-release /etc/os-release” (because our local system has there two files) and not what you want “cat /etc/*release” on the remote.
We use variables above, because we want to point out
the problem, which often occurs when you use ssh remote command execution in a script.
Yes, new major system upgrade new rules. If you’ve installed openssh server till Ubuntu 18 (Bionic Beaver) with just the simple command:
myuser@srv:~$ sudo apt-get install -y openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package openssh-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'openssh-server' has no installation candidate
Now it is impossible as you can see. It is strange why they just did not include it as an alias just to prevent you from searching the Net (google?).
So there is a new way of installing OpenSSH server – it is a software collection called “OpenSSH server” and there is a new tool to manage such collections:
So you must use tasksel to install OpenSSH server, here is the three command you should use: