To set whether users can send you messages with the write command, use mesg. Just typing mesg will register what your choice is currently set as (y allows messages to appear; n prevents messages from appearing). To change the settings, use mesg y or mesg n, depending on the setting you want.