Updated checkRoot implementation to include sudo