There are lot of questions regarding the same mistake , What i did was :
chown -R root:www-data myfolder /
by mistake i typed a space between the folder & / . Then i was not able to do sudo any more . After following this link i was able to do sudo again . But my concern is will this going to break my system in the future ? would be there any issue in the future reboots ?
I still not closed the connected ssh as root . The server is used only as a webserver .