For example I got several broken screen Huawei P20s from 2018, they were 10€ each. 128GB storage with 4GB RAM https://www.gsmarena.com/huawei_p20-9107.php
They boot up, you can install termux and then whatever is your choice of Linux software. I run several copyparty instances for friends and family
https://f-droid.org/en/packages/com.termux/
https://github.com/9001/copyparty
The only thing I'm not a big fan of is the charging. Non-removable battery, already 8 or so years old, obviously the phone needs power to work. So I'm a bit worried about the fire hazard.