handle root vs non-root user and sudo command