As soon as you offer someone the ship level of alliance, they can remote-control all your ships. You can prevent ships from being remotely controlled by sending a remote forbid command. For example, to disable remote control for ship 38, you would send the command "remote forbid 38". If the ship currently is under remote control, it will be forcibly given back to you.
You can choose that all newly-built ships should be forbidden from remote control by sending a remote forbid default command. Note that this will only affect new ships; all ships which you already have are not affected. You must send individual remote forbid commands for each of them.
To allow remote control for some ship again, use the remote allow command, as in "remote allow 38". As above, you can also use "remote allow default" to make all newly-built ships remotely-controllable by default.