A security keyboard matrix scanning method for a keyboard is disclosed. This invention utilizes bi-directional input/output ports, in which each line of the X-port and the Y-port can be selectively designated as a sensing line or an output line, to construct the X-port and Y-port such that at least one line of one of the two ports can output a scanning signal representative of a dummy scanning signal at the time the actual scanning signal is output from another line of either port. Thus, the scanning method disclosed in this invention can efficiently prevent a password from being recognized by a third party for illegal use thereby enhancing the security of a password identification device.