If you are using the AWS Marketplace Esri Enterprise AMI (containing ArcGIS Server, Portal for ArcGIS, and ArcGIS DataStore), change users from the default of ubuntu to arcgis (i.e. su arcgis). Run the authorizeSoftware tool without using sudo. The software was installed using the arcgis user account, and that account has full permissions to all tools.