Varun Sarja used a keystroke logger to hack into multiple university campus computers (Representational)

An Indian-American student who hacked into his school's computer system last year to change his failing grades to "A" has been granted probation and asked to apologise to his professors.

The judge granted Varun H Sarja, 20, a year and a half probation "with an underlying 18-month prison sentence that he could be ordered to serve should he fail at probation," the Lawrence Journal-World reported late on Monday.

Mr Sarja, who was convicted in May on 18 felony counts, had pleaded guilty to two counts each of identity theft and unlawful computer acts.

The remaining counts against him were dismissed. The criminal charges were filed against Mr Sarja in November 2017.

While studying engineering as a freshman at University of Kansas (KU) during the 2016-17 school year, Mr Sarja used a keystroke logger to steal confidential login information and hacked into multiple campus computers to change his failing grades.

A keylogger is a device plugged into the computer that tracks or logs the keys struck on the keyboard in a covert manner, enabling the hacker get access to username and password.

An investigation revealed that Mr Sarja had changed almost all of his 10 grades that year and stole teachers' login credentials to do it.

"Sarja told detectives he loved engineering, wanted to be successful and was scared to tell his parents he had failed classes," the report noted.

Mr Sarja has agreed to the terms of his probation, saying he would apologise directly to those professors who were affected.

Mr Sarja, who hails from Olathe city, also told the judge that he would not access keyloggers again.