{"id":169,"date":"2009-03-03T19:22:15","date_gmt":"2009-03-03T08:22:15","guid":{"rendered":"http:\/\/nsrd.wordpress.com\/?p=169"},"modified":"2018-12-12T16:27:14","modified_gmt":"2018-12-12T06:27:14","slug":"basics-remote-control","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2009\/03\/03\/basics-remote-control\/","title":{"rendered":"Basics &#8211; Remote Control"},"content":{"rendered":"<p>I learned this technique several years ago before NetWorker supported running an nsrjb command from the backup server to manipulate a jukebox on a storage node. (Previously it had required that actual nsrjb commands, when run from the command line, be run from the owner of the jukebox.)<\/p>\n<p>While you don&#8217;t need it any more to control remote jukeboxes, it can still be useful to know how to do remote control operations in NetWorker \u2013 particularly if you&#8217;re say, debugging backups on a client but you don&#8217;t have console access to that client.<\/p>\n<p>Note that this <em>only<\/em> applies to commands that obey the following restrictions:<\/p>\n<ul>\n<li>Name starts with &#8220;nsr&#8221; or &#8220;save&#8221;<\/li>\n<li>Resides in the same directory as the &#8220;save&#8221; command on the client.<\/li>\n<\/ul>\n<p>Thus, this isn&#8217;t about remote hijacking of a NetWorker client. Such commands can only be executed by an authorised administrator on the backup server as specified in the nsr\/servers file. Before you (quite rightly) point out that it would mean that a valid NetWorker administrator <em>could<\/em> in fact hijack a client by say, doing a directed recovery out to that client of an appropriately named file, <em>they can do that already \u2013 that&#8217;s part of the trust relationship of the NetWorker administrator anyway<\/em>.<\/p>\n<p>So, with all those caveats out of the way, it&#8217;s remarkably simple. Going from a Unix host, you do the following:<\/p>\n<pre># export RUSER=&lt;user&gt;\n# export RCMD=&lt;cmd&gt;\n# nsrexec -c &lt;client&gt;<\/pre>\n<p>Where:<\/p>\n<ul>\n<li>user will typically be &#8220;root&#8221; or &#8220;administrator&#8221;, depending on whether your backup server is Unix or Windows.<\/li>\n<li>cmd will be a NetWorker command you want executed.<\/li>\n<li>clientName is the name of the client the command is to be executed from.<\/li>\n<\/ul>\n<p>For instance, say I&#8217;ve got a NetWorker server called &#8220;nox&#8221;, and a client called &#8220;asgard&#8221; that I don&#8217;t have administrative login to, but I want to simulate a backup without firing up a savegroup. To do so, I could do the following:<\/p>\n<pre># export RUSER=root\n# export RCMD=\"save -e tomorrow -b Default -LL -q -s nox \/tmp\"\n# nsrexec -c asgard\nsave: \/tmp  36 MB 00:00:05     38 files\ncompleted savetime=1235278395<\/pre>\n<p>Admittedly this is not a technique you should need to know often, but it&#8217;s useful to know about.<\/p>\n<p>&#8212;<br \/>\n* You <em>do<\/em> populate your nsr\/servers file, don&#8217;t you? If you don&#8217;t, go do it <em><strong>NOW<\/strong><\/em>. I mean it, stop what you&#8217;re doing, go and fix up the nsr\/servers file on every client in your environment!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I learned this technique several years ago before NetWorker supported running an nsrjb command from the backup server to manipulate&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[6,20],"tags":[1243,659],"class_list":["post-169","post","type-post","status-publish","format-standard","hentry","category-basics","category-scripting","tag-basics","tag-nsrexec"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-2J","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":1,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"predecessor-version":[{"id":7680,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions\/7680"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}