Let F q be a finite field of q = p r elements, where p is a prime, r is a positive integer, we determine automorphism θ of a class of finite commutative semisimple ring R = t i=1 F q and the structure of its automorphism group Aut (R). We find that θ is totally determined by its action on the set of primitive idempotent e 1 , e 2 , . . . , e t of R and its action onwhere G 1 is a normal subgroup of Aut (R) isomorphic to the direct product of t cyclic groups of order r, and G 2 is a subgroup of Aut (R) isomorphic to the symmetric group S t of t elements.For any linear code C over R, we establish a one-to-one correspondence between C and t linear codes C 1 , C 2 , . . . , C t over F q by defining an isomorphism ϕ. For any θ in Aut (R) and any invertible element λ in R, we give a necessary and sufficient condition that a linear code over R is a θ-λ-cyclic code in a unified way. When θ ∈ G 1 , the C 1 , C 2 , . . . , C t corresponding to the θ-λ-cyclic code C over R are skew constacyclic codes over F q . When θ ∈ G 2 , the C 1 , C 2 , . . . , C t corresponding to the skew cyclic code C over R are quasi cyclic codes over F q . For general case, we give conditions that C 1 , C 2 , . . . , C t should satisfy when the corresponding linear code C over R is a skew constacyclic code.Linear codes over R are closely related to linear codes over F q . We define homomorphisms which map linear codes over R to matrix product codes over F q . One of the homomorphisms is a generalization of the ϕ used to decompose linear code over R into linear codes over F q , another homomorphism is surjective. Both of them can be written in the form of η M defined by us, but the matrix M used is different. As an application of the theory constructed above, we construct some optimal linear codes over F q .