Using STSADM to give Sharepoint Groupes or Active Directory Users/Groupes permissions to a Sharepoint Site [MOSS]


Recently I had to modify a series of sub-sites (all of them under one site). These sites are provisioned automatically using a specific webpart on the top site. These sites are used by everyone in the company and permissions are very important. The main issue was that permissions on each sub-site needed to be updated in order to give read access to a new Sharepoint Group which did not existed previously.

The stsadm operation I used was ‘userrole’. The syntax of the userrole operation is as follows:
stsadm –o userrole –url <full url> –userlogin <domain\user or SharePoint group> –role <role, such as Contribute or “Full Control”>

Details of the command on TechNet:

Well..I built my own command in notepad: stsadm –o userrole –url “http://myportal/myfathersite/mysubsiteXXX” –userlogin “My Group Public” –role “Contribute”  and then copy paste to the command line in the 12 hive.  I kept receiving each time: “Command line error” message thrown by stsadm!!

The solution is actually to write the command line your own without doing paste. The reason is the possible wrong encoding of the pasted text.