# /boot/check-password.4th Read File Content From USB-Stick



## fr33bsd (Aug 21, 2021)

Hi,

I would like to cat a key file from attached usb stick to geli in _check-password.4th_ *if (and only if) a usb stick is attached to the system* (and after the geli magic check has detected encrypted partitions). If it is not attached regular password prompt should appear.

How to do that?


----------



## SirDice (Aug 23, 2021)

The *.4th files are only used by the Forth loader(8). Modern version use the LUA loader(8).


----------



## fr33bsd (Aug 23, 2021)

SirDice said:


> The *.4th files are only used by the Forth loader(8). Modern version use the LUA loader(8).


 ok, I guess I have to learn lua.

At this moment I don't know how to open a file in lua or how to use 


> *fopen* (_addr_ _len_ _mode_ -- _fd_)


But I could use loader command


> *lsdev* [*-v*]


to check if the usbdevice is plugged in....  maybe
But use loader commands from within lua?


----------



## fr33bsd (Aug 23, 2021)

fr33bsd said:


> ok, I guess I have to learn lua.
> 
> At this moment I don't know how to open a file in lua or how to use
> 
> ...


There is a function  _*readFile*_ in config.lua , but how do the devices names look like and how to mount its UFS partition to access a file in that boot phase? I'd guess there is no mounting.


----------

