{"id":2919,"date":"2025-04-04T19:47:44","date_gmt":"2025-04-05T00:47:44","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=2919"},"modified":"2025-04-04T19:47:56","modified_gmt":"2025-04-05T00:47:56","slug":"changing-ubiquiti-radio-password-from-command-line","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/changing-ubiquiti-radio-password-from-command-line\/","title":{"rendered":"Changing Ubiquiti Radio password from Command Line"},"content":{"rendered":"\n<p>Most configuration changes to Ubiquiti radios can be done on the command line by modifing them in <code>\/tmp\/system.cfg<\/code> and then applying the configuration.  The device password is a little more complicated.  The password is in the <code>system.cfg<\/code> config file, but it is hashed.  To change the password, we must change the password via ssh, then update the config password hash to match the hash in \/etc\/passwd.<\/p>\n\n\n\n<p>We&#8217;ll cover two ways to update the password for a Ubiquiti radio.  The first method uses the UBNTMOD script.  The second shows a more hands on approach. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method 1: Using the UBNTMOD script.<\/h2>\n\n\n\n<p>Download the UBNTMOD script and make it executable.<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code lang=\"bash\" class=\"language-bash\">wget http:\/\/incredigeek.com\/home\/downloads\/ubntmod\/ubntmod.sh\nchmod u+x ubntmod.sh\n.\/ubntmod.sh -y 'ubnt,ubnt' -p 'newpassword' -i 192.168.1.20 -z<\/code><\/pre>\n\n\n\n<p>-y is the current username and password pair<br>-p is the new password<br>-i is the radio IP<br>-z saves the changes without rebooting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method 2: Changing password over SSH<\/h2>\n\n\n\n<p>To change the password we need to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSH to the radio<\/li>\n\n\n\n<li>Change the current password with <code>passwd<\/code><\/li>\n\n\n\n<li>Copy the hash from <code>\/etc\/passwd<\/code> to <code>\/tmp\/system.cfg<\/code><\/li>\n\n\n\n<li>Save changes with <code>\/usr\/etc\/rc.d\/rc.softrestart save<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">SSH into radio<\/h2>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code class=\"\">ssh ubnt@192.168.1.20<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Change the Password with passwd<\/strong><\/h2>\n\n\n\n<p>passwd is the default utility to change the password for a user.  Simply run passwd and follow the prompts<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code class=\"\">XW.v6.1.12# passwd\nChanging password for ubnt\nNew password: <strong>&lt;-- Enter password here<\/strong>\nRetype password: <strong>&lt;-- Reenter password here<\/strong>\nPassword for ubnt changed by ubnt\nXW.v6.1.12# <\/code><\/pre>\n\n\n\n<p>\u2139\ufe0fOnce you change the password with passwd, the password will change, but it wont be permanently saved until we copy the hash and then apply the change.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Copy Password hash to system.cfg<\/h2>\n\n\n\n<p>We can get the new password hash with<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code class=\"\">cat \/etc\/passwd<\/code><\/pre>\n\n\n\n<p>Example output:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code class=\"\">admin:$1$QESek5FH$FUPpzbPbAvf0NUbYyJMj21:0:0:Administrator:\/etc\/persistent:\/bin\/sh<\/code><\/pre>\n\n\n\n<p>The section between the first and second colon, i.e., the two dots, &#8220;:&#8221;, is our hashed password.  This is what we need to copy into the system.cfg config.<\/p>\n\n\n\n<p>Edit the config file<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code class=\"\">vi \/tmp\/system.cfg<\/code><\/pre>\n\n\n\n<p>Find the line that starts with <code>users.1.password=<\/code> and replace everything after the equals sign with our new hash.  For example:<\/p>\n\n\n\n<pre class=\"wp-block-code has-dark-gray-background-color has-background\"><code class=\"\">users.1.password=$1$QESek5FH$FUPpzbPbAvf0NUbYyJMj21<\/code><\/pre>\n\n\n\n<p>\u2139\ufe0fVI can be a little tricky to deal with, you can hit i, to enter insert mode, delete everything after the =, and then right click with your mouse to paste in the password hash.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Apply the new Password Permanently<\/h2>\n\n\n\n<p>Save the changes with <code>\/usr\/etc\/rc.d\/rc.softrestart save<\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">XW.v6.1.12# \/usr\/etc\/rc.d\/rc.softrestart save <br>--- \/tmp\/.running.cfg.919<br>+++ \/tmp\/.system.cfg.919<br>@@ -81,7 +81,7 @@<br> system.cfg.version=65546<br> system.eirp.status=disabled<br> users.1.name=ubnt<br>-users.1.password=$1$5FJMj2H$FbkP6UAb8yvfES0NUbPpzbQ <strong>&lt;- Old Password Hash<\/strong><br>+users.1.password=$1$QESek5FH$FUPpzbPbAvf0NUbYyJMj21 <strong>&lt;- New Password Hash<\/strong><br> users.1.status=enabled<br> users.status=enabled<br> wireless.1.addmtikie=enabled<br>Fast users script build Success.<br>Fixup Startup_list \u2026Done.<br>XW.v6.1.12# <\/pre>\n\n\n\n<p>\u2139\ufe0fYour existing ssh connection should stay connected which can be handy if something did not work correctly. Launch another terminal, or log in the web interface, to verify that the new password works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most configuration changes to Ubiquiti radios can be done on the command line by modifing them in \/tmp\/system.cfg and then applying the configuration. The device password is a little more complicated. The password is in the system.cfg config file, but &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/changing-ubiquiti-radio-password-from-command-line\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[129,1144],"tags":[889,528,8,7,1725,200,503,221,131,974],"class_list":["post-2919","post","type-post","status-publish","format-standard","hentry","category-ubiquiti","category-ubiquiti-command-line","tag-airfiber","tag-airmax","tag-command-line-2","tag-linux-2","tag-ltu","tag-password","tag-security","tag-ssh","tag-ubiquiti-2","tag-ui"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=2919"}],"version-history":[{"count":2,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2919\/revisions"}],"predecessor-version":[{"id":5971,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/2919\/revisions\/5971"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=2919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=2919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=2919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}