I have setup-ed key based ssh authentication to all my hosts for root user. However, for example if i want to change the background of all the users (not the root user, different user account) how to change it. Is it possible to change the user while running the script? So that i will be able to change the wallpapers of all clients in different user account.
It depends on what you want to do exactly. Use sudo to run a command as another user.
You can call a script from ~/.bashrc or gnome-session-properties
You can set a default icon set / background for all users in /usr/share/gconf/defaults
The settings (for ubuntu 12.04) are in
Change the path to a new background image
You can also use dconf and gconf from the command line.