{"id":451,"date":"2014-11-16T02:01:14","date_gmt":"2014-11-16T02:01:14","guid":{"rendered":"http:\/\/www.tech-g.com\/?p=451"},"modified":"2019-03-24T17:24:13","modified_gmt":"2019-03-24T17:24:13","slug":"changing-the-root-password-in-an-lxc-container","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2014\/11\/16\/changing-the-root-password-in-an-lxc-container\/","title":{"rendered":"Changing the root password in an LXC container"},"content":{"rendered":"<p>If you forget your LXC container&#8217;s password, you can reset it from within the LXC host<\/p>\n<p>1- chroot into the containers filesystem<br \/>\nchroot \/var\/lib\/lxc\/vm51\/rootfs<\/p>\n<p>2- issue the passwd command and enter the new password for the container<\/p>\n<p>3- type exit to get back to the LXC host prompt<\/p>\n<p>&nbsp;<\/p>\n<p>Another way is to simply fire the container up, then run<\/p>\n<pre><code>lxc-attach -n vm51<\/code><\/pre>\n<p>then execute the passwd command like you normally do, then the exit command<\/p>\n<p>It is very important to understand that if you don&#8217;t have something such as fail2ban on your server, it could be that someone had bruit-forced into your container and changed the root password, in that case, i would completely recommend deleting the whole container and re-creating it from scratch<\/p>\n<p>The reason is that we don&#8217;t know what the attacker (if any) had installed inside the system<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you forget your LXC container&#8217;s password, you can reset it from within the LXC host 1- chroot into the containers filesystem chroot \/var\/lib\/lxc\/vm51\/rootfs 2- issue the passwd command and enter the new password for the container 3- type exit to get back to the LXC host prompt &nbsp; Another way is to simply fire [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-451","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=451"}],"version-history":[{"count":3,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":843,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/451\/revisions\/843"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}