How it works...
On our SSH server system, we create a new user account and assign a bash shell to it as its default shell. We also create a directory for this new user account in /home and assign its ownership to this account.
Next, we configure our SSH server system to authenticate another system connecting to it using authorization keys.
We then create a bash script to restrict particular commands such as date and add this script path to authorized_keys using the command option.
After this, when we try to connect to the SSH server from the other system, whose authorization keys were configured earlier, if we pass the date command as an argument when connecting, we can see that the command gets restricted.
However, when the same date command ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access