dir khadijeh,i thank your problem in authentication, i mean you must run you code under the admin user ( go to terminal write su then enter then write your password and put your code in ns2 and now can you make and compiler your code ) if you need any thank to ask feel free.
muntadher isam