Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
If I lose the phone, someone may find it and try to reset the security pattern via recovery. How can I lock / unlock recovery via terminal?
You cannot lock the recovery. That's not recovery is intended.
The only chance to do so is locking bootloader.
However, if the bootloader on your device is not locked when it's out-of-the-box, then it can't be locked. Factory Reset Protection won't have much effect in this case.
Required, but never shown