common code for checking if rm==localhost