<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.completenoobs.com/noobs/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Noob</id>
	<title>CompleteNoobs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.completenoobs.com/noobs/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Noob"/>
	<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/Special:Contributions/Noob"/>
	<updated>2026-04-30T02:23:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=742</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=742"/>
		<updated>2026-04-19T20:37:20Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* just wish us well, that would do: else;&lt;br /&gt;
&lt;br /&gt;
Bitcoin: &amp;quot;19S2thMqbYhwB6doLYQamStkzEyuqZs5Yn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Hive: cnoobs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
* https://www.vultr.com/?ref=7704739&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Nine_Quite_Simple_Things_You_Can_Do_To_Save_Lots_Of_Time_With_Prossylki&amp;diff=733</id>
		<title>Nine Quite Simple Things You Can Do To Save Lots Of Time With Prossylki</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Nine_Quite_Simple_Things_You_Can_Do_To_Save_Lots_Of_Time_With_Prossylki&amp;diff=733"/>
		<updated>2026-04-17T00:34:21Z</updated>

		<summary type="html">&lt;p&gt;Noob: Replaced content with &amp;quot;Any chance you can write up a reproducable tut on how you do this?&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Any chance you can write up a reproducable tut on how you do this?&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=647</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=647"/>
		<updated>2025-08-29T10:23:28Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Bitcoin: &amp;quot;19S2thMqbYhwB6doLYQamStkzEyuqZs5Yn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Eos: completenoob&lt;br /&gt;
&lt;br /&gt;
Hive: completenoobs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
* https://www.vultr.com/?ref=7704739&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=646</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=646"/>
		<updated>2025-08-29T10:23:13Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Bitcoin: &amp;quot;19S2thMqbYhwB6doLYQamStkzEyuqZs5Yn&amp;quot;&lt;br /&gt;
Eos: completenoob&lt;br /&gt;
Hive: completenoobs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
* https://www.vultr.com/?ref=7704739&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=645</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=645"/>
		<updated>2025-08-29T09:13:50Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Bitcoin: &amp;quot;19S2thMqbYhwB6doLYQamStkzEyuqZs5Yn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
* https://www.vultr.com/?ref=7704739&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=User:MeganTober&amp;diff=633</id>
		<title>User:MeganTober</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=User:MeganTober&amp;diff=633"/>
		<updated>2025-08-03T23:47:48Z</updated>

		<summary type="html">&lt;p&gt;Noob: Replaced content with &amp;quot;Spam bot&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Spam bot&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=User:HumbertoRoney&amp;diff=613</id>
		<title>User:HumbertoRoney</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=User:HumbertoRoney&amp;diff=613"/>
		<updated>2025-07-10T13:59:17Z</updated>

		<summary type="html">&lt;p&gt;Noob: Replaced content with &amp;quot;Bot account&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Bot account&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=605</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=605"/>
		<updated>2025-07-07T12:33:53Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Don&#039;t know what i don&#039;t know, still a noob.&amp;lt;br&amp;gt;&lt;br /&gt;
Currently poking this with a stick - any idea&#039;s?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
* https://www.vultr.com/?ref=7704739&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=594</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=594"/>
		<updated>2025-06-26T12:41:59Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* VPS services with affiliate link */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Our Mission&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At CompleteNoobs, we believe in making computer science education open, accessible, and free for everyone. Our goal is to create a comprehensive platform that provides resources, tutorials, and courseware to hobbyists, sysadmins, teachers, students, and anyone interested in the field.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How Your Support Helps&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As a one-person team, working part-time to make ends meet while developing this project, your support means a lot. Your contributions will enable us to dedicate more time and resources to CompleteNoobs, ensuring that we can create a high-quality educational platform that benefits learners worldwide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Direct Bank transfer==&lt;br /&gt;
&lt;br /&gt;
closed for now&lt;br /&gt;
&lt;br /&gt;
==PayPal==&lt;br /&gt;
&lt;br /&gt;
closed for now&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
* https://www.vultr.com/?ref=7704739&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=User_talk:NobleMage&amp;diff=559</id>
		<title>User talk:NobleMage</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=User_talk:NobleMage&amp;diff=559"/>
		<updated>2025-06-03T22:23:52Z</updated>

		<summary type="html">&lt;p&gt;Noob: Welcome!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Welcome to &#039;&#039;CompleteNoobs&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
We hope you will contribute much and well.&lt;br /&gt;
You will probably want to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages].&lt;br /&gt;
Again, welcome and have fun! [[User:Noob|Noob]] ([[User talk:Noob|talk]]) 22:23, 3 June 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=User:NobleMage&amp;diff=558</id>
		<title>User:NobleMage</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=User:NobleMage&amp;diff=558"/>
		<updated>2025-06-03T22:23:52Z</updated>

		<summary type="html">&lt;p&gt;Noob: Creating user page for new user.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;test this page please , i am not bot&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=524</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=524"/>
		<updated>2025-04-23T15:45:30Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Welcome to CompleteNoobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Site is Currently under going some changes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Page links might be broken while we restructure page titles and content, before carrying on with content creation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Welcome to CompleteNoobs=&lt;br /&gt;
&#039;&#039;A community-driven resource for computer science enthusiasts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: At present, direct signups are disabled due to bot activity. To create an account on the wiki, please request an account and message user CompleteNoobs on Reddit. Your patience is appreciated as we may not be online all the time.&lt;br /&gt;
==CompleteNoobs BlockChain Project==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;CompletNoobs Blockchain&#039;&#039;&#039;: A Value-for-Value Producer Platform&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Core Idea&#039;&#039;&#039;: A decentralized blockchain enabling creators and consumers to exchange value directly through a wiki-style system. Content is stored on-chain or via &#039;&#039;&#039;IPFS&#039;&#039;&#039;, with transparent contributions and user-driven value distribution.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Key Features&#039;&#039;&#039;:&lt;br /&gt;
** &#039;&#039;&#039;Named Accounts&#039;&#039;&#039;:&lt;br /&gt;
*** &#039;&#039;&#039;Human-readable account names&#039;&#039;&#039; (e.g., @UserName).&lt;br /&gt;
*** &#039;&#039;&#039;Public/private key pairs&#039;&#039;&#039; for security.&lt;br /&gt;
*** Optional: Separate &#039;&#039;&#039;master key&#039;&#039;&#039; (for account control) and &#039;&#039;&#039;posting key&#039;&#039;&#039; (for content submission), inspired by EOS/BitShares for safer key management.&lt;br /&gt;
** &#039;&#039;&#039;Decentralized Wiki&#039;&#039;&#039;:&lt;br /&gt;
*** &#039;&#039;&#039;Text Content&#039;&#039;&#039;: Wiki pages stored directly on the blockchain.&lt;br /&gt;
*** &#039;&#039;&#039;Media Content&#039;&#039;&#039;: Images, videos, audio, and source code stored as &#039;&#039;&#039;IPFS hashes&#039;&#039;&#039;. Browser extensions can fetch and display this content.&lt;br /&gt;
*** &#039;&#039;&#039;Page Metadata&#039;&#039;&#039;: Tracks contributors, edit history (diffs), and links to original sources or &#039;&#039;&#039;IPFS hashes&#039;&#039;&#039;.&lt;br /&gt;
** &#039;&#039;&#039;Value-for-Value System&#039;&#039;&#039;:&lt;br /&gt;
*** &#039;&#039;&#039;User Ratings&#039;&#039;&#039;: Users with &#039;&#039;&#039;producer wallets&#039;&#039;&#039; rate pages (0–10) based on value received.&lt;br /&gt;
*** &#039;&#039;&#039;Donations&#039;&#039;&#039;: Users fund a &#039;&#039;&#039;drop/share wallet&#039;&#039;&#039; with crypto (e.g., project coin, Bitcoin, or Lightning Network).&lt;br /&gt;
*** &#039;&#039;&#039;Fund Splitting&#039;&#039;&#039;: At a set time/date, funds from the &#039;&#039;&#039;drop/share wallet&#039;&#039;&#039; are split among pages based on ratings. Each page’s funds are further split among its contributors.&lt;br /&gt;
*** &#039;&#039;&#039;User Control&#039;&#039;&#039;: Users can override suggested splits to decide which contributors receive funds (or none).&lt;br /&gt;
** &#039;&#039;&#039;Contributor Rewards&#039;&#039;&#039;:&lt;br /&gt;
*** Each contributor has a &#039;&#039;&#039;crypto address&#039;&#039;&#039; (project coin, Bitcoin, or Lightning) to receive donations or split funds.&lt;br /&gt;
*** Suggested splits per page, but users have final say on distribution.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Goal&#039;&#039;&#039;: Empower creators to produce valuable content and let users reward them directly, with full transparency and control, on a decentralized platform.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[N33Bcoin| Currently learning more about the genesis of blockchain projects, Bitcoin.]]&lt;br /&gt;
** https://www.completenoobs.com/noobs/N33Bcoin&lt;br /&gt;
&lt;br /&gt;
==We All Start as Noobs==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Greetings, fellow Noobs.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs is currently in its concept stage, and we are learning as we go. Use the resources provided at your own risk.&lt;br /&gt;
&lt;br /&gt;
Our mission is to make computer science free, open, and reproducible for hobbyists, sysadmins, teachers, students, and anyone interested in the field. CompleteNoobs is a platform to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips acquired along the way, under a Libre License that ensures the following freedoms:&lt;br /&gt;
&lt;br /&gt;
:*    Read&lt;br /&gt;
:*    Edit/Modify&lt;br /&gt;
:*    Copy&lt;br /&gt;
:*    Share freely&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Content licensed under &#039;&#039;&#039;CC BY-NC-SA&#039;&#039;&#039; can be hosted on the non-commercial fork: https://www.completenoobz.com [[https://www.completenoobs.com/noobs/DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate| Example Content of CompleteNoobz]]&lt;br /&gt;
&lt;br /&gt;
The only proprietary aspects of this site are the domain and the trademark &#039;CompleteNoobs&#039;. All content is available for download as an XML file at https://xml.completenoobs.com and is Libre licensed for everyone to use.&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmPyUVTQa7gk8kueAnjNDtEReKZ8NnwvFLWv66aCVrq4dy&lt;br /&gt;
&lt;br /&gt;
==Get Involved==&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project, download it, and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
:* [[Host_Your_Own_Mediawiki_Online|Host Your Own Mediawiki Online]]&lt;br /&gt;
&lt;br /&gt;
:* [[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
===Feed Back Received===&lt;br /&gt;
&lt;br /&gt;
*    Clearly indicate the terminal where commands should be entered&lt;br /&gt;
*    Break down content into smaller sections or modules&lt;br /&gt;
*    Provide timestamps in videos for each executed command or step&lt;br /&gt;
*    Organize steps/modules using numbers, and sub-steps within modules using letters (a, b, c, etc.)&lt;br /&gt;
*    Create shorter, focused videos for each step to avoid excessive scrolling&lt;br /&gt;
*    Clarify the use of terminal editors and how to set the $EDITOR variable&lt;br /&gt;
*    Place the EDITOR section at the top of the page and link to nano and vi guide pages&lt;br /&gt;
*    Include instructions on how to verify the completion of each step correctly&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Title Syntax: Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&lt;br /&gt;
Due to varying configurations and builds of apps/programs across different OS versions, step-by-step tutorials can be challenging to follow. To improve navigation, adjust page titles to include both the OS version/name and the software used. This will account for changes across different versions.&lt;br /&gt;
&lt;br /&gt;
Example of a re-structured title: &amp;quot;Windows 10 Pro - Adobe Photoshop CC 2021 Tutorial&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If its a small change from each version, fork page to version and make small change.&amp;lt;br&amp;gt;&lt;br /&gt;
If no change, still fork page to new title!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Essential Links==&lt;br /&gt;
:*   [[Ubuntu_Cert_Draft|Ubuntu Cert Course &#039;&#039;&#039;DRAFTING&#039;&#039;&#039;]]&lt;br /&gt;
:*   [[SET$EDITOR|Set $EDITOR]]&lt;br /&gt;
:*   [[Main_Index | Main Index Page]]&lt;br /&gt;
:*   [[Special:AllPages | All Pages]]&lt;br /&gt;
:*   [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
:*   [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
==Data-Heavy Content==&lt;br /&gt;
To maintain a lightweight XML file, data-heavy content such as pictures, audio, and video can be linked using IPFS and/or Zeronet hashes.&lt;br /&gt;
&lt;br /&gt;
[[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IPFS Browser Extensions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Firefox&#039;&#039;&#039;: https://addons.mozilla.org/en-GB/firefox/addon/ipfs-companion/&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Brave&#039;&#039;&#039;: brave://settings/ipfs and toggle on &amp;quot;IPFS Companion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Basic_Syntax#Youtube_extension_-_Embed_Video|Youtube Embedded Videos also work.]]&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS | Add a license to each page, as long as it adheres to the principles of free copying, modification, and distribution.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=N33Bcoin&amp;diff=523</id>
		<title>N33Bcoin</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=N33Bcoin&amp;diff=523"/>
		<updated>2025-04-21T23:49:27Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Todo */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;n33bcoin is a very light fork of bitcoin 0.14.3 code base, so we can learn more about bitcoin by doing (without losing/risking your bitcoin)&lt;br /&gt;
&lt;br /&gt;
Bitcoin is one of the grestest open source projects of are time and should come with a free and open education project to go along side it.&lt;br /&gt;
&lt;br /&gt;
Buying and losing bitcoin can be expensive. But thanks to bitcoin being free and open source software, learning about bitcoin by creating and playing with your very own fork is not. Can be done solo or with friends, family, and everyone else.&lt;br /&gt;
&lt;br /&gt;
Can create and run your coin on hardware that costs less than £100.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* N33Bcoin 0.0.1 - How to create your own coin by forking bitcoin 0.14.3 code base.&lt;br /&gt;
** https://www.completenoobs.com/noobs/N33Bcoin_0.0.1&lt;br /&gt;
&lt;br /&gt;
* Run n33bcoin on windows - using virtualbox&lt;br /&gt;
** https://www.completenoobs.com/noobs/Windows_10_VirtualBox_N33Bcoin&lt;br /&gt;
&lt;br /&gt;
* Create your own cold storage address &lt;br /&gt;
** https://www.completenoobs.com/noobs/N33Bcoin_Address_Generator_Bitcoin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Todo===&lt;br /&gt;
&lt;br /&gt;
* Explorer&lt;br /&gt;
* Mining Pool&lt;br /&gt;
* GUI Wallet&lt;br /&gt;
* Exchange contacts&lt;br /&gt;
* Lightning n33bcoin&lt;br /&gt;
* How does bitcoin software get updated&lt;br /&gt;
* 51% mining attact&lt;br /&gt;
* Can someone take over bitcoin and increase coin supply?&lt;br /&gt;
* snapshot blockchain and move to POS and/or DPOS&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Local_CompleteNoobs_Wiki&amp;diff=474</id>
		<title>Local CompleteNoobs Wiki</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Local_CompleteNoobs_Wiki&amp;diff=474"/>
		<updated>2025-02-16T23:40:47Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;CompleteNoobs Wiki [[Nginx_Server_For_Hosting_Files_Ubuntu_22.04|XML Dumps]] can be found at &amp;lt;nowiki&amp;gt;https://xml.completenoobs.com&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Ubuntu_Local_Wiki_Import | Ubuntu Import Wiki to Local]]&lt;br /&gt;
&lt;br /&gt;
[[Windows_10_Local_Wiki_Import | Windows 10 Import Local Wiki]]&lt;br /&gt;
&lt;br /&gt;
[[FreeBSD_13.2_Jail_Local_Mediawiki_Nginx_MySQL | FreeBSD Jail]]&lt;br /&gt;
&lt;br /&gt;
[[CompleteNoobs_Local_Wiki_In_Docker | Docker ]]&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=473</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=473"/>
		<updated>2025-02-16T23:33:59Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* We All Start as Noobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Site is Currently under going some changes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Page links might be broken while we restructure page titles and content, before carrying on with content creation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Welcome to CompleteNoobs=&lt;br /&gt;
&#039;&#039;A community-driven resource for computer science enthusiasts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: At present, direct signups are disabled due to bot activity. To create an account on the wiki, please request an account and message user CompleteNoobs on Reddit. Your patience is appreciated as we may not be online all the time.&lt;br /&gt;
&lt;br /&gt;
==We All Start as Noobs==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Greetings, fellow Noobs.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs is currently in its concept stage, and we are learning as we go. Use the resources provided at your own risk.&lt;br /&gt;
&lt;br /&gt;
Our mission is to make computer science free, open, and reproducible for hobbyists, sysadmins, teachers, students, and anyone interested in the field. CompleteNoobs is a platform to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips acquired along the way, under a Libre License that ensures the following freedoms:&lt;br /&gt;
&lt;br /&gt;
:*    Read&lt;br /&gt;
:*    Edit/Modify&lt;br /&gt;
:*    Copy&lt;br /&gt;
:*    Share freely&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Content licensed under &#039;&#039;&#039;CC BY-NC-SA&#039;&#039;&#039; can be hosted on the non-commercial fork: https://www.completenoobz.com [[https://www.completenoobs.com/noobs/DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate| Example Content of CompleteNoobz]]&lt;br /&gt;
&lt;br /&gt;
The only proprietary aspects of this site are the domain and the trademark &#039;CompleteNoobs&#039;. All content is available for download as an XML file at https://xml.completenoobs.com and is Libre licensed for everyone to use.&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmPyUVTQa7gk8kueAnjNDtEReKZ8NnwvFLWv66aCVrq4dy&lt;br /&gt;
&lt;br /&gt;
==Get Involved==&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project, download it, and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
:* [[Host_Your_Own_Mediawiki_Online|Host Your Own Mediawiki Online]]&lt;br /&gt;
&lt;br /&gt;
:* [[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
===Feed Back Received===&lt;br /&gt;
&lt;br /&gt;
*    Clearly indicate the terminal where commands should be entered&lt;br /&gt;
*    Break down content into smaller sections or modules&lt;br /&gt;
*    Provide timestamps in videos for each executed command or step&lt;br /&gt;
*    Organize steps/modules using numbers, and sub-steps within modules using letters (a, b, c, etc.)&lt;br /&gt;
*    Create shorter, focused videos for each step to avoid excessive scrolling&lt;br /&gt;
*    Clarify the use of terminal editors and how to set the $EDITOR variable&lt;br /&gt;
*    Place the EDITOR section at the top of the page and link to nano and vi guide pages&lt;br /&gt;
*    Include instructions on how to verify the completion of each step correctly&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Title Syntax: Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&lt;br /&gt;
Due to varying configurations and builds of apps/programs across different OS versions, step-by-step tutorials can be challenging to follow. To improve navigation, adjust page titles to include both the OS version/name and the software used. This will account for changes across different versions.&lt;br /&gt;
&lt;br /&gt;
Example of a re-structured title: &amp;quot;Windows 10 Pro - Adobe Photoshop CC 2021 Tutorial&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If its a small change from each version, fork page to version and make small change.&amp;lt;br&amp;gt;&lt;br /&gt;
If no change, still fork page to new title!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Essential Links==&lt;br /&gt;
:*   [[Ubuntu_Cert_Draft|Ubuntu Cert Course &#039;&#039;&#039;DRAFTING&#039;&#039;&#039;]]&lt;br /&gt;
:*   [[SET$EDITOR|Set $EDITOR]]&lt;br /&gt;
:*   [[Main_Index | Main Index Page]]&lt;br /&gt;
:*   [[Special:AllPages | All Pages]]&lt;br /&gt;
:*   [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
:*   [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
==Data-Heavy Content==&lt;br /&gt;
To maintain a lightweight XML file, data-heavy content such as pictures, audio, and video can be linked using IPFS and/or Zeronet hashes.&lt;br /&gt;
&lt;br /&gt;
[[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IPFS Browser Extensions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Firefox&#039;&#039;&#039;: https://addons.mozilla.org/en-GB/firefox/addon/ipfs-companion/&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Brave&#039;&#039;&#039;: brave://settings/ipfs and toggle on &amp;quot;IPFS Companion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Basic_Syntax#Youtube_extension_-_Embed_Video|Youtube Embedded Videos also work.]]&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS | Add a license to each page, as long as it adheres to the principles of free copying, modification, and distribution.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=472</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=472"/>
		<updated>2025-02-16T23:32:22Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* We All Start as Noobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Site is Currently under going some changes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Page links might be broken while we restructure page titles and content, before carrying on with content creation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Welcome to CompleteNoobs=&lt;br /&gt;
&#039;&#039;A community-driven resource for computer science enthusiasts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: At present, direct signups are disabled due to bot activity. To create an account on the wiki, please request an account and message user CompleteNoobs on Reddit. Your patience is appreciated as we may not be online all the time.&lt;br /&gt;
&lt;br /&gt;
==We All Start as Noobs==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Greetings, fellow Noobs.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs is currently in its concept stage, and we are learning as we go. Use the resources provided at your own risk.&lt;br /&gt;
&lt;br /&gt;
Our mission is to make computer science free, open, and reproducible for hobbyists, sysadmins, teachers, students, and anyone interested in the field. CompleteNoobs is a platform to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips acquired along the way, under a Libre License that ensures the following freedoms:&lt;br /&gt;
&lt;br /&gt;
:*    Read&lt;br /&gt;
:*    Edit/Modify&lt;br /&gt;
:*    Copy&lt;br /&gt;
:*    Share freely&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Content licensed under &#039;&#039;&#039;CC BY-NC-SA&#039;&#039;&#039; can be hosted on the non-commercial fork: https://www.completenoobz.com [[https://www.completenoobs.com/noobs/DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate|Example_Content]]&lt;br /&gt;
&lt;br /&gt;
The only proprietary aspects of this site are the domain and the trademark &#039;CompleteNoobs&#039;. All content is available for download as an XML file at https://xml.completenoobs.com and is Libre licensed for everyone to use.&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmPyUVTQa7gk8kueAnjNDtEReKZ8NnwvFLWv66aCVrq4dy&lt;br /&gt;
&lt;br /&gt;
==Get Involved==&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project, download it, and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
:* [[Host_Your_Own_Mediawiki_Online|Host Your Own Mediawiki Online]]&lt;br /&gt;
&lt;br /&gt;
:* [[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
===Feed Back Received===&lt;br /&gt;
&lt;br /&gt;
*    Clearly indicate the terminal where commands should be entered&lt;br /&gt;
*    Break down content into smaller sections or modules&lt;br /&gt;
*    Provide timestamps in videos for each executed command or step&lt;br /&gt;
*    Organize steps/modules using numbers, and sub-steps within modules using letters (a, b, c, etc.)&lt;br /&gt;
*    Create shorter, focused videos for each step to avoid excessive scrolling&lt;br /&gt;
*    Clarify the use of terminal editors and how to set the $EDITOR variable&lt;br /&gt;
*    Place the EDITOR section at the top of the page and link to nano and vi guide pages&lt;br /&gt;
*    Include instructions on how to verify the completion of each step correctly&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Title Syntax: Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&lt;br /&gt;
Due to varying configurations and builds of apps/programs across different OS versions, step-by-step tutorials can be challenging to follow. To improve navigation, adjust page titles to include both the OS version/name and the software used. This will account for changes across different versions.&lt;br /&gt;
&lt;br /&gt;
Example of a re-structured title: &amp;quot;Windows 10 Pro - Adobe Photoshop CC 2021 Tutorial&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If its a small change from each version, fork page to version and make small change.&amp;lt;br&amp;gt;&lt;br /&gt;
If no change, still fork page to new title!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Essential Links==&lt;br /&gt;
:*   [[Ubuntu_Cert_Draft|Ubuntu Cert Course &#039;&#039;&#039;DRAFTING&#039;&#039;&#039;]]&lt;br /&gt;
:*   [[SET$EDITOR|Set $EDITOR]]&lt;br /&gt;
:*   [[Main_Index | Main Index Page]]&lt;br /&gt;
:*   [[Special:AllPages | All Pages]]&lt;br /&gt;
:*   [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
:*   [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
==Data-Heavy Content==&lt;br /&gt;
To maintain a lightweight XML file, data-heavy content such as pictures, audio, and video can be linked using IPFS and/or Zeronet hashes.&lt;br /&gt;
&lt;br /&gt;
[[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IPFS Browser Extensions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Firefox&#039;&#039;&#039;: https://addons.mozilla.org/en-GB/firefox/addon/ipfs-companion/&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Brave&#039;&#039;&#039;: brave://settings/ipfs and toggle on &amp;quot;IPFS Companion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Basic_Syntax#Youtube_extension_-_Embed_Video|Youtube Embedded Videos also work.]]&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS | Add a license to each page, as long as it adheres to the principles of free copying, modification, and distribution.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=471</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=471"/>
		<updated>2025-02-16T23:31:57Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* We All Start as Noobs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Site is Currently under going some changes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Page links might be broken while we restructure page titles and content, before carrying on with content creation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Welcome to CompleteNoobs=&lt;br /&gt;
&#039;&#039;A community-driven resource for computer science enthusiasts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: At present, direct signups are disabled due to bot activity. To create an account on the wiki, please request an account and message user CompleteNoobs on Reddit. Your patience is appreciated as we may not be online all the time.&lt;br /&gt;
&lt;br /&gt;
==We All Start as Noobs==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Greetings, fellow Noobs.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs is currently in its concept stage, and we are learning as we go. Use the resources provided at your own risk.&lt;br /&gt;
&lt;br /&gt;
Our mission is to make computer science free, open, and reproducible for hobbyists, sysadmins, teachers, students, and anyone interested in the field. CompleteNoobs is a platform to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips acquired along the way, under a Libre License that ensures the following freedoms:&lt;br /&gt;
&lt;br /&gt;
:*    Read&lt;br /&gt;
:*    Edit/Modify&lt;br /&gt;
:*    Copy&lt;br /&gt;
:*    Share freely&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Content licensed under &#039;&#039;&#039;CC BY-NC-SA&#039;&#039;&#039; can be hosted on the non-commercial fork: https://www.completenoobz.com [[https://www.completenoobs.com/noobs/DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate|Example Content]]&lt;br /&gt;
&lt;br /&gt;
The only proprietary aspects of this site are the domain and the trademark &#039;CompleteNoobs&#039;. All content is available for download as an XML file at https://xml.completenoobs.com and is Libre licensed for everyone to use.&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmPyUVTQa7gk8kueAnjNDtEReKZ8NnwvFLWv66aCVrq4dy&lt;br /&gt;
&lt;br /&gt;
==Get Involved==&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project, download it, and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
:* [[Host_Your_Own_Mediawiki_Online|Host Your Own Mediawiki Online]]&lt;br /&gt;
&lt;br /&gt;
:* [[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
===Feed Back Received===&lt;br /&gt;
&lt;br /&gt;
*    Clearly indicate the terminal where commands should be entered&lt;br /&gt;
*    Break down content into smaller sections or modules&lt;br /&gt;
*    Provide timestamps in videos for each executed command or step&lt;br /&gt;
*    Organize steps/modules using numbers, and sub-steps within modules using letters (a, b, c, etc.)&lt;br /&gt;
*    Create shorter, focused videos for each step to avoid excessive scrolling&lt;br /&gt;
*    Clarify the use of terminal editors and how to set the $EDITOR variable&lt;br /&gt;
*    Place the EDITOR section at the top of the page and link to nano and vi guide pages&lt;br /&gt;
*    Include instructions on how to verify the completion of each step correctly&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Title Syntax: Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&lt;br /&gt;
Due to varying configurations and builds of apps/programs across different OS versions, step-by-step tutorials can be challenging to follow. To improve navigation, adjust page titles to include both the OS version/name and the software used. This will account for changes across different versions.&lt;br /&gt;
&lt;br /&gt;
Example of a re-structured title: &amp;quot;Windows 10 Pro - Adobe Photoshop CC 2021 Tutorial&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If its a small change from each version, fork page to version and make small change.&amp;lt;br&amp;gt;&lt;br /&gt;
If no change, still fork page to new title!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Essential Links==&lt;br /&gt;
:*   [[Ubuntu_Cert_Draft|Ubuntu Cert Course &#039;&#039;&#039;DRAFTING&#039;&#039;&#039;]]&lt;br /&gt;
:*   [[SET$EDITOR|Set $EDITOR]]&lt;br /&gt;
:*   [[Main_Index | Main Index Page]]&lt;br /&gt;
:*   [[Special:AllPages | All Pages]]&lt;br /&gt;
:*   [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
:*   [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
==Data-Heavy Content==&lt;br /&gt;
To maintain a lightweight XML file, data-heavy content such as pictures, audio, and video can be linked using IPFS and/or Zeronet hashes.&lt;br /&gt;
&lt;br /&gt;
[[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IPFS Browser Extensions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Firefox&#039;&#039;&#039;: https://addons.mozilla.org/en-GB/firefox/addon/ipfs-companion/&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Brave&#039;&#039;&#039;: brave://settings/ipfs and toggle on &amp;quot;IPFS Companion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Basic_Syntax#Youtube_extension_-_Embed_Video|Youtube Embedded Videos also work.]]&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS | Add a license to each page, as long as it adheres to the principles of free copying, modification, and distribution.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=00000000_Main_Page_Local&amp;diff=470</id>
		<title>00000000 Main Page Local</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=00000000_Main_Page_Local&amp;diff=470"/>
		<updated>2025-02-16T23:24:56Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;The Page is designated to be the default main page for local wiki installs - any ideas welcome on how to struture this page.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= CompleteNoobs =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Welcome to CompleteNoobs!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We are a community of computer science enthusiasts who believe in making knowledge free, open, and reproducible. Whether you are a hobbyist, sysadmin, teacher, student, or simply interested in computer science, CompleteNoobs is a place to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips that are created or released under a Libre license that allows for the following freedoms:&lt;br /&gt;
&lt;br /&gt;
* READ.&lt;br /&gt;
* EDIT/MODIFY.&lt;br /&gt;
* COPY.&lt;br /&gt;
* SHARE FREELY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;CC BY-NC-SA&amp;lt;/b&amp;gt; licensed content can be hosted on the non-commercial fork at https://www.completenoobz.com &lt;br /&gt;
&lt;br /&gt;
To get started, request an account on the wiki and message user CompleteNoobs on Reddit. Please note that we are currently not allowing direct signups due to bots. &lt;br /&gt;
&lt;br /&gt;
== We all start as Noobs ==&lt;br /&gt;
&lt;br /&gt;
Whether you&#039;re just starting out or you&#039;re an experienced professional, we all start as noobs. This wiki is a safe space for us to learn, experiment, and grow together.&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
[[Host_Your_Own_Mediawiki_Online_-_Ubuntu|Host Your Own Mediawiki Online - Linux Ubuntu]]&amp;lt;br&amp;gt;&lt;br /&gt;
[[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
The main landing page is the &amp;lt;b&amp;gt;Main_Index&amp;lt;/b&amp;gt; Page. &lt;br /&gt;
&lt;br /&gt;
* [[Main_Index | Main Index Page]]&lt;br /&gt;
* [[Special:AllPages | All Pages]]&lt;br /&gt;
* [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
* [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
== Data-Heavy Content ==&lt;br /&gt;
&lt;br /&gt;
To keep the XML light, data-heavy content such as pictures, audio, and video can be linked with IPFS and/or Zeronet hashes. [[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project and download and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
== Licenses ==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS|Please place a license on top of each page as long as the license falls in line with free to Copy, Modify, Distribute.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=00000000_Main_Page_Local&amp;diff=469</id>
		<title>00000000 Main Page Local</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=00000000_Main_Page_Local&amp;diff=469"/>
		<updated>2025-02-16T23:23:44Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;The Page is designated to be the default main page for local wiki installs - any ideas welcome on how to struture this page.  In Concept Mode  DISCLAIMER:  he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the informa...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Page is designated to be the default main page for local wiki installs - any ideas welcome on how to struture this page.&lt;br /&gt;
&lt;br /&gt;
In Concept Mode&lt;br /&gt;
&lt;br /&gt;
DISCLAIMER:&lt;br /&gt;
&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs&lt;br /&gt;
&lt;br /&gt;
Welcome to CompleteNoobs!&lt;br /&gt;
&lt;br /&gt;
We are a community of computer science enthusiasts who believe in making knowledge free, open, and reproducible. Whether you are a hobbyist, sysadmin, teacher, student, or simply interested in computer science, CompleteNoobs is a place to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips that are created or released under a Libre license that allows for the following freedoms:&lt;br /&gt;
&lt;br /&gt;
READ.&lt;br /&gt;
EDIT/MODIFY.&lt;br /&gt;
COPY.&lt;br /&gt;
SHARE FREELY.&lt;br /&gt;
&lt;br /&gt;
CC BY-NC-SA licensed content can be hosted on the non-commercial fork at https://www.completenoobz.com&lt;br /&gt;
&lt;br /&gt;
To get started, request an account on the wiki and message user CompleteNoobs on Reddit. Please note that we are currently not allowing direct signups due to bots.&lt;br /&gt;
&lt;br /&gt;
We all start as Noobs&lt;br /&gt;
&lt;br /&gt;
Whether you&#039;re just starting out or you&#039;re an experienced professional, we all start as noobs. This wiki is a safe space for us to learn, experiment, and grow together.&lt;br /&gt;
&lt;br /&gt;
Getting Started&lt;br /&gt;
&lt;br /&gt;
Host Your Own Mediawiki Online - Linux Ubuntu&lt;br /&gt;
Download CompleteNoobs Wiki to your personal computer&lt;br /&gt;
&lt;br /&gt;
Notes&lt;br /&gt;
&lt;br /&gt;
The main landing page is the Main_Index Page.&lt;br /&gt;
&lt;br /&gt;
Main Index Page&lt;br /&gt;
All Pages&lt;br /&gt;
Basic Wiki Syntax&lt;br /&gt;
Support us by using affiliate links or by giving us donations.&lt;br /&gt;
Data-Heavy Content&lt;br /&gt;
&lt;br /&gt;
To keep the XML light, data-heavy content such as pictures, audio, and video can be linked with IPFS and/or Zeronet hashes. IPFS Basics&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project and download and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
Licenses&lt;br /&gt;
&lt;br /&gt;
Please place a license on top of each page as long as the license falls in line with free to Copy, Modify, Distribute.&lt;br /&gt;
&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
LICENCE: When you edit this page, you agree to release your contribution under the CC0 Licence&lt;br /&gt;
More information about the cc0 licence can be found here:&lt;br /&gt;
https://creativecommons.org/share-your-work/public-domain/cc0&lt;br /&gt;
&lt;br /&gt;
Over View&lt;br /&gt;
&lt;br /&gt;
   The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law.&lt;br /&gt;
&lt;br /&gt;
   You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.&lt;br /&gt;
&lt;br /&gt;
Licence:&lt;br /&gt;
&lt;br /&gt;
Statement of Purpose&lt;br /&gt;
&lt;br /&gt;
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an &amp;quot;owner&amp;quot;) of an original work of authorship and/or a database (each, a &amp;quot;Work&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works (&amp;quot;Commons&amp;quot;) that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.&lt;br /&gt;
&lt;br /&gt;
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the &amp;quot;Affirmer&amp;quot;), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.&lt;br /&gt;
&lt;br /&gt;
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (&amp;quot;Copyright and Related Rights&amp;quot;). Copyright and Related Rights include, but are not limited to, the following:&lt;br /&gt;
&lt;br /&gt;
   the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;&lt;br /&gt;
   moral rights retained by the original author(s) and/or performer(s);&lt;br /&gt;
   publicity and privacy rights pertaining to a person&#039;s image or likeness depicted in a Work;&lt;br /&gt;
   rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;&lt;br /&gt;
   rights protecting the extraction, dissemination, use and reuse of data in a Work;&lt;br /&gt;
   database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and&lt;br /&gt;
   other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.&lt;br /&gt;
&lt;br /&gt;
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer&#039;s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the &amp;quot;Waiver&amp;quot;). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer&#039;s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer&#039;s express Statement of Purpose.&lt;br /&gt;
&lt;br /&gt;
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer&#039;s express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer&#039;s Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the &amp;quot;License&amp;quot;). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer&#039;s express Statement of Purpose.&lt;br /&gt;
&lt;br /&gt;
4. Limitations and Disclaimers.&lt;br /&gt;
&lt;br /&gt;
   No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.&lt;br /&gt;
   Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.&lt;br /&gt;
   Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person&#039;s Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.&lt;br /&gt;
   Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.&lt;br /&gt;
&lt;br /&gt;
Special:ContributionScores/10/5&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_24.04_Converting_epub_to_mobi_format&amp;diff=457</id>
		<title>Ubuntu 24.04 Converting epub to mobi format</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_24.04_Converting_epub_to_mobi_format&amp;diff=457"/>
		<updated>2025-01-27T10:00:15Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;  == Using the ebook-convert tool from Calibre ==  To convert an EPUB file to MOBI format on Ubuntu, you can use the &amp;#039;&amp;#039;&amp;#039;ebook-convert&amp;#039;&amp;#039;&amp;#039; tool from &amp;#039;&amp;#039;&amp;#039;Calibre&amp;#039;&amp;#039;&amp;#039;. Here’s how you can do it:  * Install Calibre If you haven’t already, you can install Calibre using the following command:  &amp;lt;code&amp;gt;sudo apt-get install calibre&amp;lt;/code&amp;gt;  === Convert EPUB to MOBI ===  Use the ebook-convert command to convert your EPUB file to MOBI. &amp;lt;br&amp;gt; For example, to convert a file named book.e...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
== Using the ebook-convert tool from Calibre ==&lt;br /&gt;
&lt;br /&gt;
To convert an EPUB file to MOBI format on Ubuntu, you can use the &#039;&#039;&#039;ebook-convert&#039;&#039;&#039; tool from &#039;&#039;&#039;Calibre&#039;&#039;&#039;. Here’s how you can do it:&lt;br /&gt;
&lt;br /&gt;
* Install Calibre&lt;br /&gt;
If you haven’t already, you can install Calibre using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install calibre&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Convert EPUB to MOBI ===&lt;br /&gt;
&lt;br /&gt;
Use the ebook-convert command to convert your EPUB file to MOBI. &amp;lt;br&amp;gt;&lt;br /&gt;
For example, to convert a file named book.epub to book.mobi, you would use:&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;ebook-convert book.epub book.mobi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Other file formats are also supported with ebook-convert ====&lt;br /&gt;
&amp;lt;code&amp;gt;ebook-convert &amp;quot;book.azw3&amp;quot; &amp;quot;book.mobi&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Convert in bulk ===&lt;br /&gt;
&lt;br /&gt;
* This assumes you have a &#039;&#039;&#039;Directory&#039;&#039;&#039; with books.epub you want converted to books.mobi in bulk.&lt;br /&gt;
* This script should be saved and run in said directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR convert_epub_to_mobi.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# Check if ebook-convert is installed&lt;br /&gt;
if ! command -v ebook-convert &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
then&lt;br /&gt;
    echo &amp;quot;ebook-convert could not be found. Please install calibre.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Loop through all .epub files in the current directory&lt;br /&gt;
for file in *.epub; do&lt;br /&gt;
    # Check if the file exists (to avoid processing &#039;.*.epub&#039; which would be all files)&lt;br /&gt;
    if [ -f &amp;quot;$file&amp;quot; ]; then&lt;br /&gt;
        # Get the filename without the extension&lt;br /&gt;
        filename=&amp;quot;${file%.epub}&amp;quot;&lt;br /&gt;
        # Convert the file&lt;br /&gt;
        ebook-convert &amp;quot;$file&amp;quot; &amp;quot;${filename}.mobi&amp;quot;&lt;br /&gt;
        echo &amp;quot;Converted $file to ${filename}.mobi&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can run with bash or make excultable&lt;br /&gt;
&lt;br /&gt;
* With bash &lt;br /&gt;
&amp;lt;code&amp;gt;bash convert_epub_to_mobi.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Make excultable&lt;br /&gt;
&amp;lt;code&amp;gt;chmod +x convert_epub_to_mobi.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;./convert_epub_to_mobi.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== system wide script ====&lt;br /&gt;
&lt;br /&gt;
If you are gonna be using a lot, can make script which you install in /usr/bin/ so you can just use:&amp;lt;code&amp;gt;convert_epub_to_mobi /path/to/epub/files /path/to/output/mobi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR convert_epub_to_mobi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# Check if ebook-convert is installed&lt;br /&gt;
if ! command -v ebook-convert &amp;amp;&amp;gt; /dev/null&lt;br /&gt;
then&lt;br /&gt;
    echo &amp;quot;ebook-convert could not be found. Please install calibre.&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Check if correct number of arguments are provided&lt;br /&gt;
if [ &amp;quot;$#&amp;quot; -ne 2 ]; then&lt;br /&gt;
    echo &amp;quot;Usage: $0 &amp;lt;source_directory&amp;gt; &amp;lt;output_directory&amp;gt;&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
SOURCE_DIR=&amp;quot;$1&amp;quot;&lt;br /&gt;
OUTPUT_DIR=&amp;quot;$2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Check if source directory exists&lt;br /&gt;
if [ ! -d &amp;quot;$SOURCE_DIR&amp;quot; ]; then&lt;br /&gt;
    echo &amp;quot;Source directory does not exist: $SOURCE_DIR&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Create output directory if it doesn&#039;t exist&lt;br /&gt;
mkdir -p &amp;quot;$OUTPUT_DIR&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Loop through all .epub files in the source directory&lt;br /&gt;
for file in &amp;quot;$SOURCE_DIR&amp;quot;/*.epub; do&lt;br /&gt;
    # Check if the file exists (to avoid processing &#039;*.epub&#039; if no files match)&lt;br /&gt;
    if [ -f &amp;quot;$file&amp;quot; ]; then&lt;br /&gt;
        # Get the filename without the path and extension&lt;br /&gt;
        filename=$(basename &amp;quot;$file&amp;quot; .epub)&lt;br /&gt;
        # Convert the file, placing the output in the specified directory&lt;br /&gt;
        ebook-convert &amp;quot;$file&amp;quot; &amp;quot;$OUTPUT_DIR/${filename}.mobi&amp;quot;&lt;br /&gt;
        echo &amp;quot;Converted $file to ${filename}.mobi in $OUTPUT_DIR&amp;quot;&lt;br /&gt;
    fi&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make it Executable and Move to /usr/bin/: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo cp convert_epub_to_mobi /usr/bin/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chmod +x /usr/bin/convert_epub_to_mobi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can run the script from anywhere by specifying source and output directories:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;convert_epub_to_mobi /path/to/epub/files /path/to/output/mobi&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Example: will convert all epubs in Downloads to newly created Kindlebooks directory&lt;br /&gt;
&amp;lt;code&amp;gt;convert_epub_to_mobi Downloads/ Kindlebooks&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* This script will create the output directory if it does not exist.&lt;br /&gt;
* It checks for the existence of the source directory before proceeding.&lt;br /&gt;
* The usage message helps remind users of the correct command structure if they forget.&lt;br /&gt;
* As before, ensure ebook-convert (part of Calibre) is installed on the system.&lt;br /&gt;
* Error handling for ebook-convert isn&#039;t included; you might want to add that for production use or for better user feedback on conversion failures.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=456</id>
		<title>Ubuntu 22.04 SSH Guide</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=456"/>
		<updated>2024-08-16T11:47:31Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Installing OpenSSH Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Understanding SSH==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SSH&#039;&#039;&#039; is a protocol that uses encryption to secure data transmitted between a client and a server. &amp;lt;br&amp;gt;&lt;br /&gt;
It enables users to execute commands, transfer files, and manage remote systems through an encrypted channel. &amp;lt;br&amp;gt;&lt;br /&gt;
SSH is widely used by system administrators for managing servers, network devices, and other remote systems.&lt;br /&gt;
&lt;br /&gt;
==Installing SSH==&lt;br /&gt;
&lt;br /&gt;
To start using SSH, you&#039;ll need to install and configure both the server and client components.&lt;br /&gt;
&lt;br /&gt;
* OpenSSH-Server&lt;br /&gt;
** Is required to allow &#039;&#039;&#039;ssh&#039;&#039;&#039; connections&lt;br /&gt;
* OpenSSH-Client&lt;br /&gt;
** Is used to login/connect to OpenSSH-Server&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Desktop, the &#039;&#039;&#039;openssh client&#039;&#039;&#039; will be preinstalled, allowing you to connect to a server which is running &#039;&#039;&#039;openssh-server&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Server, both the &#039;&#039;&#039;ssh client&#039;&#039;&#039; and &#039;&#039;&#039;openssh server&#039;&#039;&#039; are preinstalled by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing OpenSSH Server===&lt;br /&gt;
On Ubuntu distributions, you can install the OpenSSH server by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install openssh-server&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the SSH server status with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl status ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Enable and Disable OpenSSH Server===&lt;br /&gt;
&lt;br /&gt;
By default once openssh-server installed it is enabled to start at reboot.&lt;br /&gt;
&lt;br /&gt;
* Disable&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl disable ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enable&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl enable ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Installing OpenSSH Client===&lt;br /&gt;
&lt;br /&gt;
The OpenSSH client is usually pre-installed on most Linux and macOS systems. &amp;lt;br&amp;gt;For Windows, you can install the OpenSSH client by following the instructions on the official website:&amp;lt;br&amp;gt; https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse&lt;br /&gt;
&lt;br /&gt;
==Basic SSH Commands and Usage==&lt;br /&gt;
=== Connecting to a remote server===&lt;br /&gt;
Connecting to a remote server using SSH is a fundamental task when managing remote systems. Here&#039;s how to connect to a remote server using the command-line interface.&lt;br /&gt;
&lt;br /&gt;
Install an SSH client: Ensure you have an SSH client installed on your local machine. Most Unix-based systems, including Linux and macOS, have an SSH client pre-installed. For Windows, you can use the built-in OpenSSH client (available in Windows 10 and later) or a third-party client like PuTTY.&lt;br /&gt;
&lt;br /&gt;
====Gather connection information====&lt;br /&gt;
To connect to a remote server, you&#039;ll need the following information:&lt;br /&gt;
* The remote server&#039;s IP address or hostname&lt;br /&gt;
* The SSH port number (default is 22)&lt;br /&gt;
* Your username on the remote server&lt;br /&gt;
* The password for the user on remote server.&lt;br /&gt;
&lt;br /&gt;
====Connect using SSH====&lt;br /&gt;
Open a terminal or command prompt on your local machine and use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;username&#039;&#039;&#039; with your username on the remote server, &#039;&#039;&#039;hostname_or_IP&#039;&#039;&#039; with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
If OpenSSH-Server is running/listening on a port other than the default port &#039;&#039;&#039;22&#039;&#039;&#039; include the port with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag.&lt;br /&gt;
&lt;br /&gt;
For example (If port 2222):&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh john@example.com -p 2222&amp;lt;/code&amp;gt;&lt;br /&gt;
Or&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh -p 2222 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Connecting to a Remote Server =====&lt;br /&gt;
&lt;br /&gt;
In this example, we connect to a remote Ubuntu VPS with the following credentials:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Username: root&lt;br /&gt;
    IP address: 12.34.56.78&lt;br /&gt;
    Password: password2simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password. Type password2simple and press Enter. This demonstrates how simple it can be to log into a remote computer with root access.&lt;br /&gt;
&lt;br /&gt;
* If your Server is hosting SSHD on a port other than default &#039;port 22&#039; include port number with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag&lt;br /&gt;
Example with port 2222:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -p 2222 root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Authenticate====&lt;br /&gt;
When connecting for the first time, you&#039;ll see a prompt asking you to confirm the remote server&#039;s fingerprint. Verify the fingerprint and type &amp;quot;yes&amp;quot; to proceed. Next, you&#039;ll be prompted for your password. Enter your password to complete the authentication process.&lt;br /&gt;
&lt;br /&gt;
Once authenticated, you&#039;ll have access to the remote server&#039;s command line. You can now execute commands and manage the remote server as if you were working on it directly.&lt;br /&gt;
&lt;br /&gt;
Remember that you can use key-based authentication (with a private-public key pair) instead of a password for a more secure and convenient connection method.&lt;br /&gt;
== Using SSH config file==&lt;br /&gt;
&lt;br /&gt;
An SSH config file allows you to define and manage multiple SSH connections, simplifying the process of connecting to remote servers. By creating an SSH config file, you can define custom options, such as port numbers, usernames, and key files, for each connection. The SSH config file is typically located in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory and named config.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to create and use an SSH config file:&lt;br /&gt;
&lt;br /&gt;
:*    Create the SSH config file: If it doesn&#039;t exist, create the config file in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory using a text editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Define a connection: To define a connection, you&#039;ll need to specify a Host entry followed by any options you want to apply to that connection. Here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server1&lt;br /&gt;
  HostName example.com&lt;br /&gt;
  User your_username&lt;br /&gt;
  Port 2222&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this example, we&#039;ve defined a connection called server1 with the following options:&lt;br /&gt;
&lt;br /&gt;
:*    HostName: The hostname or IP address of the remote server (example.com in this case).&lt;br /&gt;
:*    User: The username to use when connecting to the remote server (replace your_username with your actual username).&lt;br /&gt;
:*    Port: The port number to use for the SSH connection (2222 in this example).&lt;br /&gt;
:*    IdentityFile: The path to the private key file to use for authentication (replace ~/.ssh/id_rsa_server1 with the path to your private key file).&lt;br /&gt;
&lt;br /&gt;
You can define multiple connections in the same config file by creating separate Host entries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server2&lt;br /&gt;
  HostName 192.168.1.100&lt;br /&gt;
  User another_username&lt;br /&gt;
  Port 22&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Connect using the SSH config file: To connect to a remote server using the defined connection, simply use the ssh command followed by the Host entry:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, SSH will automatically use the options defined in the config file for server1, such as the hostname, username, port number, and identity file.&lt;br /&gt;
&lt;br /&gt;
By using an SSH config file, you can simplify the process of managing multiple SSH connections and customize the options for each connection.&lt;br /&gt;
&lt;br /&gt;
==Key-based Authentication==&lt;br /&gt;
&lt;br /&gt;
Why use key-based authentication?&lt;br /&gt;
* Server1: 12.34.56.78&lt;br /&gt;
* Server2: 12.34.56.87&lt;br /&gt;
&lt;br /&gt;
You are trying to login to Server1 (Your Server), but by mistake you enter your &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; to Server2 (Foo&#039;s Server), Can Server2 record the &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; you used?&lt;br /&gt;
[[Ubuntu_18.04_OpenSSH-Server_Capture_Failed_Passwords|YES, Yes it can]] &lt;br /&gt;
&lt;br /&gt;
=== Generating SSH key pairs===&lt;br /&gt;
&lt;br /&gt;
SSH key pairs consist of a private key and a public key. They provide a secure, passwordless authentication method for connecting to remote servers. The private key remains on your local machine, while the public key is added to the remote server&#039;s authorized keys. Here&#039;s how to generate an SSH key pair:&lt;br /&gt;
&lt;br /&gt;
Open a terminal: On Unix-based systems (Linux and macOS), open a terminal. On Windows, open PowerShell or the Command Prompt.&lt;br /&gt;
&lt;br /&gt;
Generate the key pair: Use the ssh-keygen command to create a new SSH key pair. The following command generates a 4096-bit RSA key pair:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also generate other types of keys, such as Ed25519, by changing the -t option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t ed25519&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specify the key&#039;s location: When prompted, you can either accept the default location (~/.ssh/id_rsa for RSA keys, ~/.ssh/id_ed25519 for Ed25519 keys) or enter a custom path. It is recommended to use the default location unless you have a specific reason to change it.&lt;br /&gt;
&lt;br /&gt;
Set a passphrase (optional): You can choose to protect your private key with a passphrase. If you do, you&#039;ll need to enter the passphrase every time you use the key. This adds an extra layer of security, but can be less convenient for automation or scripting. To set a passphrase, enter it when prompted; otherwise, leave the field blank&lt;br /&gt;
&lt;br /&gt;
====Selecting file name and path for keys====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option in the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command is used to specify the output file for the generated key pair. In your example, &#039;&#039;&#039;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&#039;&#039;&#039;, the command is generating an RSA key pair with a key length of 4096 bits, and the output files will be saved in the &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory with the base name &#039;&#039;&#039;nuc&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the options used in this command:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-f .ssh/nuc&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039; and the public key in &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Create keys with no passphase====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -N &amp;quot;&amp;quot; -C &amp;quot;MYSERVER&amp;quot; -f ~/.ssh/serverkey&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-N &amp;quot;&amp;quot;&#039;&#039;&#039;: Specifies an empty passphrase for the key pair. This means that the private key will not be encrypted, and no passphrase will be required when using it. This can be less secure, but more convenient for automated processes.&lt;br /&gt;
:*    &#039;&#039;&#039;-C &amp;quot;MYSERVER&amp;quot;&#039;&#039;&#039;: Adds a comment to the generated key pair. In this case, the comment is &amp;quot;MYSERVER&amp;quot;. Comments are useful for identifying keys when you have multiple keys in your ~/.ssh directory or on a remote server.&lt;br /&gt;
:*    &#039;&#039;&#039;-f ~/.ssh/serverkey&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039; and the public key in &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;. The private key will have an empty passphrase and a comment &amp;quot;MYSERVER&amp;quot; for easier identification.&lt;br /&gt;
&lt;br /&gt;
====Remove the passphrase from an existing SSH private key====&lt;br /&gt;
&lt;br /&gt;
To remove the passphrase from an existing SSH private key, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, which is used for changing the passphrase. Follow these steps:&lt;br /&gt;
&lt;br /&gt;
:*    Make a backup of your private key file, just in case something goes wrong during the process. You can do this by running the following command, replacing &#039;&#039;&#039;&amp;lt;your_private_key&amp;gt;&#039;&#039;&#039; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
::**     &#039;&#039;&#039;-p&#039;&#039;&#039;: Indicates that you want to change the passphrase of an existing private key.&lt;br /&gt;
::**    &#039;&#039;&#039;-f &amp;lt;your_private_key&amp;gt;&#039;&#039;&#039;: Specifies the private key file whose passphrase you want to change.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    You will be prompted to enter the old passphrase for the private key. Type it in and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Since you want to remove the passphrase, leave this field empty and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the empty passphrase. Press Enter again to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has its passphrase removed. Keep in mind that this makes the private key less secure, as anyone with access to the file can use it without needing to know the passphrase.&lt;br /&gt;
&lt;br /&gt;
====Add/Change a passphrase to an existing SSH Key====&lt;br /&gt;
&lt;br /&gt;
To add a passphrase to an existing SSH private key that doesn&#039;t have one, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, just like when you change or remove a passphrase. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;Make a backup of your private key file&#039;&#039;&#039;, just in case something goes wrong during the process. You can do this by running the following command, replacing &amp;lt;your_private_key&amp;gt; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the -p option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*   You will be prompted to enter the old passphrase for the private key. Since your private key doesn&#039;t currently have a passphrase, just press Enter to proceed.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Type in the passphrase you want to set for the private key and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the new passphrase. Type it again and press Enter to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has a passphrase added to it. This provides an extra layer of security, as anyone using the key will need to know the passphrase to access it. Keep in mind that you should use a strong passphrase to ensure better security.&lt;br /&gt;
&lt;br /&gt;
=== Copying public keys to the remote server===&lt;br /&gt;
After generating an SSH key pair, you&#039;ll need to copy the public key to the remote server to enable key-based authentication. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
====Using ssh-copy-id====&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;ssh-copy-id&#039;&#039;&#039; command (Linux and macOS): On Unix-based systems, you can use the ssh-copy-id command to copy your public key to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ~/.ssh/id_rsa.pub with the path to your public key file (e.g., ~/.ssh/id_ed25519.pub for Ed25519 keys), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
====Manually copy the public key====&lt;br /&gt;
&lt;br /&gt;
Manually copy the public key (Windows and alternative method): If you don&#039;t have access to the ssh-copy-id command or prefer to do it manually, you can:&lt;br /&gt;
&lt;br /&gt;
:* Open your public key file (e.g., id_rsa.pub or id_ed25519.pub) with a text editor and copy its content.&amp;gt;&lt;br /&gt;
:* Log in to the remote server via SSH.&amp;lt;br&amp;gt;&lt;br /&gt;
:* Create the ~/.ssh directory if it doesn&#039;t exist:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit or create the ~/.ssh/authorized_keys file using a text editor (e.g., nano, vim, or emacs), and paste the content of your public key at the end of the file. Save and close the file.&lt;br /&gt;
&lt;br /&gt;
Set the correct file permissions: To ensure the security of your SSH setup, it&#039;s essential to set the proper file permissions on your local machine and the remote server:&lt;br /&gt;
&lt;br /&gt;
:* On your local machine:&lt;br /&gt;
:**       Private key (id_rsa or id_ed25519): -rw------- (600)&lt;br /&gt;
:**       Public key (id_rsa.pub or id_ed25519.pub): -rw-r--r-- (644)&lt;br /&gt;
&lt;br /&gt;
:*    On the remote server:&lt;br /&gt;
:**        ~/.ssh directory: drwx------ (700)&lt;br /&gt;
:**        ~/.ssh/authorized_keys file: -rw------- (600)&lt;br /&gt;
&lt;br /&gt;
To set the permissions on your local machine, use the chmod command:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
chmod 644 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On the remote server, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 700 ~/.ssh&lt;br /&gt;
chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you&#039;ve copied your public key to the remote server and set the correct file permissions, you should be able to connect using key-based authentication without the need for a password.&lt;br /&gt;
&lt;br /&gt;
=== Disabling password authentication (optional)===&lt;br /&gt;
Disabling password authentication enhances the security of your SSH server by requiring key-based authentication for all connections. You can disable password authentication for specific users or for all users. To do so, follow these steps:&lt;br /&gt;
&lt;br /&gt;
:* Connect to the remote server: Log in to the remote server via SSH using your username and the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:* Edit the SSH configuration file: Open the SSH server configuration file (usually located at /etc/ssh/sshd_config) with a text editor such as nano, vim, or emacs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for all users: Find the line containing &amp;quot;PasswordAuthentication&amp;quot; and set its value to &amp;quot;no&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol.&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for a specific user: To disable password authentication only for a particular user, you can use a &amp;quot;Match User&amp;quot; block at the end of the sshd_config file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User username&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Replace username with the actual username for which you want to disable password authentication.&lt;br /&gt;
&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, password authentication will be disabled for the specified user(s), and only key-based authentication will be allowed. Remember that if you disable password authentication, you must have a working SSH key pair set up to access the server, or you may be locked out.&lt;br /&gt;
&lt;br /&gt;
== Configuring the SSH server==&lt;br /&gt;
&lt;br /&gt;
Edit the SSH server configuration file located at &amp;lt;b&amp;gt;/etc/ssh/sshd_config&amp;lt;/b&amp;gt; to set your desired settings. You can modify options like the listening port, allowing root login, and more.&lt;br /&gt;
&lt;br /&gt;
===Common sshd_config Options===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file is located at &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; on most Linux systems. This file contains various options and settings that determine the behavior of the OpenSSH server. Each option is followed by its value, and lines starting with a &amp;lt;b&amp;gt;#&amp;lt;/b&amp;gt; are considered comments.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an overview of some common options in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
===Port===&lt;br /&gt;
&lt;br /&gt;
Specifies the port number that the SSH server listens on.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Port 22&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AddressFamily===&lt;br /&gt;
&lt;br /&gt;
Determines the IP address family (IPv4, IPv6, or both) used by the SSH server.&lt;br /&gt;
&lt;br /&gt;
* To specify that the SSH server should only listen for incoming IPv4 connections:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Or, if you want the SSH server to only listen for incoming IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;inet6&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to allow both IPv4 and IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;any&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily any&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ListenAddress===&lt;br /&gt;
Specifies the IP address(es) the SSH server listens on. By default, it listens on all available addresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ListenAddress 192.168.1.10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Protocol===&lt;br /&gt;
Defines the SSH protocol version. It&#039;s recommended to use only protocol 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Protocol 2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PermitRootLogin===&lt;br /&gt;
Controls whether root login is allowed. It&#039;s generally advised to disable root login or set it to &amp;quot;without-password&amp;quot; to allow only key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitRootLogin no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===PasswordAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables password-based authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PubkeyAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PubkeyAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AuthorizedKeysFile===&lt;br /&gt;
Specifies the location of the authorized keys file for public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;AuthorizedKeysFile .ssh/authorized_keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LogLevel===&lt;br /&gt;
Sets the logging level for the SSH server.&lt;br /&gt;
&lt;br /&gt;
The LogLevel option in &#039;&#039;&#039;sshd_config&#039;&#039;&#039; controls the amount of information that SSH daemon (sshd) logs.&lt;br /&gt;
&lt;br /&gt;
There are different log levels that can be set with this option, each providing a different level of detail:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;QUIET&#039;&#039;&#039;: Disables all logging.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;FATAL&#039;&#039;&#039;: Only logs fatal errors.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;ERROR&#039;&#039;&#039;: Logs error messages.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;INFO&#039;&#039;&#039;: Logs informational messages such as login attempts.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VERBOSE&#039;&#039;&#039;: Logs more detailed information than INFO, including shell commands executed.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEBUG&#039;&#039;&#039;: Logs detailed debugging information, including raw protocol details.&lt;br /&gt;
&lt;br /&gt;
The default log level is &#039;&#039;&#039;INFO&#039;&#039;&#039;, which is usually sufficient for most purposes. However, if you need to troubleshoot SSH connections or monitor user activity, setting a higher log level may be helpful.&lt;br /&gt;
&lt;br /&gt;
To change the &#039;&#039;&#039;LogLevel&#039;&#039;&#039; in &#039;&#039;&#039;sshd_config&#039;&#039;&#039;, you can edit the file &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; (or the appropriate configuration file for your system), and add or modify the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel &amp;lt;log_level&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;log_level&amp;gt; is one of the log levels listed above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel INFO&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LoginGraceTime===&lt;br /&gt;
&lt;br /&gt;
Defines the time allowed for a user to successfully log in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LoginGraceTime 2m&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MaxAuthTries===&lt;br /&gt;
&lt;br /&gt;
Limits the number of authentication attempts allowed per connection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxAuthTries 6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MaxSessions===&lt;br /&gt;
&lt;br /&gt;
Specifies the maximum number of simultaneous sessions allowed per network connection.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxSessions 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AllowUsers, DenyUsers, AllowGroups, DenyGroups===&lt;br /&gt;
&lt;br /&gt;
These options control which users and groups are allowed or denied access to the SSH server. They provide a way to manage access control based on usernames and group membership.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;: Specifies a list of users allowed to access the SSH server. Other users will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowUsers user1 user2 user3&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;: Specifies a list of users denied access to the SSH server. Other users will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyUsers user4 user5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;: Specifies a list of groups whose members are allowed to access the SSH server. Users not belonging to these groups will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowGroups group1 group2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;: Specifies a list of groups whose members are denied access to the SSH server. Users not belonging to these groups will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyGroups group3 group4&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the order in which these options are applied is &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;, &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;, &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;, and finally &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Banner===&lt;br /&gt;
&lt;br /&gt;
The Banner option allows you to display a message or warning to users before they log in to the SSH server. This is often used to display legal notices, security warnings, or other important information.&lt;br /&gt;
&lt;br /&gt;
To enable the banner, set the Banner option to the path of a text file containing the message you want to display:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Banner /etc/ssh/banner.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create the /etc/ssh/banner.txt file and add your desired message. The content of this file will be displayed to users before they log in.&lt;br /&gt;
&lt;br /&gt;
==Advanced sshd_config Options==&lt;br /&gt;
=== PermitTunnel===&lt;br /&gt;
The PermitTunnel option enables or disables the use of SSH tunneling. Tunnels can be used to forward ports or create VPN-like connections between the client and the server. &lt;br /&gt;
* There are four possible values for this option:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;yes&amp;quot;&#039;&#039;&#039;: Allows all types of tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;point-to-point&amp;quot;&#039;&#039;&#039;: Allows only point-to-point (Layer 3) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;ethernet&amp;quot;&#039;&#039;&#039;: Allows only Ethernet (Layer 2) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;no&amp;quot;&#039;&#039;&#039;: Disables tunneling (default).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable tunneling, set the PermitTunnel option in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitTunnel yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keep in mind that enabling tunnels may expose your server to additional security risks. Only enable this option if you understand the implications and have a specific use case that requires it.&lt;br /&gt;
&lt;br /&gt;
=== ChrootDirectory===&lt;br /&gt;
The ChrootDirectory option allows you to restrict a user or a group to a specific directory (known as a chroot jail) when they log in via SSH. This can enhance security by isolating users and limiting their access to only the necessary parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
To set up a chroot jail, follow these steps:&lt;br /&gt;
&lt;br /&gt;
Create a directory that will serve as the chroot jail. For example, let&#039;s create a directory for user1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the ownership of the directory to the user and their primary group:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown user1:user1 /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ChrootDirectory for user1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ChrootDirectory /home/user1/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, they will be restricted to the /home/user1/chroot directory and won&#039;t be able to access other parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
Note that the chroot jail should be owned by root and not writable by the user. If you need to provide write access to specific directories, create subdirectories inside the chroot jail and set appropriate permissions for those. Also, some features like SFTP may require additional configuration within the chroot jail.&lt;br /&gt;
&lt;br /&gt;
===ForceCommand===&lt;br /&gt;
The ForceCommand option allows you to specify a command that will be executed when a user logs in via SSH, regardless of the command requested by the user. This can be useful for limiting the actions a user can perform or for automatically running specific tasks upon login.&lt;br /&gt;
&lt;br /&gt;
To use the ForceCommand option, follow these steps:&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ForceCommand for a specific user or group. For example, to force user1 to execute the command /usr/bin/my-command upon login:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ForceCommand /usr/bin/my-command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, the /usr/bin/my-command will be executed automatically, and they will not be able to run any other command.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that using ForceCommand may limit the user&#039;s ability to interact with the server or transfer files via SFTP. Make sure to test and verify the functionality for your specific use case.&lt;br /&gt;
&lt;br /&gt;
=== Match Blocks===&lt;br /&gt;
&lt;br /&gt;
Match blocks in the sshd_config file allow you to apply specific configuration options based on certain criteria, such as the user, group, address, or host. This enables you to create custom rules and settings for different users, groups, or connections.&lt;br /&gt;
&lt;br /&gt;
Match block syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match criteria&lt;br /&gt;
  Option value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are some examples of Match blocks and their usage:&lt;br /&gt;
&lt;br /&gt;
Apply settings only for a specific user:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
  AllowTcpForwarding yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication and enables TCP forwarding only for user1.&lt;br /&gt;
&lt;br /&gt;
Apply settings for multiple users:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1,user2&lt;br /&gt;
  ChrootDirectory /home/%u/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration sets the chroot directory for both user1 and user2.&lt;br /&gt;
&lt;br /&gt;
Apply settings for a specific group:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Group group1&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration enables password authentication only for members of group1.&lt;br /&gt;
&lt;br /&gt;
Apply settings based on the client&#039;s IP address:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication for clients connecting from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Combine multiple criteria:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1 Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This configuration enables password authentication only for user1 when they connect from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Remember to restart the SSH server after making changes to the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match blocks offer flexibility in customizing your SSH server&#039;s configuration based on various criteria. Use them wisely to enhance security and optimize your server&#039;s settings.&lt;br /&gt;
&lt;br /&gt;
==Best Practices and Tips &#039;&#039;&#039;sshd_config&#039;&#039;&#039;==&lt;br /&gt;
When configuring your &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file, it&#039;s essential to follow best practices to ensure the security and stability of your SSH server. Here are some recommendations and tips:&lt;br /&gt;
&lt;br /&gt;
:*   Keep the server up-to-date: Always update your SSH server software and the underlying operating system to ensure you have the latest security patches and features.&lt;br /&gt;
&lt;br /&gt;
:*    Use strong authentication: Enable key-based authentication (PubkeyAuthentication) and consider disabling password authentication (PasswordAuthentication) to reduce the risk of brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
:*    Limit root access: Set &amp;quot;PermitRootLogin&amp;quot; to &amp;quot;no&amp;quot; or &amp;quot;without-password&amp;quot; to prevent direct root login or require key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
:*    Use non-standard ports: Change the default SSH port (22) to a non-standard port to reduce the exposure to automated scans and attacks. Keep in mind this is security through obscurity and should be combined with other security measures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Restrict user access&#039;&#039;&#039;: Use &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; and &amp;quot;DenyGroups&amp;quot; options to control which users and groups can access the SSH server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Monitor logs&#039;&#039;&#039;: Regularly check your SSH server logs for any suspicious activity or failed login attempts. Adjust the &amp;quot;LogLevel&amp;quot; setting in sshd_config as needed.&lt;br /&gt;
* Default Log Path Ubuntu 22.04: &#039;&#039;&#039;/var/log/auth.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use chroot jails&#039;&#039;&#039;: Isolate users by creating chroot jails using the &amp;quot;ChrootDirectory&amp;quot; option, especially when providing SFTP access or when users don&#039;t require full access to the server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configure connection settings&#039;&#039;&#039;: Set appropriate values for &amp;quot;LoginGraceTime&amp;quot; and &amp;quot;MaxAuthTries&amp;quot; to limit the time allowed for successful login and the number of authentication attempts per connection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use a strong firewall&#039;&#039;&#039;: Configure your server&#039;s firewall to only allow SSH connections from trusted IP addresses or networks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Regularly review and audit&#039;&#039;&#039;: Periodically review your sshd_config settings and make adjustments as necessary. Keep up-to-date with SSH security best practices and recommendations.&lt;br /&gt;
&lt;br /&gt;
By following these best practices and tips, you can enhance the security and performance of your SSH server, protecting it from unauthorized access and potential attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting sshd_config Issues===&lt;br /&gt;
&lt;br /&gt;
When encountering problems with your SSH server configuration, it&#039;s important to know how to diagnose and resolve issues. Here are some common problems and troubleshooting steps:&lt;br /&gt;
&lt;br /&gt;
Check syntax and configuration errors: If the SSH server is not starting or not functioning as expected, check the sshd_config file for any syntax or configuration errors. Use the following command to test the configuration file for errors:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sshd -t&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are any issues, the command will provide error messages with information on what needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
Review log files: Inspect the SSH server log files for any error messages or relevant information. The location of the log files may vary depending on your system, but common locations are /var/log/auth.log or /var/log/secure. Tail the log file while attempting to connect to get real-time information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo tail -f /var/log/auth.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server&lt;br /&gt;
&lt;br /&gt;
Check firewall settings: Ensure that the server&#039;s firewall is allowing SSH connections on the correct port. If you changed the default SSH port, update your firewall rules accordingly.&lt;br /&gt;
&lt;br /&gt;
Verify user permissions: If a specific user is unable to connect, check the user&#039;s permissions, home directory, and the settings in the sshd_config file, such as &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; or &amp;quot;DenyGroups.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SSH server from a client, use the verbose mode to get more detailed information about the connection process. This can help identify any issues with authentication or configuration. Run the following command to enable verbose mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -v user@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user@example.com&amp;quot; with the appropriate username and server address. You can increase the verbosity level by adding more &amp;quot;v&amp;quot; characters (e.g., -vv or -vvv) if needed.&lt;br /&gt;
&lt;br /&gt;
Check file permissions: Ensure that the file permissions for the user&#039;s home directory, the .ssh directory, and the authorized_keys file are set correctly. The user&#039;s home directory should not be writable by other users, the .ssh directory should have permissions set to 700 (drwx------), and the authorized_keys file should have permissions set to 600 (-rw-------).&lt;br /&gt;
&lt;br /&gt;
Test network connectivity: If you&#039;re unable to connect to the SSH server, verify that you can reach the server on the network. Use tools like ping, traceroute, or telnet to check the connection to the server and the specific SSH port.&lt;br /&gt;
&lt;br /&gt;
By following these troubleshooting steps, you should be able to diagnose and resolve most issues related to the sshd_config file and the SSH server configuration. Remember to carefully review the settings in your sshd_config file and consult the server logs for additional information when encountering problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====After making changes, restart the SSH server:====&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running commands on a remote server==&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve connected to a remote server using SSH, you can execute commands on the remote machine just as you would on your local system. However, you can also run commands on a remote server without establishing an interactive SSH session. &lt;br /&gt;
&lt;br /&gt;
This can be useful for automation, scripting, or quick tasks. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
Use the SSH command: To run a command on a remote server without entering an interactive session, use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP -p port &#039;command&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, port with the SSH port number (if different from the default 22), and command with the command you want to execute.&lt;br /&gt;
&lt;br /&gt;
For example, to list the contents of the remote server&#039;s home directory, you can use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 22 &#039;ls -la&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Handling multiple commands===&lt;br /&gt;
If you need to execute multiple commands, you can chain them together using a &#039;&#039;&#039;semicolon&#039;&#039;&#039; or &#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The semicolon allows you to run multiple commands sequentially, while the &amp;amp;&amp;amp; operator runs the next command only if the previous command was successful.&lt;br /&gt;
&lt;br /&gt;
For example, to update the package list and then upgrade the packages on a remote Ubuntu server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 2222 &#039;sudo apt-get update; sudo apt-get upgrade -y&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Command output:&lt;br /&gt;
The output of the command will be displayed in your local terminal, just as if you were running the command on your local machine. Using key-based authentication&lt;br /&gt;
&lt;br /&gt;
==Transferring files with SCP==&lt;br /&gt;
&lt;br /&gt;
The Secure Copy Protocol (SCP) is a useful tool for transferring files between your local machine and a remote server using SSH. SCP ensures that the data is encrypted during transit, providing a secure and efficient way to transfer files.&lt;br /&gt;
&lt;br /&gt;
===Install an SCP client=== &lt;br /&gt;
&lt;br /&gt;
Most Unix-based systems, including Linux and macOS, have an SCP client pre-installed. For Windows, you can use the built-in SCP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from your local machine to a remote server===&lt;br /&gt;
&lt;br /&gt;
To copy a file from your local machine to a remote server, use the following command:&lt;br /&gt;
* Note the use of the upper case &#039;&#039;&#039;-P&#039;&#039;&#039; for ports with &#039;&#039;&#039;scp&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port local_file_path username@hostname_or_IP:remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), local_file_path with the path to the file on your local machine, username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, and remote_file_path with the desired location on the remote server.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 22 /home/john/documents/report.pdf john@example.com:/home/john/reports/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the local machine to the &amp;quot;reports&amp;quot; directory on the remote server.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from a remote server to your local machine===&lt;br /&gt;
To copy a file from a remote server to your local machine, use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port username@hostname_or_IP:remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, remote_file_path with the path to the file on the remote server, and local_file_path with the desired location on your local machine.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 2222 john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
: Or&lt;br /&gt;
&amp;lt;code&amp;gt;scp john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;-&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the remote server&#039;s &amp;quot;reports&amp;quot; directory to the &amp;quot;documents&amp;quot; directory on your local machine.&lt;br /&gt;
&lt;br /&gt;
===Transferring directories=== &lt;br /&gt;
&lt;br /&gt;
To transfer an entire directory, use the &#039;&#039;&#039;-r&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port local_directory_path username@hostname_or_IP:remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, to copy a directory from the remote server to your local machine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port username@hostname_or_IP:remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using SCP is a convenient and secure way to transfer files between your local machine and a remote server. It leverages the security of the SSH protocol to ensure that your data remains encrypted during transit.&lt;br /&gt;
&lt;br /&gt;
===Transferring from Remote Computer to Remote Computer===&lt;br /&gt;
&lt;br /&gt;
Copy the file &#039;&#039;&#039;stuff.txt&#039;&#039;&#039; from remote host &#039;&#039;&#039;12.34.56.67&#039;&#039;&#039; to host &#039;&#039;&#039;11.22.33.44&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.67:/home/user/Documents/stuff.txt name@11.22.33.44:/home/user/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;&#039;-3&#039;&#039;&#039; flag copies between two remote hosts &amp;quot;12.34.56.67&amp;quot; and &amp;quot;11.22.33.44&amp;quot; are transferred through the local host running the command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -3 name@12.34.56.67:/home/user/Documents/stuff.txt \ name@11.22.33.44:/home/user/Documents/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Transferring multiple files===&lt;br /&gt;
&lt;br /&gt;
Send files foo.txt and bar.txt to remote.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp foo.txt bar.txt user@12.34.56.78:~/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from remote &amp;quot;Documents&amp;quot; directory to local &amp;quot;Documents&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp user@11.22.33.44:/home/user/Documents/\{todo_list.txt,links.txt,stuff.txt\} /home/$USER/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from the remote to local current directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.78:~/\{README.md,.bashrc\} . &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Transferring files with SFTP==&lt;br /&gt;
The SSH File Transfer Protocol (SFTP) is another method for transferring files securely between your local machine and a remote server. Unlike SCP, SFTP provides an interactive interface that allows you to navigate, upload, and download files more easily.&lt;br /&gt;
&lt;br /&gt;
Install an SFTP client: Most Unix-based systems, including Linux and macOS, have an SFTP client pre-installed. For Windows, you can use the built-in SFTP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Connect to a remote server: To start an SFTP session with a remote server, open a terminal or command prompt on your local machine and use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P 22 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Navigate the remote filesystem: Once connected, you can use commands similar to those available in a Unix shell to navigate the remote server&#039;s filesystem. Some common SFTP commands include:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;ls&#039;&#039;&#039;: List files and directories&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;cd&#039;&#039;&#039;: Change the current directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;mkdir&#039;&#039;&#039;: Create a new directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rmdir&#039;&#039;&#039;: Remove an empty directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;get&#039;&#039;&#039;: Download a file from the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;put&#039;&#039;&#039;: Upload a file to the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rm&#039;&#039;&#039;: Remove a file&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rename&#039;&#039;&#039;: Rename a file or directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;exit&#039;&#039;&#039;: Exit the SFTP session&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transfer files: To transfer files, use the put command to upload a file from your local machine to the remote server, and the get command to download a file from the remote server to your local machine. For example:&lt;br /&gt;
&lt;br /&gt;
Upload a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put local_file_path remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_file_path and remote_file_path with the appropriate paths for the files you want to transfer.&lt;br /&gt;
&lt;br /&gt;
Transferring directories: To transfer entire directories, use the -r flag with the put and get commands:&lt;br /&gt;
&lt;br /&gt;
Upload a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put -r local_directory_path remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get -r remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disconnect from the remote server: When you&#039;ve finished transferring files, type exit to close the SFTP session.&lt;br /&gt;
&lt;br /&gt;
SFTP offers a more user-friendly, interactive experience for transferring files compared to SCP. By utilizing the secure and encrypted SSH protocol, SFTP ensures that your data remains safe during transfer.&lt;br /&gt;
&lt;br /&gt;
==Advanced SSH Techniques==&lt;br /&gt;
=== Port forwarding and tunneling===&lt;br /&gt;
&lt;br /&gt;
SSH port forwarding and tunneling allow you to securely forward network traffic between your local machine and a remote server. This can be useful for accessing remote services, bypassing firewalls, or securely transmitting sensitive data.&lt;br /&gt;
&lt;br /&gt;
Local Port Forwarding: Local port forwarding creates a secure tunnel between your local machine and a remote server, allowing you to access remote services as if they were running on your local machine. To set up local port forwarding, use the -L flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -L local_port:remote_host:remote_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_port with an available port on your local machine, remote_host with the hostname or IP address of the remote server hosting the service, remote_port with the port number of the remote service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
Remote Port Forwarding: Remote port forwarding enables you to expose a local service running on your machine to a remote network. To set up remote port forwarding, use the -R flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -R remote_port:local_host:local_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace remote_port with an available port on the remote server, local_host with the hostname or IP address of the local machine hosting the service, local_port with the port number of the local service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:**Forwarding X, Sound, and Video on Ubuntu 22.04 with Ubuntu 22.04 LXC**: To forward X, sound, and video from a remote Ubuntu 22.04 server to your local Ubuntu 22.04 machine, you&#039;ll need to enable X11 forwarding and install the necessary packages.&lt;br /&gt;
&lt;br /&gt;
:*    Install required packages: On both your local machine and the remote server, install the x11-apps and pulseaudio packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt update&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install x11-apps pulseaudio&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Enable X11 forwarding: To enable X11 forwarding, you&#039;ll need to edit the SSH server configuration file (/etc/ssh/sshd_config) on the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line containing &amp;quot;X11Forwarding&amp;quot; and set its value to &amp;quot;yes&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;X11Forwarding yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol. Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Connect with X11 forwarding: From your local machine, use the -X flag to enable X11 forwarding when connecting to the remote server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -X username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Export PULSE_SERVER environment variable: On the remote server, export the PULSE_SERVER environment variable to forward sound:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;export PULSE_SERVER=tcp:localhost&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add this line to the remote user&#039;s ~/.bashrc or ~/.profile file to make the change permanent.&lt;br /&gt;
&lt;br /&gt;
:*    Run applications: Now, you can run graphical applications on the remote server, and they will be displayed on your local machine with sound and video forwarded.&lt;br /&gt;
&lt;br /&gt;
Please note that forwarding X, sound, and video might cause increased latency and reduced performance compared to running the applications locally.&lt;br /&gt;
&lt;br /&gt;
=== SSH agent forwarding===&lt;br /&gt;
SSH agent forwarding is a powerful feature that allows you to use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers. This is particularly useful when you need to access one remote server (Server B) through another remote server (Server A).&lt;br /&gt;
&lt;br /&gt;
====    Start the SSH agent on your local machine ====&lt;br /&gt;
&lt;br /&gt;
Before you enable SSH agent forwarding, you need to start the SSH agent on your local machine. Open a terminal and run the following command:&lt;br /&gt;
&lt;br /&gt;
:* For Linux and macOS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Windows (Git Bash or Cygwin):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval $(ssh-agent)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command starts the SSH agent and sets the required environment variables.&lt;br /&gt;
&lt;br /&gt;
====Add your SSH key to the agent====&lt;br /&gt;
&lt;br /&gt;
Next, add your private key to the SSH agent with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-add ~/.ssh/your_private_key&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_private_key&#039;&#039;&#039; with the filename of your private key. This might be &#039;&#039;&#039;id_rsa&#039;&#039;&#039;, &#039;&#039;&#039;id_ed25519&#039;&#039;&#039;, or another key file depending on your setup.&lt;br /&gt;
&lt;br /&gt;
====Configure SSH agent forwarding on your local machine====&lt;br /&gt;
&lt;br /&gt;
Edit your SSH config file to enable agent forwarding. The config file is usually located at &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;. If the file doesn&#039;t exist, create it.&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the config file: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server_a_alias&lt;br /&gt;
  HostName server_a_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_a&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host server_b_alias&lt;br /&gt;
  HostName server_b_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_b&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &lt;br /&gt;
:* &#039;&#039;&#039;server_a_alias&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039; server_a_ip_or_hostname&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_a&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;server_b_alias&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;server_b_ip_or_hostname&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_b&#039;&#039;&#039; &lt;br /&gt;
with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Make sure your public key is added to the remote servers====&lt;br /&gt;
&lt;br /&gt;
Before you can use SSH agent forwarding, you need to add your public key to the &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; file on both Server A and Server B. If you haven&#039;t done this already, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/your_public_key user@server_ip_or_hostname&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_public_key&#039;&#039;&#039;, &#039;&#039;&#039;user&#039;&#039;&#039;, and &#039;&#039;&#039;server_ip_or_hostname&#039;&#039;&#039; with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Test SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
First, SSH into Server A:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_a_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from Server A, SSH into Server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_b_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything is set up correctly, you should be able to access Server B without being prompted for a password.&lt;br /&gt;
&lt;br /&gt;
====Verify SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
To make sure that SSH agent forwarding is working, you can check the value of the &#039;&#039;&#039;SSH_AUTH_SOCK&#039;&#039;&#039; environment variable on Server B.&lt;br /&gt;
&lt;br /&gt;
From Server B, run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;echo $SSH_AUTH_SOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If SSH agent forwarding is working, this command should return a non-empty value.&lt;br /&gt;
&lt;br /&gt;
That&#039;s it! You&#039;ve successfully set up and tested SSH agent forwarding. Now you can use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Command Restriction===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file can be used to restrict the commands that a specific SSH key can execute. This is especially useful for security purposes, to limit the potential damage that could be done if a key is compromised.&lt;br /&gt;
&lt;br /&gt;
By including a &#039;&#039;&#039;command=&#039;&#039;&#039; directive in the &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file, you can specify the exact command that will be run when a client connects using the associated key. Any command provided by the client will be ignored, and the command specified in the authorized_keys file will be used instead.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is set up to always execute the &#039;&#039;&#039;scp&#039;&#039;&#039; command (used for secure copy of files over SSH) to the specified directory, no matter what command was originally issued by the client. This is a good way to create a &amp;quot;write-only&amp;quot; drop box, for instance.&lt;br /&gt;
&lt;br /&gt;
However, the keyholder could potentially still execute arbitrary commands by carefully crafting the file names they upload, so additional precautions should be taken, such as using command= along with other directives like &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039;, &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039;, and &#039;&#039;&#039;no-pty&#039;&#039;&#039; to further limit what can be done with the key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;,no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This entry does the following:&lt;br /&gt;
&lt;br /&gt;
:*    The &#039;&#039;&#039;command=&#039;&#039;&#039; directive runs the specified command when a client connects using this key. In this case, the command is scp, which securely copies files to the /home/rscp/media/ directory.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039; directive prevents the client from using SSH&#039;s port forwarding features, which could potentially be used to create a secure tunnel for other network traffic.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039; directive prevents the client from forwarding X11 graphical sessions, which could be used to run graphical applications over the SSH connection.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-pty&#039;&#039;&#039; directive prevents the allocation of a pseudo-terminal, which means the client can&#039;t interact with a shell or run interactive commands.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039; part is the public key of the client. Replace this with the actual key.&lt;br /&gt;
&lt;br /&gt;
This configuration significantly limits the operations that can be performed with this key, providing an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
====SCP Only====&lt;br /&gt;
&lt;br /&gt;
Use Case Example: Have a Server hosting XML Dumps, and want to automate sending a file or directory from Server1 to Server2 using a script and ssh-key so i don&#039;t need to enter password. &lt;br /&gt;
&lt;br /&gt;
=====Create Account on Server=====&lt;br /&gt;
Create user account you are going to use:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;adduser rscp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure user has a &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory to send public key to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make a Directory to transfer files to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If you see error &amp;lt;code&amp;gt;scp: /home/rscp/media/test.txt: Permission denied&amp;lt;/code&amp;gt; If you created directory &#039;&#039;&#039;media&#039;&#039;&#039; when logged in as &#039;&#039;&#039;root&#039;&#039;&#039; then check directory permissions and if need [[Linux_Users_and_Groups#File_Ownership_and_Permissions|assign ownership to &#039;&#039;&#039;user&#039;&#039;&#039; account.]]&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;code&amp;gt;chown rscp:rscp /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Ubuntu_22.04_SSH_Guide#Copying_public_keys_to_the_remote_server|Send your public key to server]]&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If from remote server you are sending a Directory include the &#039;&#039;&#039;-r&#039;&#039;&#039; flag in command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t -r /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This entry in the authorized_keys file uses the command option to restrict the SSH command that can be run with the associated SSH key. The command option specifies that the scp command should be used to transfer files to the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory on the server.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the entry:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;command=&amp;quot;/usr/bin/scp -t /home/rscp/&amp;quot;&#039;&#039;&#039;: This specifies that the scp command should be used as the SSH command for this key, with the &#039;&#039;&#039;-t&#039;&#039;&#039; option to specify that the remote end is a file (in this case, a directory), and the destination directory on the server is /home/rscp/. This means that the user can only use the SSH key to transfer files to the /home/rscp/ directory on the server.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039;: This is the public key associated with the private key that is used for authentication.&lt;br /&gt;
&lt;br /&gt;
By using the command option in this way, you can restrict the actions that the user can perform with the SSH key, which can help to improve security. In this case, the user can only transfer files to the specified directory on the server using the scp command.&lt;br /&gt;
&lt;br /&gt;
======Tip - transfer file to a path your USER does not have permissions for======&lt;br /&gt;
&lt;br /&gt;
You can write a shell script to check the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory every minute using a while loop and the sleep command. If any files are found in the directory, the script can move them to the &#039;&#039;&#039;/var/www/media&#039;&#039;&#039; directory using the mv command. Here&#039;s an example script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
  if [ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]; then&lt;br /&gt;
    mv /home/rscp/media/* /var/www/media/&lt;br /&gt;
  fi&lt;br /&gt;
  sleep 60&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this script, the while loop runs indefinitely (&#039;&#039;&#039;while true&#039;&#039;&#039;) and sleeps for 60 seconds at the end of each iteration (&#039;&#039;&#039;sleep 60&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;if&#039;&#039;&#039; statement checks if the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory is not empty (&#039;&#039;&#039;[ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]&#039;&#039;&#039;). If it is not empty, the &#039;&#039;&#039;mv&#039;&#039;&#039; command is used to move all files and directories from the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory to the &#039;&#039;&#039;/var/www/media/&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Save this script to a file (e.g. &#039;&#039;&#039;move-files.sh&#039;&#039;&#039;) and make it executable using the &#039;&#039;&#039;chmod +x move-files.sh&#039;&#039;&#039; command. You can then run the script using &#039;&#039;&#039;./move-files.sh &amp;amp;&#039;&#039;&#039; to start it in the background and allow it to run indefinitely. The &amp;amp; symbol is used to run the script in the background so that you can continue using the terminal.&lt;br /&gt;
&lt;br /&gt;
Note that running this script indefinitely can consume system resources, so you may want to consider setting up a scheduled task (e.g. using &#039;&#039;&#039;[[Cron_ubuntu_22.04|cron]]&#039;&#039;&#039;) to run the script at a specific interval instead of running it indefinitely.&lt;br /&gt;
&lt;br /&gt;
==Tilde &#039;&#039;&#039;~&#039;&#039;&#039; the escape character==&lt;br /&gt;
&lt;br /&gt;
The tilde (~) character has a special meaning in the context of SSH. When using SSH, you can use the tilde character followed by a control sequence to perform certain actions. These are called &amp;quot;tilde escape sequences&amp;quot; or &amp;quot;tilde commands.&amp;quot; They are useful for managing your SSH connections.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to use tilde escape sequences when connected to a remote server via SSH:&lt;br /&gt;
&lt;br /&gt;
:*    Make sure you are at the beginning of a new line in your terminal. Press &#039;&#039;&#039;Enter&#039;&#039;&#039; if you are not.&lt;br /&gt;
&lt;br /&gt;
:*    Type the tilde (~) character, followed by the appropriate control sequence. Note that you should not press &#039;&#039;&#039;Enter&#039;&#039;&#039; after typing the tilde character, but rather type the control sequence directly after it.&lt;br /&gt;
&lt;br /&gt;
Here are some common tilde escape sequences:&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;~.&#039;&#039;&#039; : Close the SSH connection. This can be helpful if the connection is frozen or unresponsive.&lt;br /&gt;
:    &#039;&#039;&#039;~^Z&#039;&#039;&#039; : Suspend the SSH connection and return to your local shell. You can later resume the connection using the fg command.&lt;br /&gt;
:    &#039;&#039;&#039;~#&#039;&#039;&#039; : List all forwarded connections (both local and remote) that are active in the current SSH session.&lt;br /&gt;
:    &#039;&#039;&#039;~&amp;amp;&#039;&#039;&#039; : Run the SSH session in the background. This is useful if you want to perform other tasks on your local machine without closing the SSH connection.&lt;br /&gt;
:    &#039;&#039;&#039;~~&#039;&#039;&#039; : Send a literal tilde character to the remote system. This is useful if you need to type a tilde character in the remote system without triggering an escape sequence.&lt;br /&gt;
&lt;br /&gt;
Remember that these escape sequences only work if they are entered at the beginning of a new line in your terminal. If you&#039;re typing them in the middle of a command or text, they won&#039;t be recognized as special control sequences.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting and Best Practices==&lt;br /&gt;
&lt;br /&gt;
In this section, we&#039;ll cover some common issues and best practices related to SSH connections, including managing a large number of SSH keys.&lt;br /&gt;
&lt;br /&gt;
===Too many authentication attempts===&lt;br /&gt;
&lt;br /&gt;
When connecting to an SSH server, you might encounter the &amp;quot;Too many authentication attempts&amp;quot; error. This is often caused by having too many private keys in your ~/.ssh directory. By default, SSH tries each key until it finds the correct one, but many servers limit the number of authentication attempts.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;: To resolve this issue, you can create a separate directory for your keys and configure the SSH config file to use the appropriate key for each connection.&lt;br /&gt;
&lt;br /&gt;
:*    Create a new directory for your keys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir ~/.ssh/keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Move your private key files to the new directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv ~/.ssh/id_rsa_* ~/.ssh/keys/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update your SSH config file to specify the correct key for each connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Host server1&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server1&lt;br /&gt;
&lt;br /&gt;
    Host server2&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permission issues=== &lt;br /&gt;
&lt;br /&gt;
SSH is very strict about file and directory permissions. Ensure that your ~/.ssh directory and its contents have the correct permissions:&lt;br /&gt;
&lt;br /&gt;
:*    The ~/.ssh directory should have permissions set to 700:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 700 ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private key files should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/id_rsa&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ~/.ssh/config file should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &amp;lt;b&amp;gt;Best practices&amp;lt;/b&amp;gt;: Follow these best practices to maintain secure and efficient SSH connections:&lt;br /&gt;
&lt;br /&gt;
:*    Use SSH key pairs instead of passwords for authentication, as they provide better security.&lt;br /&gt;
:*    Regularly update your SSH keys to maintain their security.&lt;br /&gt;
:*    Use strong, unique passphrases to protect your private keys.&lt;br /&gt;
:*    Disable password authentication and root login on your SSH server to reduce the risk of brute-force attacks.&lt;br /&gt;
:*    Regularly update your SSH server software to ensure you&#039;re running the latest security patches.&lt;br /&gt;
:*    Use non-standard port numbers for your SSH server to make it less likely to be targeted by automated attacks.&lt;br /&gt;
:*    Implement multi-factor authentication (MFA) for your SSH connections, if possible.&lt;br /&gt;
:*    Regularly review and remove any unnecessary authorized keys from the ~/.ssh/authorized_keys file on your servers.&lt;br /&gt;
:*    Use the Match directive in the sshd_config file to apply custom rules and settings for different users, groups, or connections.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=NixOS_ZFS_Encryption_on_root&amp;diff=455</id>
		<title>NixOS ZFS Encryption on root</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=NixOS_ZFS_Encryption_on_root&amp;diff=455"/>
		<updated>2024-04-28T14:13:04Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;==Prerequisites==  Going to Install NixOS with ZFS on root on a ThinkPad T470 with 24gb Ram and a 1TB nvme ssd.   * Live NixOS installer USB - nixos-plasma5-23.11.4761.5bf1cadb72ab-x86_64-linux.iso * Computer to install NixOS - will be wiping hard disk  ==Bootable Media - NixOS==  Create a thumb drive with a live NixOS installer and boot up  In this tut using &amp;lt;code&amp;gt;https://channels.nixos.org/nixos-23.11/latest-nixos-plasma5-x86_64-linux.iso&amp;lt;/code&amp;gt;   Once booted into Live...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Prerequisites==&lt;br /&gt;
&lt;br /&gt;
Going to Install NixOS with ZFS on root on a ThinkPad T470 with 24gb Ram and a 1TB nvme ssd.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Live NixOS installer USB - nixos-plasma5-23.11.4761.5bf1cadb72ab-x86_64-linux.iso&lt;br /&gt;
* Computer to install NixOS - will be wiping hard disk&lt;br /&gt;
&lt;br /&gt;
==Bootable Media - NixOS==&lt;br /&gt;
&lt;br /&gt;
Create a thumb drive with a live NixOS installer and boot up&lt;br /&gt;
&lt;br /&gt;
In this tut using &amp;lt;code&amp;gt;https://channels.nixos.org/nixos-23.11/latest-nixos-plasma5-x86_64-linux.iso&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Once booted into Live NixOS, close the default installer window that opens and connect laptop to power and internet.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
If you want to SSH into Live NixOS so you can follow notes and copy and paste commands&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&#039;&#039; Remove Default 15 Sleep mode on Live Installer&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
By default the NixOS live installer will go to sleep after 15 minutes of inactively.&amp;lt;br&amp;gt;&lt;br /&gt;
We are going to login to are live NixOS box with ssh so that would be bad.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&#039;&#039;KDE Plasma Desktop Live Installer&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
 &lt;br /&gt;
** click the &#039;&#039;&#039;Application Launcher&#039;&#039;&#039; in the &#039;&#039;&#039;Favorites&#039;&#039;&#039; section which should come up by default, click &#039;&#039;&#039;System Settings&#039;&#039;&#039; &amp;gt; &#039;&#039;&#039;Power Management&#039;&#039;&#039; &amp;gt; &#039;&#039;&#039;Energy Saving&#039;&#039;&#039; and untick &#039;&#039;&#039;Suspend session&#039;&#039;&#039; and click &#039;&#039;&#039;Apply&#039;&#039;&#039;, now we can close the window and get ready to ssh into are laptop running a live install of nixos.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&#039;&#039;Allow SSH Login to Live NixOS Installer&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The NixOS installer as two user accounts.&lt;br /&gt;
&lt;br /&gt;
* User: &#039;&#039;&#039;nixos&#039;&#039;&#039;&lt;br /&gt;
* User: &#039;&#039;&#039;root&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You only need to set a password for &#039;&#039;&#039;nixos&#039;&#039;&#039; as the user is on the sudoers, you can just use &amp;lt;code&amp;gt;sudo -s&amp;lt;/code&amp;gt; to upgrade to user &#039;&#039;&#039;root&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Open the &#039;&#039;&#039;Konsole&#039;&#039;&#039; terminal, you should see &#039;&#039;&#039;ICON&#039;&#039;&#039; on Desktop.&lt;br /&gt;
&lt;br /&gt;
To ssh in as user &#039;&#039;&#039;nixos&#039;&#039;&#039; the user will require a password.&lt;br /&gt;
* After running this command you will be prompted to enter a password for the user &#039;&#039;&#039;nixos&#039;&#039;&#039;, you will use this to login.&lt;br /&gt;
&amp;lt;code&amp;gt;passwd nixos&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&#039;&#039;Find the IP address NixOS as been assigned&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ip addr&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Which show my LAN IP address address the router as issued for the nix os box as 192.168.0.161&lt;br /&gt;
&lt;br /&gt;
Return Output from command &#039;&#039;&#039;ip addr&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[nixos@nixos:~]$ ip addr&lt;br /&gt;
1: lo: &amp;lt;LOOPBACK,UP,LOWER_UP&amp;gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000&lt;br /&gt;
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00&lt;br /&gt;
    inet 127.0.0.1/8 scope host lo&lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
    inet6 ::1/128 scope host &lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
2: enp0s31f6: &amp;lt;NO-CARRIER,BROADCAST,MULTICAST,UP&amp;gt; mtu 1500 qdisc fq_codel state DOWN group default qlen 1000&lt;br /&gt;
    link/ether e8:6a:64:8f:ea:ae brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
3: wlp4s0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default qlen 1000&lt;br /&gt;
    link/ether 38:ba:f8:8b:d7:b0 brd ff:ff:ff:ff:ff:ff&lt;br /&gt;
    inet 192.168.0.161/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp4s0&lt;br /&gt;
       valid_lft 86345sec preferred_lft 86345sec&lt;br /&gt;
    inet6 fe80::bc45:cc59:3e71:d08/64 scope link noprefixroute &lt;br /&gt;
       valid_lft forever preferred_lft forever&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;ip addr&#039;&#039;&#039; command and output:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;What is &#039;ip addr&#039;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ip addr&#039;&#039;&#039; command is a tool that allows you to manage and display the IP addresses assigned to your computer&#039;s network interfaces. In simpler terms, it&#039;s a command that helps you see what &#039;internet addresses&#039; your computer is using to connect to the internet or other networks.&lt;br /&gt;
&lt;br /&gt;
When you run &#039;&#039;&#039;ip addr&#039;&#039;&#039;, your computer returns a list of all the network connections it has, like Wi-Fi and Ethernet, and the details about each one.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Understanding the Output&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s break down what you&#039;ll typically see when you run this command:&lt;br /&gt;
&lt;br /&gt;
#* &#039;&#039;&#039;&#039;&#039;Loopback Interface (lo) &#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1: lo: &amp;amp;lt;LOOPBACK,UP,LOWER_UP&amp;amp;gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000&lt;br /&gt;
    inet 127.0.0.1/8 scope host lo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;lo&#039;&#039;&#039; is a special network interface that your computer uses to communicate with itself.&lt;br /&gt;
* &#039;&#039;&#039;inet 127.0.0.1/8&#039;&#039;&#039; is its IP address. &#039;&#039;&#039;127.0.0.1&#039;&#039;&#039; is like your computer&#039;s own &#039;home&#039; address.&lt;br /&gt;
&lt;br /&gt;
#* &#039;&#039;&#039;&#039;&#039;Ethernet Interface (enp0s31f6) &#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2: enp0s31f6: &amp;amp;lt;NO-CARRIER,BROADCAST,MULTICAST,UP&amp;amp;gt; mtu 1500 qdisc fq_codel state DOWN group default qlen 1000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;enp0s31f6&#039;&#039;&#039; is an Ethernet interface, which means it&#039;s what your computer uses when it&#039;s connected to the internet with a cable.&lt;br /&gt;
* &#039;&#039;&#039;state DOWN&#039;&#039;&#039; means that this interface is not currently active (maybe the cable is unplugged).&lt;br /&gt;
&lt;br /&gt;
#*&#039;&#039;&#039;&#039;&#039;Wi-Fi Interface (wlp4s0)&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
3: wlp4s0: &amp;amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;amp;gt; mtu 1500 qdisc noqueue state UP group default qlen 1000&lt;br /&gt;
    inet 192.168.0.161/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp4s0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;wlp4s0&#039;&#039;&#039; is a Wi-Fi interface, which means this is what your computer uses when it&#039;s connected to Wi-Fi.&lt;br /&gt;
* &#039;&#039;&#039;inet 192.168.0.161/24&#039;&#039;&#039; is the IP address given to your computer by your Wi-Fi router.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;SSH into NixOS Laptop&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Now we can ssh into are NixOS Laptop and get started.&lt;br /&gt;
&lt;br /&gt;
From the Macbook going to open a &#039;&#039;&#039;Terminal&#039;&#039;&#039; and login:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh nixos@192.168.0.161&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will be prompted to enter password for user &#039;&#039;&#039;nixos&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== find hard drive===&lt;br /&gt;
&amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; &lt;br /&gt;
* &#039;&#039;&#039;lsblk&#039;&#039;&#039; stands for &#039;&#039;&#039;list block devices&#039;&#039;&#039; and more info can be found in the manual page by typing &#039;&#039;&#039;&#039;&#039;man lsblk&#039;&#039;&#039;&#039;&#039; in terminal&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[nixos@nixos:~]$ lsblk&lt;br /&gt;
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
loop0     7:0    0   2.5G  1 loop /nix/.ro-store&lt;br /&gt;
sda       8:0    1   7.3G  0 disk &lt;br /&gt;
├─sda1    8:1    1   2.5G  0 part /iso&lt;br /&gt;
└─sda2    8:2    1     3M  0 part &lt;br /&gt;
sdb       8:16   1     0B  0 disk &lt;br /&gt;
nvme0n1 259:0    0 931.5G  0 disk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;sda&#039;&#039;&#039; is the Live Boot Media (NixOS USB)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;nvme0n1&#039;&#039;&#039; is the laptops hard drive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: swap should be equal to ram at least or double.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== nuke hard drive ===&lt;br /&gt;
&lt;br /&gt;
This will wipe the hard drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sgdisk --zap-all /dev/nvme0n1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[nixos@nixos:~]$ sudo sgdisk --zap-all /dev/nvme0n1&lt;br /&gt;
GPT data structures destroyed! You may now partition the disk using fdisk or&lt;br /&gt;
other utilities.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== create partitions ===&lt;br /&gt;
&lt;br /&gt;
Gonna duel boot with FreeBSD Later - so not using all of hard drive&lt;br /&gt;
&lt;br /&gt;
* EFI 2GB&lt;br /&gt;
* NixOS Main 500GB&lt;br /&gt;
* NixOS Swap 16GB&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo fdisk /dev/nvme0n1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Welcome to fdisk (util-linux 2.38.1).&lt;br /&gt;
Changes will remain in memory only, until you decide to write them.&lt;br /&gt;
Be careful before using the write command.&lt;br /&gt;
&lt;br /&gt;
Device does not contain a recognized partition table.&lt;br /&gt;
Created a new DOS disklabel with disk identifier 0x244b4973.&lt;br /&gt;
&lt;br /&gt;
Command (m for help): &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== GPT disklabel====&lt;br /&gt;
Create GPT disklabel by pressing &#039;&#039;&#039;g&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created a new GPT disklabel (GUID: 617C1730-CC18-A44D-8C70-3E3939D1BCC8).&lt;br /&gt;
&lt;br /&gt;
Command (m for help): &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
When you press &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; after running this command, you will be initiating the creation of a new empty GPT (GUID Partition Table) partition table on the disk /dev/nvme0n1. &amp;lt;br&amp;gt;&lt;br /&gt;
GPT is a modern partitioning scheme that is part of the UEFI standard, replacing the older MBR (Master Boot Record) scheme used by BIOS systems. It supports larger disk sizes and more partitions than MBR.&lt;br /&gt;
&lt;br /&gt;
==== EFI partition====&lt;br /&gt;
Crete EFI partition by first creating a new partition using &#039;&#039;&#039;n&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Partition number (1-128, default 1): &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The default should be partition 1, which can be selected by just pressing &#039;&#039;&#039;Enter&#039;&#039;&#039; or entering &#039;&#039;&#039;1&#039;&#039;&#039; and pressing &#039;&#039;&#039;Enter&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;First section&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
First sector (2048-1953525134, default 2048): MORE INFO&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
First Sector: This is the starting sector for the new partition you&#039;re creating. In disk partitioning, a &amp;quot;sector&amp;quot; is the smallest unit that can be accessed on the disk. Historically, a sector holds 512 bytes, but newer disks might use larger sector sizes.&lt;br /&gt;
&lt;br /&gt;
Range (2048-1953525134): This is the range of sectors you can choose from for the starting point of the new partition. The numbers are sector indices on the disk.&lt;br /&gt;
&lt;br /&gt;
The lower bound 2048 is often the default starting point for the first partition in modern systems using GPT (GUID Partition Table). This offset is used to align partitions correctly for performance reasons and to provide some space for the bootloader and partition table.&lt;br /&gt;
The upper bound 1953525134 represents the last sector on the disk that can be used as a starting point for the new partition.&lt;br /&gt;
Default (2048): This indicates the default choice that fdisk will use if you simply press Enter without typing a number. It&#039;s recommending you start the partition at sector 2048.&lt;br /&gt;
&lt;br /&gt;
Choosing the default is usually safe and aligns with most modern storage devices&#039; requirements for optimal performance and alignment.&lt;br /&gt;
Why Start at Sector 2048?: Starting at sector 2048 leaves enough room for the primary GPT header and the partition entries. This is part of the standard layout for GPT disks. It&#039;s a best practice to follow these defaults unless you have a specific reason to deviate, such as specific alignment needs or following a custom partitioning scheme.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;First sector (2048-1953525134, default 2048):&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We want the default first sector of 2048, so just press ENTER&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Create a 2 GB partition for EFI&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The Return Output from the last command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1953525134, default 1953523711):&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;code&amp;gt;+2GB&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;+2GB&amp;lt;/code&amp;gt; Explained:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The line &#039;&#039;&#039;+2GB&#039;&#039;&#039; is a simple directive used in the &#039;&#039;&#039;fdisk&#039;&#039;&#039; utility to specify the size of the new partition you are creating. Here&#039;s what it means:&lt;br /&gt;
&lt;br /&gt;
&amp;quot;+&amp;quot; Symbol: This indicates that the size specified is to be added to the starting sector of the partition. It&#039;s a way of specifying how much space to allocate for the partition, starting from the beginning sector you selected (or the default starting sector).&lt;br /&gt;
&lt;br /&gt;
&amp;quot;2GB&amp;quot;: This specifies the size of the partition. In this case, it&#039;s 2 gigabytes. This is the amount of disk space that will be allocated to the new partition.&lt;br /&gt;
&lt;br /&gt;
So, when you input +2GB in fdisk after choosing to create a new partition (n command), you are instructing fdisk to create a new partition that is 2 gigabytes in size. This is a common size for an EFI (Extensible Firmware Interface) system partition, which is used as a boot partition in modern computers with UEFI firmware.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Select type of partiton&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
the &#039;&#039;&#039;t&#039;&#039;&#039; command is used for changing the type of a partition.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Return OutPut:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Command (m for help): t&lt;br /&gt;
Selected partition 1&lt;br /&gt;
Partition type or alias (type L to list all):&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Command &#039;&#039;&#039;t&#039;&#039;&#039; More info&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Command &#039;t&#039;: When you enter the t command in fdisk, it prompts you to change the type of an existing partition. This is important because the type of a partition can determine how the operating system and firmware interact with it.&lt;br /&gt;
&lt;br /&gt;
Selecting a Partition: If you have more than one partition on your disk, fdisk will first ask you to specify which partition you want to change the type of. You do this by entering the partition number (e.g., 1, 2, etc.).&lt;br /&gt;
&lt;br /&gt;
Partition Types: Each partition type is represented by a unique code or identifier. These types correspond to different uses, such as Linux filesystems, EFI system partitions, swap areas, etc. The partition type tells the system how to treat that partition – for example, whether it&#039;s a bootable system partition, a data storage area, or something else.&lt;br /&gt;
&lt;br /&gt;
Input for EFI System Partition: When you enter 1 after the t command in the context of setting up an EFI partition, it sets the selected partition&#039;s type to &#039;EFI System&#039;. This type is used for EFI boot partitions, which are necessary for systems with UEFI firmware. The EFI partition holds the boot loaders and other data needed for starting the operating system.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Set Type as &amp;quot;EFI system&amp;quot; &#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
1 = EFI system, just type 1 and hit Enter&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Partition type or alias (type L to list all): 1&lt;br /&gt;
Changed type of partition &#039;Linux filesystem&#039; to &#039;EFI System&#039;.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Output from pressing &#039;&#039;&#039;L&#039;&#039;&#039;&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Partition type or alias (type L to list all): L&lt;br /&gt;
  1 EFI System                     C12A7328-F81F-11D2-BA4B-00A0C93EC93B&lt;br /&gt;
  2 MBR partition scheme           024DEE41-33E7-11D3-9D69-0008C781F39F&lt;br /&gt;
  3 Intel Fast Flash               D3BFE2DE-3DAF-11DF-BA40-E3A556D89593&lt;br /&gt;
  4 BIOS boot                      21686148-6449-6E6F-744E-656564454649&lt;br /&gt;
  5 Sony boot partition            F4019732-066E-4E12-8273-346C5641494F&lt;br /&gt;
  6 Lenovo boot partition          BFBFAFE7-A34F-448A-9A5B-6213EB736C22&lt;br /&gt;
  7 PowerPC PReP boot              9E1A2D38-C612-4316-AA26-8B49521E5A8B&lt;br /&gt;
  8 ONIE boot                      7412F7D5-A156-4B13-81DC-867174929325&lt;br /&gt;
  9 ONIE config                    D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149&lt;br /&gt;
 10 Microsoft reserved             E3C9E316-0B5C-4DB8-817D-F92DF00215AE&lt;br /&gt;
 11 Microsoft basic data           EBD0A0A2-B9E5-4433-87C0-68B6B72699C7&lt;br /&gt;
 12 Microsoft LDM metadata         5808C8AA-7E8F-42E0-85D2-E1E90434CFB3&lt;br /&gt;
 13 Microsoft LDM data             AF9B60A0-1431-4F62-BC68-3311714A69AD&lt;br /&gt;
 14 Windows recovery environment   DE94BBA4-06D1-4D40-A16A-BFD50179D6AC&lt;br /&gt;
 15 IBM General Parallel Fs        37AFFC90-EF7D-4E96-91C3-2D7AE055B174&lt;br /&gt;
 16 Microsoft Storage Spaces       E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D&lt;br /&gt;
 17 HP-UX data                     75894C1E-3AEB-11D3-B7C1-7B03A0000000&lt;br /&gt;
 18 HP-UX service                  E2A1E728-32E3-11D6-A682-7B03A0000000&lt;br /&gt;
 19 Linux swap                     0657FD6D-A4AB-43C4-84E5-0933C84B4F4F&lt;br /&gt;
 20 Linux filesystem               0FC63DAF-8483-4772-8E79-3D69D8477DE4&lt;br /&gt;
 21 Linux server data              3B8F8425-20E0-4F3B-907F-1A25A76F98E8&lt;br /&gt;
 22 Linux root (x86)               44479540-F297-41B2-9AF7-D131D5F0458A&lt;br /&gt;
 23 Linux root (x86-64)            4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709&lt;br /&gt;
 24 Linux root (Alpha)             6523F8AE-3EB1-4E2A-A05A-18B695AE656F&lt;br /&gt;
 25 Linux root (ARC)               D27F46ED-2919-4CB8-BD25-9531F3C16534&lt;br /&gt;
 26 Linux root (ARM)               69DAD710-2CE4-4E3C-B16C-21A1D49ABED3&lt;br /&gt;
 27 Linux root (ARM-64)            B921B045-1DF0-41C3-AF44-4C6F280D3FAE&lt;br /&gt;
 28 Linux root (IA-64)             993D8D3D-F80E-4225-855A-9DAF8ED7EA97&lt;br /&gt;
 29 Linux root (LoongArch-64)      77055800-792C-4F94-B39A-98C91B762BB6&lt;br /&gt;
 30 Linux root (MIPS-32 LE)        37C58C8A-D913-4156-A25F-48B1B64E07F0&lt;br /&gt;
 31 Linux root (MIPS-64 LE)        700BDA43-7A34-4507-B179-EEB93D7A7CA3&lt;br /&gt;
 32 Linux root (PPC)               1DE3F1EF-FA98-47B5-8DCD-4A860A654D78&lt;br /&gt;
 33 Linux root (PPC64)             912ADE1D-A839-4913-8964-A10EEE08FBD2&lt;br /&gt;
 34 Linux root (PPC64LE)           C31C45E6-3F39-412E-80FB-4809C4980599&lt;br /&gt;
 35 Linux root (RISC-V-32)         60D5A7FE-8E7D-435C-B714-3DD8162144E1&lt;br /&gt;
 36 Linux root (RISC-V-64)         72EC70A6-CF74-40E6-BD49-4BDA08E8F224&lt;br /&gt;
 37 Linux root (S390)              08A7ACEA-624C-4A20-91E8-6E0FA67D23F9&lt;br /&gt;
 38 Linux root (S390X)             5EEAD9A9-FE09-4A1E-A1D7-520D00531306&lt;br /&gt;
 39 Linux root (TILE-Gx)           C50CDD70-3862-4CC3-90E1-809A8C93EE2C&lt;br /&gt;
 40 Linux reserved                 8DA63339-0007-60C0-C436-083AC8230908&lt;br /&gt;
 41 Linux home                     933AC7E1-2EB4-4F13-B844-0E14E2AEF915&lt;br /&gt;
 42 Linux RAID                     A19D880F-05FC-4D3B-A006-743F0F84911E&lt;br /&gt;
 43 Linux LVM                      E6D6D379-F507-44C2-A23C-238F2A3DF928&lt;br /&gt;
 44 Linux variable data            4D21B016-B534-45C2-A9FB-5C16E091FD2D&lt;br /&gt;
 45 Linux temporary data           7EC6F557-3BC5-4ACA-B293-16EF5DF639D1&lt;br /&gt;
 46 Linux /usr (x86)               75250D76-8CC6-458E-BD66-BD47CC81A812&lt;br /&gt;
 47 Linux /usr (x86-64)            8484680C-9521-48C6-9C11-B0720656F69E&lt;br /&gt;
 48 Linux /usr (Alpha)             E18CF08C-33EC-4C0D-8246-C6C6FB3DA024&lt;br /&gt;
 49 Linux /usr (ARC)               7978A683-6316-4922-BBEE-38BFF5A2FECC&lt;br /&gt;
 50 Linux /usr (ARM)               7D0359A3-02B3-4F0A-865C-654403E70625&lt;br /&gt;
 51 Linux /usr (ARM-64)            B0E01050-EE5F-4390-949A-9101B17104E9&lt;br /&gt;
 52 Linux /usr (IA-64)             4301D2A6-4E3B-4B2A-BB94-9E0B2C4225EA&lt;br /&gt;
 53 Linux /usr (LoongArch-64)      E611C702-575C-4CBE-9A46-434FA0BF7E3F&lt;br /&gt;
 54 Linux /usr (MIPS-32 LE)        0F4868E9-9952-4706-979F-3ED3A473E947&lt;br /&gt;
 55 Linux /usr (MIPS-64 LE)        C97C1F32-BA06-40B4-9F22-236061B08AA8&lt;br /&gt;
 56 Linux /usr (PPC)               7D14FEC5-CC71-415D-9D6C-06BF0B3C3EAF&lt;br /&gt;
 57 Linux /usr (PPC64)             2C9739E2-F068-46B3-9FD0-01C5A9AFBCCA&lt;br /&gt;
 58 Linux /usr (PPC64LE)           15BB03AF-77E7-4D4A-B12B-C0D084F7491C&lt;br /&gt;
 59 Linux /usr (RISC-V-32)         B933FB22-5C3F-4F91-AF90-E2BB0FA50702&lt;br /&gt;
 60 Linux /usr (RISC-V-64)         BEAEC34B-8442-439B-A40B-984381ED097D&lt;br /&gt;
 61 Linux /usr (S390)              CD0F869B-D0FB-4CA0-B141-9EA87CC78D66&lt;br /&gt;
 62 Linux /usr (S390X)             8A4F5770-50AA-4ED3-874A-99B710DB6FEA&lt;br /&gt;
 63 Linux /usr (TILE-Gx)           55497029-C7C1-44CC-AA39-815ED1558630&lt;br /&gt;
 64 Linux root verity (x86)        D13C5D3B-B5D1-422A-B29F-9454FDC89D76&lt;br /&gt;
 65 Linux root verity (x86-64)     2C7357ED-EBD2-46D9-AEC1-23D437EC2BF5&lt;br /&gt;
 66 Linux root verity (Alpha)      FC56D9E9-E6E5-4C06-BE32-E74407CE09A5&lt;br /&gt;
 67 Linux root verity (ARC)        24B2D975-0F97-4521-AFA1-CD531E421B8D&lt;br /&gt;
 68 Linux root verity (ARM)        7386CDF2-203C-47A9-A498-F2ECCE45A2D6&lt;br /&gt;
 69 Linux root verity (ARM-64)     DF3300CE-D69F-4C92-978C-9BFB0F38D820&lt;br /&gt;
 70 Linux root verity (IA-64)      86ED10D5-B607-45BB-8957-D350F23D0571&lt;br /&gt;
 71 Linux root verity (LoongArch-64) F3393B22-E9AF-4613-A948-9D3BFBD0C535&lt;br /&gt;
 72 Linux root verity (MIPS-32 LE) D7D150D2-2A04-4A33-8F12-16651205FF7B&lt;br /&gt;
 73 Linux root verity (MIPS-64 LE) 16B417F8-3E06-4F57-8DD2-9B5232F41AA6&lt;br /&gt;
 74 Linux root verity (PPC)        98CFE649-1588-46DC-B2F0-ADD147424925&lt;br /&gt;
 75 Linux root verity (PPC64)      9225A9A3-3C19-4D89-B4F6-EEFF88F17631&lt;br /&gt;
 76 Linux root verity (PPC64LE)    906BD944-4589-4AAE-A4E4-DD983917446A&lt;br /&gt;
 77 Linux root verity (RISC-V-32)  AE0253BE-1167-4007-AC68-43926C14C5DE&lt;br /&gt;
 78 Linux root verity (RISC-V-64)  B6ED5582-440B-4209-B8DA-5FF7C419EA3D&lt;br /&gt;
 79 Linux root verity (S390)       7AC63B47-B25C-463B-8DF8-B4A94E6C90E1&lt;br /&gt;
 80 Linux root verity (S390X)      B325BFBE-C7BE-4AB8-8357-139E652D2F6B&lt;br /&gt;
 81 Linux root verity (TILE-Gx)    966061EC-28E4-4B2E-B4A5-1F0A825A1D84&lt;br /&gt;
 82 Linux /usr verity (x86)        8F461B0D-14EE-4E81-9AA9-049B6FB97ABD&lt;br /&gt;
 83 Linux /usr verity (x86-64)     77FF5F63-E7B6-4633-ACF4-1565B864C0E6&lt;br /&gt;
 84 Linux /usr verity (Alpha)      8CCE0D25-C0D0-4A44-BD87-46331BF1DF67&lt;br /&gt;
 85 Linux /usr verity (ARC)        FCA0598C-D880-4591-8C16-4EDA05C7347C&lt;br /&gt;
 86 Linux /usr verity (ARM)        C215D751-7BCD-4649-BE90-6627490A4C05&lt;br /&gt;
 87 Linux /usr verity (ARM-64)     6E11A4E7-FBCA-4DED-B9E9-E1A512BB664E&lt;br /&gt;
 88 Linux /usr verity (IA-64)      6A491E03-3BE7-4545-8E38-83320E0EA880&lt;br /&gt;
 89 Linux /usr verity (LoongArch-64) F46B2C26-59AE-48F0-9106-C50ED47F673D&lt;br /&gt;
 90 Linux /usr verity (MIPS-32 LE) 46B98D8D-B55C-4E8F-AAB3-37FCA7F80752&lt;br /&gt;
 91 Linux /usr verity (MIPS-64 LE) 3C3D61FE-B5F3-414D-BB71-8739A694A4EF&lt;br /&gt;
 92 Linux /usr verity (PPC)        DF765D00-270E-49E5-BC75-F47BB2118B09&lt;br /&gt;
 93 Linux /usr verity (PPC64)      BDB528A5-A259-475F-A87D-DA53FA736A07&lt;br /&gt;
 94 Linux /usr verity (PPC64LE)    EE2B9983-21E8-4153-86D9-B6901A54D1CE&lt;br /&gt;
 95 Linux /usr verity (RISC-V-32)  CB1EE4E3-8CD0-4136-A0A4-AA61A32E8730&lt;br /&gt;
 96 Linux /usr verity (RISC-V-64)  8F1056BE-9B05-47C4-81D6-BE53128E5B54&lt;br /&gt;
 97 Linux /usr verity (S390)       B663C618-E7BC-4D6D-90AA-11B756BB1797&lt;br /&gt;
 98 Linux /usr verity (S390X)      31741CC4-1A2A-4111-A581-E00B447D2D06&lt;br /&gt;
 99 Linux /usr verity (TILE-Gx)    2FB4BF56-07FA-42DA-8132-6B139F2026AE&lt;br /&gt;
100 Linux root verity sign. (x86)  5996FC05-109C-48DE-808B-23FA0830B676&lt;br /&gt;
101 Linux root verity sign. (x86-64) 41092B05-9FC8-4523-994F-2DEF0408B176&lt;br /&gt;
102 Linux root verity sign. (Alpha) D46495B7-A053-414F-80F7-700C99921EF8&lt;br /&gt;
103 Linux root verity sign. (ARC)  143A70BA-CBD3-4F06-919F-6C05683A78BC&lt;br /&gt;
104 Linux root verity sign. (ARM)  42B0455F-EB11-491D-98D3-56145BA9D037&lt;br /&gt;
105 Linux root verity sign. (ARM-64) 6DB69DE6-29F4-4758-A7A5-962190F00CE3&lt;br /&gt;
106 Linux root verity sign. (IA-64) E98B36EE-32BA-4882-9B12-0CE14655F46A&lt;br /&gt;
107 Linux root verity sign. (LoongArch-64) 5AFB67EB-ECC8-4F85-AE8E-AC1E7C50E7D0&lt;br /&gt;
108 Linux root verity sign. (MIPS-32 LE) C919CC1F-4456-4EFF-918C-F75E94525CA5&lt;br /&gt;
109 Linux root verity sign. (MIPS-64 LE) 904E58EF-5C65-4A31-9C57-6AF5FC7C5DE7&lt;br /&gt;
110 Linux root verity sign. (PPC)  1B31B5AA-ADD9-463A-B2ED-BD467FC857E7&lt;br /&gt;
111 Linux root verity sign. (PPC64) F5E2C20C-45B2-4FFA-BCE9-2A60737E1AAF&lt;br /&gt;
112 Linux root verity sign. (PPC64LE) D4A236E7-E873-4C07-BF1D-BF6CF7F1C3C6&lt;br /&gt;
113 Linux root verity sign. (RISC-V-32) 3A112A75-8729-4380-B4CF-764D79934448&lt;br /&gt;
114 Linux root verity sign. (RISC-V-64) EFE0F087-EA8D-4469-821A-4C2A96A8386A&lt;br /&gt;
115 Linux root verity sign. (S390) 3482388E-4254-435A-A241-766A065F9960&lt;br /&gt;
116 Linux root verity sign. (S390X) C80187A5-73A3-491A-901A-017C3FA953E9&lt;br /&gt;
117 Linux root verity sign. (TILE-Gx) B3671439-97B0-4A53-90F7-2D5A8F3AD47B&lt;br /&gt;
118 Linux /usr verity sign. (x86)  974A71C0-DE41-43C3-BE5D-5C5CCD1AD2C0&lt;br /&gt;
119 Linux /usr verity sign. (x86-64) E7BB33FB-06CF-4E81-8273-E543B413E2E2&lt;br /&gt;
120 Linux /usr verity sign. (Alpha) 5C6E1C76-076A-457A-A0FE-F3B4CD21CE6E&lt;br /&gt;
121 Linux /usr verity sign. (ARC)  94F9A9A1-9971-427A-A400-50CB297F0F35&lt;br /&gt;
122 Linux /usr verity sign. (ARM)  D7FF812F-37D1-4902-A810-D76BA57B975A&lt;br /&gt;
123 Linux /usr verity sign. (ARM-64) C23CE4FF-44BD-4B00-B2D4-B41B3419E02A&lt;br /&gt;
124 Linux /usr verity sign. (IA-64) 8DE58BC2-2A43-460D-B14E-A76E4A17B47F&lt;br /&gt;
125 Linux /usr verity sign. (LoongArch-64) B024F315-D330-444C-8461-44BBDE524E99&lt;br /&gt;
126 Linux /usr verity sign. (MIPS-32 LE) 3E23CA0B-A4BC-4B4E-8087-5AB6A26AA8A9&lt;br /&gt;
127 Linux /usr verity sign. (MIPS-64 LE) F2C2C7EE-ADCC-4351-B5C6-EE9816B66E16&lt;br /&gt;
128 Linux /usr verity sign. (PPC)  7007891D-D371-4A80-86A4-5CB875B9302E&lt;br /&gt;
129 Linux /usr verity sign. (PPC64) 0B888863-D7F8-4D9E-9766-239FCE4D58AF&lt;br /&gt;
130 Linux /usr verity sign. (PPC64LE) C8BFBD1E-268E-4521-8BBA-BF314C399557&lt;br /&gt;
131 Linux /usr verity sign. (RISC-V-32) C3836A13-3137-45BA-B583-B16C50FE5EB4&lt;br /&gt;
132 Linux /usr verity sign. (RISC-V-64) D2F9000A-7A18-453F-B5CD-4D32F77A7B32&lt;br /&gt;
133 Linux /usr verity sign. (S390) 17440E4F-A8D0-467F-A46E-3912AE6EF2C5&lt;br /&gt;
134 Linux /usr verity sign. (S390X) 3F324816-667B-46AE-86EE-9B0C0C6C11B4&lt;br /&gt;
135 Linux /usr verity sign. (TILE-Gx) 4EDE75E2-6CCC-4CC8-B9C7-70334B087510&lt;br /&gt;
136 Linux extended boot            BC13C2FF-59E6-4262-A352-B275FD6F7172&lt;br /&gt;
137 Linux user&#039;s home              773f91ef-66d4-49b5-bd83-d683bf40ad16&lt;br /&gt;
138 FreeBSD data                   516E7CB4-6ECF-11D6-8FF8-00022D09712B&lt;br /&gt;
139 FreeBSD boot                   83BD6B9D-7F41-11DC-BE0B-001560B84F0F&lt;br /&gt;
140 FreeBSD swap                   516E7CB5-6ECF-11D6-8FF8-00022D09712B&lt;br /&gt;
141 FreeBSD UFS                    516E7CB6-6ECF-11D6-8FF8-00022D09712B&lt;br /&gt;
142 FreeBSD ZFS                    516E7CBA-6ECF-11D6-8FF8-00022D09712B&lt;br /&gt;
143 FreeBSD Vinum                  516E7CB8-6ECF-11D6-8FF8-00022D09712B&lt;br /&gt;
144 Apple HFS/HFS+                 48465300-0000-11AA-AA11-00306543ECAC&lt;br /&gt;
145 Apple APFS                     7C3457EF-0000-11AA-AA11-00306543ECAC&lt;br /&gt;
146 Apple UFS                      55465300-0000-11AA-AA11-00306543ECAC&lt;br /&gt;
147 Apple RAID                     52414944-0000-11AA-AA11-00306543ECAC&lt;br /&gt;
148 Apple RAID offline             52414944-5F4F-11AA-AA11-00306543ECAC&lt;br /&gt;
149 Apple boot                     426F6F74-0000-11AA-AA11-00306543ECAC&lt;br /&gt;
150 Apple label                    4C616265-6C00-11AA-AA11-00306543ECAC&lt;br /&gt;
151 Apple TV recovery              5265636F-7665-11AA-AA11-00306543ECAC&lt;br /&gt;
152 Apple Core storage             53746F72-6167-11AA-AA11-00306543ECAC&lt;br /&gt;
153 Apple Silicon boot             69646961-6700-11AA-AA11-00306543ECAC&lt;br /&gt;
154 Apple Silicon recovery         52637672-7900-11AA-AA11-00306543ECAC&lt;br /&gt;
155 Solaris boot                   6A82CB45-1DD2-11B2-99A6-080020736631&lt;br /&gt;
156 Solaris root                   6A85CF4D-1DD2-11B2-99A6-080020736631&lt;br /&gt;
157 Solaris /usr &amp;amp; Apple ZFS       6A898CC3-1DD2-11B2-99A6-080020736631&lt;br /&gt;
158 Solaris swap                   6A87C46F-1DD2-11B2-99A6-080020736631&lt;br /&gt;
159 Solaris backup                 6A8B642B-1DD2-11B2-99A6-080020736631&lt;br /&gt;
160 Solaris /var                   6A8EF2E9-1DD2-11B2-99A6-080020736631&lt;br /&gt;
161 Solaris /home                  6A90BA39-1DD2-11B2-99A6-080020736631&lt;br /&gt;
162 Solaris alternate sector       6A9283A5-1DD2-11B2-99A6-080020736631&lt;br /&gt;
163 Solaris reserved 1             6A945A3B-1DD2-11B2-99A6-080020736631&lt;br /&gt;
164 Solaris reserved 2             6A9630D1-1DD2-11B2-99A6-080020736631&lt;br /&gt;
165 Solaris reserved 3             6A980767-1DD2-11B2-99A6-080020736631&lt;br /&gt;
166 Solaris reserved 4             6A96237F-1DD2-11B2-99A6-080020736631&lt;br /&gt;
167 Solaris reserved 5             6A8D2AC7-1DD2-11B2-99A6-080020736631&lt;br /&gt;
168 NetBSD swap                    49F48D32-B10E-11DC-B99B-0019D1879648&lt;br /&gt;
169 NetBSD FFS                     49F48D5A-B10E-11DC-B99B-0019D1879648&lt;br /&gt;
170 NetBSD LFS                     49F48D82-B10E-11DC-B99B-0019D1879648&lt;br /&gt;
171 NetBSD concatenated            2DB519C4-B10F-11DC-B99B-0019D1879648&lt;br /&gt;
172 NetBSD encrypted               2DB519EC-B10F-11DC-B99B-0019D1879648&lt;br /&gt;
173 NetBSD RAID                    49F48DAA-B10E-11DC-B99B-0019D1879648&lt;br /&gt;
174 ChromeOS kernel                FE3A2A5D-4F32-41A7-B725-ACCC3285A309&lt;br /&gt;
175 ChromeOS root fs               3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC&lt;br /&gt;
176 ChromeOS reserved              2E0A753D-9E48-43B0-8337-B15192CB1B5E&lt;br /&gt;
177 MidnightBSD data               85D5E45A-237C-11E1-B4B3-E89A8F7FC3A7&lt;br /&gt;
178 MidnightBSD boot               85D5E45E-237C-11E1-B4B3-E89A8F7FC3A7&lt;br /&gt;
179 MidnightBSD swap               85D5E45B-237C-11E1-B4B3-E89A8F7FC3A7&lt;br /&gt;
180 MidnightBSD UFS                0394EF8B-237E-11E1-B4B3-E89A8F7FC3A7&lt;br /&gt;
181 MidnightBSD ZFS                85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7&lt;br /&gt;
182 MidnightBSD Vinum              85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7&lt;br /&gt;
183 Ceph Journal                   45B0969E-9B03-4F30-B4C6-B4B80CEFF106&lt;br /&gt;
184 Ceph Encrypted Journal         45B0969E-9B03-4F30-B4C6-5EC00CEFF106&lt;br /&gt;
185 Ceph OSD                       4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D&lt;br /&gt;
186 Ceph crypt OSD                 4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D&lt;br /&gt;
187 Ceph disk in creation          89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE&lt;br /&gt;
188 Ceph crypt disk in creation    89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE&lt;br /&gt;
189 VMware VMFS                    AA31E02A-400F-11DB-9590-000C2911D1B8&lt;br /&gt;
190 VMware Diagnostic              9D275380-40AD-11DB-BF97-000C2911D1B8&lt;br /&gt;
191 VMware Virtual SAN             381CFCCC-7288-11E0-92EE-000C2911D0B2&lt;br /&gt;
192 VMware Virsto                  77719A0C-A4A0-11E3-A47E-000C29745A24&lt;br /&gt;
193 VMware Reserved                9198EFFC-31C0-11DB-8F78-000C2911D1B8&lt;br /&gt;
194 OpenBSD data                   824CC7A0-36A8-11E3-890A-952519AD3F61&lt;br /&gt;
195 QNX6 file system               CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1&lt;br /&gt;
196 Plan 9 partition               C91818F9-8025-47AF-89D2-F030D7000C2C&lt;br /&gt;
197 HiFive FSBL                    5B193300-FC78-40CD-8002-E86C45580B47&lt;br /&gt;
198 HiFive BBL                     2E54B353-1271-4842-806F-E436D6AF6985&lt;br /&gt;
199 Haiku BFS                      42465331-3BA3-10F1-802A-4861696B7521&lt;br /&gt;
200 Marvell Armada 3700 Boot partition 6828311A-BA55-42A4-BCDE-A89BB5EDECAE&lt;br /&gt;
&lt;br /&gt;
Aliases:&lt;br /&gt;
   linux          - 0FC63DAF-8483-4772-8E79-3D69D8477DE4&lt;br /&gt;
   swap           - 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F&lt;br /&gt;
   home           - 933AC7E1-2EB4-4F13-B844-0E14E2AEF915&lt;br /&gt;
   uefi           - C12A7328-F81F-11D2-BA4B-00A0C93EC93B&lt;br /&gt;
   raid           - A19D880F-05FC-4D3B-A006-743F0F84911E&lt;br /&gt;
   lvm            - E6D6D379-F507-44C2-A23C-238F2A3DF928&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Create second partition NixOS Install====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create a Second Partition by pressing &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;Partition number (2-128, default 2): &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Press ENTER for to set the default (2)&amp;lt;br&amp;gt;&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;First sector (4196352-1953525134, default 4196352): &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again default, just press enter&amp;lt;br&amp;gt;&lt;br /&gt;
Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;Last sector, +/-sectors or +/-size{K,M,G,T,P} (3907584-1953525134, default 1953523711):&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;+500GB&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Created a new partition 2 of type &#039;Linux filesystem&#039; and of size 465.7 GiB.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create Third Partition for NixOS SWAP====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Command (m for help): n&lt;br /&gt;
Partition number (3-128, default 3): &lt;br /&gt;
First sector (980469760-1953525134, default 980469760): &lt;br /&gt;
Last sector, +/-sectors or +/-size{K,M,G,T,P} (980469760-1953525134, default 1953523711): +16GB&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
NixOS Swap Note&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nix Config file will take care of the rest of swap&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 swapDevices = [ {&lt;br /&gt;
    device = &amp;quot;/dev/nvme0n1p2&amp;quot;;&lt;br /&gt;
    randomEncryption.enable = true; &lt;br /&gt;
  } ];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Complete process terminal output====&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
The Complete process for creating the three partitions&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[nixos@nixos:~]$ sudo fdisk /dev/nvme0n1&lt;br /&gt;
&lt;br /&gt;
Welcome to fdisk (util-linux 2.39.2).&lt;br /&gt;
Changes will remain in memory only, until you decide to write them.&lt;br /&gt;
Be careful before using the write command.&lt;br /&gt;
&lt;br /&gt;
Device does not contain a recognized partition table.&lt;br /&gt;
Created a new DOS (MBR) disklabel with disk identifier 0xf4e4cac7.&lt;br /&gt;
&lt;br /&gt;
Command (m for help): g&lt;br /&gt;
Created a new GPT disklabel (GUID: DB407773-03D4-499B-A96A-3A61798E4523).&lt;br /&gt;
&lt;br /&gt;
Command (m for help): n&lt;br /&gt;
Partition number (1-128, default 1): &lt;br /&gt;
First sector (2048-1953525134, default 2048): &lt;br /&gt;
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1953525134, default 1953523711): +2GB&lt;br /&gt;
&lt;br /&gt;
Created a new partition 1 of type &#039;Linux filesystem&#039; and of size 1.9 GiB.&lt;br /&gt;
&lt;br /&gt;
Command (m for help): t&lt;br /&gt;
Selected partition 1&lt;br /&gt;
Partition type or alias (type L to list all): 1&lt;br /&gt;
Changed type of partition &#039;Linux filesystem&#039; to &#039;EFI System&#039;.&lt;br /&gt;
&lt;br /&gt;
Command (m for help): n&lt;br /&gt;
Partition number (2-128, default 2): &lt;br /&gt;
First sector (3907584-1953525134, default 3907584): &lt;br /&gt;
Last sector, +/-sectors or +/-size{K,M,G,T,P} (3907584-1953525134, default 1953523711): +500GB&lt;br /&gt;
&lt;br /&gt;
Created a new partition 2 of type &#039;Linux filesystem&#039; and of size 465.7 GiB.&lt;br /&gt;
Partition #2 contains a zfs_member signature.&lt;br /&gt;
&lt;br /&gt;
Do you want to remove the signature? [Y]es/[N]o: y&lt;br /&gt;
&lt;br /&gt;
The signature will be removed by a write command.&lt;br /&gt;
&lt;br /&gt;
Command (m for help): n&lt;br /&gt;
Partition number (3-128, default 3): &lt;br /&gt;
First sector (980469760-1953525134, default 980469760): &lt;br /&gt;
Last sector, +/-sectors or +/-size{K,M,G,T,P} (980469760-1953525134, default 1953523711): +16GB&lt;br /&gt;
&lt;br /&gt;
Created a new partition 3 of type &#039;Linux filesystem&#039; and of size 14.9 GiB.&lt;br /&gt;
&lt;br /&gt;
Command (m for help): w&lt;br /&gt;
The partition table has been altered.&lt;br /&gt;
Calling ioctl() to re-read partition table.&lt;br /&gt;
Syncing disks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Can now check partitions with &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[nixos@nixos:~]$ lsblk&lt;br /&gt;
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS&lt;br /&gt;
loop0         7:0    0   2.5G  1 loop /nix/.ro-store&lt;br /&gt;
sda           8:0    1   7.3G  0 disk &lt;br /&gt;
├─sda1        8:1    1   2.5G  0 part /iso&lt;br /&gt;
└─sda2        8:2    1     3M  0 part &lt;br /&gt;
sdb           8:16   1     0B  0 disk &lt;br /&gt;
nvme0n1     259:0    0 931.5G  0 disk &lt;br /&gt;
├─nvme0n1p1 259:1    0   1.9G  0 part &lt;br /&gt;
├─nvme0n1p2 259:2    0 465.7G  0 part &lt;br /&gt;
└─nvme0n1p3 259:3    0  14.9G  0 part &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===format drives/partitions===&lt;br /&gt;
&lt;br /&gt;
We have now created 3 partions on are hard drive &#039;&#039;&#039;nvme0n1&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;nvme0n1p1&#039;&#039;&#039;  the EFI partition&lt;br /&gt;
* &#039;&#039;&#039;nvme0n1p2&#039;&#039;&#039;  the NixOS Main partition&lt;br /&gt;
* &#039;&#039;&#039;nvme0n1p3&#039;&#039;&#039;  the NixOS Swap partition&lt;br /&gt;
&lt;br /&gt;
====first partion is for EFI and will be formatted in fat32====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkfs.fat -F 32 /dev/nvme0n1p1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====adding a label====&lt;br /&gt;
&amp;lt;code&amp;gt;sudo fatlabel /dev/nvme0n1p1 EFIP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create Zpools for Root and Home===&lt;br /&gt;
&lt;br /&gt;
Encryption on root or unencrypted, select one option&lt;br /&gt;
&lt;br /&gt;
* NOTE: &#039;&#039;&#039;nvme0n1p2&#039;&#039;&#039; is the Main partition, will be installing NixOS on. And &#039;&#039;&#039;nvme0n1p3&#039;&#039;&#039; is the SWAP&lt;br /&gt;
&lt;br /&gt;
====Creating zpools for root and home NO ENCRYPTION====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo zpool create -f \&lt;br /&gt;
-o altroot=&amp;quot;/mnt&amp;quot; \&lt;br /&gt;
-o ashift=12 \&lt;br /&gt;
-o autotrim=on \&lt;br /&gt;
-O compression=lz4 \&lt;br /&gt;
-O acltype=posixacl \&lt;br /&gt;
-O xattr=sa \&lt;br /&gt;
-O relatime=on \&lt;br /&gt;
-O normalization=formD \&lt;br /&gt;
-O dnodesize=auto \&lt;br /&gt;
-O sync=disabled \&lt;br /&gt;
-O mountpoint=none \&lt;br /&gt;
NIXROOT \&lt;br /&gt;
/dev/nvme0n1p2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
BreakDown of above command:&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;-o vs -O&#039;&#039;&#039;: &lt;br /&gt;
** The lowercase &amp;quot;&#039;&#039;-o&#039;&#039;&amp;quot; sets pool-level properties affecting the entire pool.&lt;br /&gt;
** The uppercase &amp;quot;&#039;&#039;-O&#039;&#039;&amp;quot; sets dataset-level properties affecting datasets within the pool.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Pool-Level Properties (Lowercase &#039;o&#039;)&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-o altroot=&amp;quot;/mnt&amp;quot;&amp;lt;/code&amp;gt;: Temporarily sets an alternate root directory for mounting the pool.&lt;br /&gt;
** &amp;lt;code&amp;gt;-o ashift=12&amp;lt;/code&amp;gt;: Specifies alignment shift for performance, with a value of 12 for 4K (2^12) disk sector size.&lt;br /&gt;
** &amp;lt;code&amp;gt;-o autotrim=on&amp;lt;/code&amp;gt;: Enables automatic trimming of unused space for better SSD performance and longevity.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dataset-Level Properties (Uppercase &#039;O&#039;)&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-O compression=lz4&amp;lt;/code&amp;gt;: Enables LZ4 compression, which is effective and lightweight.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O acltype=posixacl&amp;lt;/code&amp;gt;: Enables POSIX ACLs for granular permission control.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O xattr=sa&amp;lt;/code&amp;gt;: Enables extended attributes stored as system attributes.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O relatime=on&amp;lt;/code&amp;gt;: Updates access times relative to modification time for efficiency.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O normalization=formD&amp;lt;/code&amp;gt;: Sets Unicode normalization form for system compatibility.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O dnodesize=auto&amp;lt;/code&amp;gt;: Allows automatic adjustment of dnode sizes for performance.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O sync=disabled&amp;lt;/code&amp;gt;: Disables synchronous writes for performance but may compromise data integrity.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O mountpoint=none&amp;lt;/code&amp;gt;: Disables automatic mounting of the new pool.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Other Parameters&#039;&#039;&#039;:&lt;br /&gt;
** &#039;&#039;NIXROOT&#039;&#039;: Name of the ZFS pool being created.&lt;br /&gt;
** &#039;&#039;/dev/nvme0n1p2&#039;&#039;: Disk partition for creating the ZFS pool.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Additional Note&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt;: Forces pool creation, overriding safety checks. Use with caution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Creating zpools for root and home WITH ENCRYPTION on root====&lt;br /&gt;
* You will be prompted to enter a passphase after running the below commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo zpool create -f \&lt;br /&gt;
-o altroot=&amp;quot;/mnt&amp;quot; \&lt;br /&gt;
-o ashift=12 \&lt;br /&gt;
-o autotrim=on \&lt;br /&gt;
-O compression=lz4 \&lt;br /&gt;
-O acltype=posixacl \&lt;br /&gt;
-O xattr=sa \&lt;br /&gt;
-O relatime=on \&lt;br /&gt;
-O normalization=formD \&lt;br /&gt;
-O dnodesize=auto \&lt;br /&gt;
-O sync=disabled \&lt;br /&gt;
-O encryption=aes-256-gcm \&lt;br /&gt;
-O keylocation=prompt  \&lt;br /&gt;
-O keyformat=passphrase \&lt;br /&gt;
-O mountpoint=none \&lt;br /&gt;
NIXROOT \&lt;br /&gt;
/dev/nvme0n1p2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
BreakDown of above command:&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;-o vs -O&#039;&#039;&#039;: &lt;br /&gt;
** The lowercase &amp;quot;&#039;&#039;-o&#039;&#039;&amp;quot; sets pool-level properties affecting the entire pool.&lt;br /&gt;
** The uppercase &amp;quot;&#039;&#039;-O&#039;&#039;&amp;quot; sets dataset-level properties affecting datasets within the pool.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Pool-Level Properties (Lowercase &#039;o&#039;)&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-o altroot=&amp;quot;/mnt&amp;quot;&amp;lt;/code&amp;gt;: Temporarily sets an alternate root directory for mounting the pool.&lt;br /&gt;
** &amp;lt;code&amp;gt;-o ashift=12&amp;lt;/code&amp;gt;: Specifies alignment shift for performance, with a value of 12 for 4K (2^12) disk sector size.&lt;br /&gt;
** &amp;lt;code&amp;gt;-o autotrim=on&amp;lt;/code&amp;gt;: Enables automatic trimming of unused space for better SSD performance and longevity.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dataset-Level Properties (Uppercase &#039;O&#039;)&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-O compression=lz4&amp;lt;/code&amp;gt;: Enables LZ4 compression, which is effective and lightweight.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O acltype=posixacl&amp;lt;/code&amp;gt;: Enables POSIX ACLs for granular permission control.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O xattr=sa&amp;lt;/code&amp;gt;: Enables extended attributes stored as system attributes.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O relatime=on&amp;lt;/code&amp;gt;: Updates access times relative to modification time for efficiency.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O normalization=formD&amp;lt;/code&amp;gt;: Sets Unicode normalization form for system compatibility.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O dnodesize=auto&amp;lt;/code&amp;gt;: Allows automatic adjustment of dnode sizes for performance.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O sync=disabled&amp;lt;/code&amp;gt;: Disables synchronous writes for performance but may compromise data integrity.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O encryption=aes-256-gcm&amp;lt;/code&amp;gt;: Specifies AES-256-GCM as the encryption algorithm.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O keylocation=prompt&amp;lt;/code&amp;gt;: Prompts for the encryption key when needed.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O keyformat=passphrase&amp;lt;/code&amp;gt;: Uses a passphrase for the encryption key.&lt;br /&gt;
** &amp;lt;code&amp;gt;-O mountpoint=none&amp;lt;/code&amp;gt;: Disables automatic mounting of the new pool.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Other Parameters&#039;&#039;&#039;:&lt;br /&gt;
** &#039;&#039;NIXROOT&#039;&#039;: Name of the ZFS pool being created.&lt;br /&gt;
** &#039;&#039;/dev/nvme0n1p2&#039;&#039;: Disk partition for creating the ZFS pool.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Additional Note&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt;: Forces pool creation, overriding safety checks. Use with caution.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
=====create root volume=====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo zfs create -o mountpoint=legacy NIXROOT/root&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== create home partition=====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo zfs create -o mountpoint=legacy NIXROOT/home&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mountpoint=legacy allow us to use normal mount commands to mount zfs volume&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo mount -t zfs NIXROOT/root /mnt&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo mkdir /mnt/boot /mnt/home&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* mount boot&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo mount /dev/nvme0n1p1 /mnt/boot&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* mount zfs home&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo mount -t zfs NIXROOT/home /mnt/home&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==nixos - config and install==&lt;br /&gt;
&lt;br /&gt;
===Generate a Config File===&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo nixos-generate-config --root /mnt&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* This command will generate file for the nixos system - which files and what they do i do not yet know, learning as i go&lt;br /&gt;
&lt;br /&gt;
* to see hardware configuration file&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
cat /mnt/etc/nixos/hardware-configuration.nix&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Network HostID====&lt;br /&gt;
&lt;br /&gt;
Using the command &#039;&#039;&#039;head -c 8 /etc/machine-id&#039;&#039;&#039; to generate a value for &#039;&#039;&#039;networking.hostId&#039;&#039;&#039; in NixOS for ZFS setup is a practical method to obtain a unique and consistent identifier for your system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
head -c 8 /etc/machine-id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* should return 8 charaters, something like the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
3333abcd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we will use this in the ZFS section of the &#039;&#039;&#039;nixos/configuration.nix&#039;&#039;&#039; file&lt;br /&gt;
&lt;br /&gt;
==== edit nixos config file ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/mnt/etc/nixos/configuration.nix&amp;lt;/code&amp;gt; Before any changes&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Edit this configuration file to define what should be installed on&lt;br /&gt;
# your system.  Help is available in the configuration.nix(5) man page&lt;br /&gt;
# and in the NixOS manual (accessible by running `nixos-help`).&lt;br /&gt;
&lt;br /&gt;
{ config, pkgs, ... }:&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  imports =&lt;br /&gt;
    [ # Include the results of the hardware scan.&lt;br /&gt;
      ./hardware-configuration.nix&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
  # Use the systemd-boot EFI boot loader.&lt;br /&gt;
  boot.loader.systemd-boot.enable = true;&lt;br /&gt;
  boot.loader.efi.canTouchEfiVariables = true;&lt;br /&gt;
&lt;br /&gt;
  # networking.hostName = &amp;quot;nixos&amp;quot;; # Define your hostname.&lt;br /&gt;
  # Pick only one of the below networking options.&lt;br /&gt;
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.&lt;br /&gt;
  # networking.networkmanager.enable = true;  # Easiest to use and most distros use this by default.&lt;br /&gt;
&lt;br /&gt;
  # Set your time zone.&lt;br /&gt;
  # time.timeZone = &amp;quot;Europe/Amsterdam&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  # Configure network proxy if necessary&lt;br /&gt;
  # networking.proxy.default = &amp;quot;http://user:password@proxy:port/&amp;quot;;&lt;br /&gt;
  # networking.proxy.noProxy = &amp;quot;127.0.0.1,localhost,internal.domain&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  # Select internationalisation properties.&lt;br /&gt;
  # i18n.defaultLocale = &amp;quot;en_US.UTF-8&amp;quot;;&lt;br /&gt;
  # console = {&lt;br /&gt;
  #   font = &amp;quot;Lat2-Terminus16&amp;quot;;&lt;br /&gt;
  #   keyMap = &amp;quot;us&amp;quot;;&lt;br /&gt;
  #   useXkbConfig = true; # use xkbOptions in tty.&lt;br /&gt;
  # };&lt;br /&gt;
&lt;br /&gt;
  # Enable the X11 windowing system.&lt;br /&gt;
  services.xserver.enable = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
  # Configure keymap in X11&lt;br /&gt;
  # services.xserver.layout = &amp;quot;us&amp;quot;;&lt;br /&gt;
  # services.xserver.xkbOptions = &amp;quot;eurosign:e,caps:escape&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  # Enable CUPS to print documents.&lt;br /&gt;
  # services.printing.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable sound.&lt;br /&gt;
  # sound.enable = true;&lt;br /&gt;
  # hardware.pulseaudio.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable touchpad support (enabled default in most desktopManager).&lt;br /&gt;
  # services.xserver.libinput.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Define a user account. Don&#039;t forget to set a password with ‘passwd’.&lt;br /&gt;
  # users.users.alice = {&lt;br /&gt;
  #   isNormalUser = true;&lt;br /&gt;
  #   extraGroups = [ &amp;quot;wheel&amp;quot; ]; # Enable ‘sudo’ for the user.&lt;br /&gt;
  #   packages = with pkgs; [&lt;br /&gt;
  #     firefox&lt;br /&gt;
  #     tree&lt;br /&gt;
  #   ];&lt;br /&gt;
  # };&lt;br /&gt;
&lt;br /&gt;
  # List packages installed in system profile. To search, run:&lt;br /&gt;
  # $ nix search wget&lt;br /&gt;
  # environment.systemPackages = with pkgs; [&lt;br /&gt;
  #   vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.&lt;br /&gt;
  #   wget&lt;br /&gt;
  # ];&lt;br /&gt;
&lt;br /&gt;
  # Some programs need SUID wrappers, can be configured further or are&lt;br /&gt;
  # started in user sessions.&lt;br /&gt;
  # programs.mtr.enable = true;&lt;br /&gt;
  # programs.gnupg.agent = {&lt;br /&gt;
  #   enable = true;&lt;br /&gt;
  #   enableSSHSupport = true;&lt;br /&gt;
  # };&lt;br /&gt;
&lt;br /&gt;
  # List services that you want to enable:&lt;br /&gt;
&lt;br /&gt;
  # Enable the OpenSSH daemon.&lt;br /&gt;
  # services.openssh.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Open ports in the firewall.&lt;br /&gt;
  # networking.firewall.allowedTCPPorts = [ ... ];&lt;br /&gt;
  # networking.firewall.allowedUDPPorts = [ ... ];&lt;br /&gt;
  # Or disable the firewall altogether.&lt;br /&gt;
  # networking.firewall.enable = false;&lt;br /&gt;
&lt;br /&gt;
  # Copy the NixOS configuration file and link it from the resulting system&lt;br /&gt;
  # (/run/current-system/configuration.nix). This is useful in case you&lt;br /&gt;
  # accidentally delete configuration.nix.&lt;br /&gt;
  # system.copySystemConfiguration = true;&lt;br /&gt;
&lt;br /&gt;
  # This value determines the NixOS release from which the default&lt;br /&gt;
  # settings for stateful data, like file locations and database versions&lt;br /&gt;
  # on your system were taken. It&#039;s perfectly fine and recommended to leave&lt;br /&gt;
  # this value at the release version of the first install of this system.&lt;br /&gt;
  # Before changing this value read the documentation for this option&lt;br /&gt;
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).&lt;br /&gt;
  system.stateVersion = &amp;quot;23.11&amp;quot;; # Did you read the comment?&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt; &lt;br /&gt;
sudo $EDITOR /mnt/etc/nixos/configuration.nix&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Boot Loader =====&lt;br /&gt;
By default will use systemd as boot loader which will not allow us to duel boot with freebsd (i think)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;comment out&#039;&#039;&#039; the lines by placing a # in front &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boot.loader.systemd-boot.enable = true;&lt;br /&gt;
boot.loader.efi.canTouchEfiVariables = true;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Insert&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# use grub please&lt;br /&gt;
boot.loader.grub.enable = true;&lt;br /&gt;
boot.loader.grub.devices = [ &amp;quot;nodev&amp;quot; ];&lt;br /&gt;
boot.loader.grub.efiInstallAsRemovable = true ;&lt;br /&gt;
boot.loader.grub.efiSupport = true;&lt;br /&gt;
boot.loader.grub.useOSProber = true;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====ZFS=====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# zfs &lt;br /&gt;
boot.supportedFilesystems = [  &amp;quot;zfs&amp;quot; ];&lt;br /&gt;
boot.zfs.requestEncryptionCredentials = true;&lt;br /&gt;
## insert return from &#039;head -c 8 /etc/machine-id&#039;&lt;br /&gt;
networking.hostId = &amp;quot;3333abcd&amp;quot;;&lt;br /&gt;
services.zfs.autoScrub.enable = true;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====HostName and Network Manager=====&lt;br /&gt;
* In the same config file we are going to change a few other details&lt;br /&gt;
&lt;br /&gt;
** networking.hostName&lt;br /&gt;
** can just uncomment if you are happy with the name &#039;nixos&#039;&lt;br /&gt;
** uncomment and change name to what you like&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
networking.hostName = &amp;quot;t470nix&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
** pick on e of the networking options by uncommenting&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
networking.networkmanager.enable = true;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Set your time zone - need to find a list of options=====&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
time.timeZone = &amp;quot;Europe/London&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== keyboard layout =====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Configure keymap in X11&lt;br /&gt;
  services.xserver = {&lt;br /&gt;
    layout = &amp;quot;gb&amp;quot;;&lt;br /&gt;
    xkbVariant = &amp;quot;&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  # Configure console keymap&lt;br /&gt;
  console.keyMap = &amp;quot;uk&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Select internationalisation properties=====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Select internationalisation properties.&lt;br /&gt;
  i18n.defaultLocale = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  i18n.extraLocaleSettings = {&lt;br /&gt;
    LC_ADDRESS = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_IDENTIFICATION = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MEASUREMENT = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MONETARY = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NAME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NUMERIC = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_PAPER = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TELEPHONE = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TIME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Desktop - Pantheon =====&lt;br /&gt;
&lt;br /&gt;
NOTE: because i am using latest-nixos-plasma5-x86_64-linux.iso by default the desktop will be plasma5, so going to comment out and replace with Pantheno Desktop&lt;br /&gt;
&lt;br /&gt;
Default entry:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Enable the X11 windowing system.&lt;br /&gt;
  services.xserver.enable = true;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Changed to:&lt;br /&gt;
NOTE: &#039;&#039;&#039;Pantheon&#039;&#039;&#039; as bug, does not open from sleep if you shut laptop lid, but its easy to change desktop on NixOS, as will show later.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Enable the X11 windowing system.&lt;br /&gt;
  services.xserver.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Pantheon Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.lightdm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.pantheon.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
#  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
#  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Set init user =====&lt;br /&gt;
** Config a user account - we are using name &#039;&#039;&#039;noob&#039;&#039;&#039; feel free to change&lt;br /&gt;
** Note: change initial password after with &amp;lt;code&amp;gt;passwd noob&amp;lt;/code&amp;gt;. SYNTAX &amp;lt;code&amp;gt;passwd USERNAME&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
users.users.noob = {&lt;br /&gt;
 isNormalUser = true;&lt;br /&gt;
 initialPassword = &amp;quot;CompleteNoob&amp;quot;;&lt;br /&gt;
 extraGroups = [ &amp;quot;wheel&amp;quot; ];&lt;br /&gt;
 packages = with pkgs; [&lt;br /&gt;
   mc&lt;br /&gt;
 ];&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Enable auto login======&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Enable automatic login for the user.&lt;br /&gt;
  services.xserver.displayManager.autoLogin.enable = true;&lt;br /&gt;
  services.xserver.displayManager.autoLogin.user = &amp;quot;noob&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Enable Sound=====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Enable sound with pipewire.&lt;br /&gt;
  sound.enable = true;&lt;br /&gt;
  hardware.pulseaudio.enable = false;&lt;br /&gt;
  security.rtkit.enable = true;&lt;br /&gt;
  services.pipewire = {&lt;br /&gt;
    enable = true;&lt;br /&gt;
    alsa.enable = true;&lt;br /&gt;
    alsa.support32Bit = true;&lt;br /&gt;
    pulse.enable = true;&lt;br /&gt;
    # If you want to use JACK applications, uncomment this&lt;br /&gt;
    #jack.enable = true;&lt;br /&gt;
&lt;br /&gt;
    # use the example session manager (no others are packaged yet so this is enabled by default,&lt;br /&gt;
    # no need to redefine it in your config for now)&lt;br /&gt;
    #media-session.enable = true;&lt;br /&gt;
  };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Add an terminal text editor =====&lt;br /&gt;
note: &#039;vi&#039; on its own does not work, needs to be &#039;vim&#039;, &#039;nano&#039; is preinstalled by default with nixos&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
environment.systemPackages = with pkgs; [&lt;br /&gt;
  wget&lt;br /&gt;
  vim&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======Optional if you want to ssh in after reboot======&lt;br /&gt;
* enable sshd&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
services.openssh.enable = true;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* disable firewall &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
networking.firewall.enable = false;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/mnt/etc/nixos/configuration.nix&amp;lt;/code&amp;gt; After Changes - &#039;&#039;&#039;TIDY VERSION&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[noob@t470nix:~]$ cat /etc/nixos/configuration.nix &lt;br /&gt;
# Edit this configuration file to define what should be installed on&lt;br /&gt;
# your system.  Help is available in the configuration.nix(5) man page&lt;br /&gt;
# and in the NixOS manual (accessible by running `nixos-help`).&lt;br /&gt;
&lt;br /&gt;
{ config, pkgs, ... }:&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  imports =&lt;br /&gt;
    [ # Include the results of the hardware scan.&lt;br /&gt;
      ./hardware-configuration.nix&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
# allow ssh no firewall&lt;br /&gt;
services.openssh.enable = true;&lt;br /&gt;
networking.firewall.enable = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# use grub please&lt;br /&gt;
boot.loader.grub.enable = true;&lt;br /&gt;
boot.loader.grub.devices = [ &amp;quot;nodev&amp;quot; ];&lt;br /&gt;
boot.loader.grub.efiInstallAsRemovable = true ;&lt;br /&gt;
boot.loader.grub.efiSupport = true;&lt;br /&gt;
boot.loader.grub.useOSProber = true;&lt;br /&gt;
&lt;br /&gt;
# zfs &lt;br /&gt;
boot.supportedFilesystems = [  &amp;quot;zfs&amp;quot; ];&lt;br /&gt;
boot.zfs.requestEncryptionCredentials = true;&lt;br /&gt;
## insert return from &#039;head -c 8 /etc/machine-id&#039;&lt;br /&gt;
networking.hostId = &amp;quot;3333abcd&amp;quot;;&lt;br /&gt;
services.zfs.autoScrub.enable = true;&lt;br /&gt;
&lt;br /&gt;
networking.hostName = &amp;quot;t470nix&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
networking.networkmanager.enable = true;&lt;br /&gt;
&lt;br /&gt;
time.timeZone = &amp;quot;Europe/London&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Configure keymap in X11&lt;br /&gt;
  services.xserver = {&lt;br /&gt;
    layout = &amp;quot;gb&amp;quot;;&lt;br /&gt;
    xkbVariant = &amp;quot;&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  # Configure console keymap&lt;br /&gt;
  console.keyMap = &amp;quot;uk&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Select internationalisation properties.&lt;br /&gt;
  i18n.defaultLocale = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  i18n.extraLocaleSettings = {&lt;br /&gt;
    LC_ADDRESS = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_IDENTIFICATION = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MEASUREMENT = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MONETARY = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NAME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NUMERIC = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_PAPER = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TELEPHONE = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TIME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # Enable the X11 windowing system.&lt;br /&gt;
  services.xserver.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Pantheon Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.lightdm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.pantheon.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
#  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
#  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
&lt;br /&gt;
# This creates a user called &#039;noob&#039; with the password &#039;CompleteNoob&#039;&lt;br /&gt;
&lt;br /&gt;
users.users.noob = {&lt;br /&gt;
 isNormalUser = true;&lt;br /&gt;
 initialPassword = &amp;quot;CompleteNoob&amp;quot;;&lt;br /&gt;
 extraGroups = [ &amp;quot;wheel&amp;quot; ];&lt;br /&gt;
 packages = with pkgs; [&lt;br /&gt;
   mc&lt;br /&gt;
 ];&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
# Enable automatic login for the user.&lt;br /&gt;
  services.xserver.displayManager.autoLogin.enable = true;&lt;br /&gt;
  services.xserver.displayManager.autoLogin.user = &amp;quot;noob&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 # Enable sound with pipewire.&lt;br /&gt;
  sound.enable = true;&lt;br /&gt;
  hardware.pulseaudio.enable = false;&lt;br /&gt;
  security.rtkit.enable = true;&lt;br /&gt;
  services.pipewire = {&lt;br /&gt;
    enable = true;&lt;br /&gt;
    alsa.enable = true;&lt;br /&gt;
    alsa.support32Bit = true;&lt;br /&gt;
    pulse.enable = true;&lt;br /&gt;
    # If you want to use JACK applications, uncomment this&lt;br /&gt;
    #jack.enable = true;&lt;br /&gt;
&lt;br /&gt;
    # use the example session manager (no others are packaged yet so this is enabled by default,&lt;br /&gt;
    # no need to redefine it in your config for now)&lt;br /&gt;
    #media-session.enable = true;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
environment.systemPackages = with pkgs; [&lt;br /&gt;
  wget&lt;br /&gt;
  vim&lt;br /&gt;
];&lt;br /&gt;
&lt;br /&gt;
  system.stateVersion = &amp;quot;23.11&amp;quot;; # Did you read the comment?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
swapDevices = [ {&lt;br /&gt;
    device = &amp;quot;/dev/nvme0n1p3&amp;quot;;&lt;br /&gt;
    randomEncryption.enable = true; &lt;br /&gt;
  } ];&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== install nixos ==&lt;br /&gt;
&lt;br /&gt;
To Install NixOS use &#039;&#039;&#039;nixos-install&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo nixos-install&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* will be prompted for root password after install&lt;br /&gt;
&lt;br /&gt;
Once Installed, &amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt; and login&lt;br /&gt;
&lt;br /&gt;
===Installing packages on NixOS===&lt;br /&gt;
&lt;br /&gt;
still new on NixOS &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;nix-env -i firefox&amp;lt;/code&amp;gt; installs firefox.&lt;br /&gt;
&lt;br /&gt;
But its best to use &#039;&#039;&#039;configuration.nix&#039;&#039;&#039; for software installs, this way if you keep a copy of your config file and nuke and pave, you can have all your apps from the get go with out having to reinstall them all one by one again.&lt;br /&gt;
&lt;br /&gt;
===Reconfigure /etc/nixos/configuration.nix===&lt;br /&gt;
&lt;br /&gt;
To apply changes made to &amp;lt;code&amp;gt;/etc/nixos/configuration.nix&amp;lt;/code&amp;gt; you need to &#039;&#039;&#039;rebuild&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Give example on how to change back desktop to KDE&lt;br /&gt;
&lt;br /&gt;
* Add package FireFox and rebuild&lt;br /&gt;
&lt;br /&gt;
* After reboot (after desktop change) new passwd for noob account still changed - did not restore to CompleteNoob&lt;br /&gt;
&lt;br /&gt;
Change DESKTOP&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  # Enable the Pantheon Desktop Environment.&lt;br /&gt;
#  services.xserver.displayManager.lightdm.enable = true;&lt;br /&gt;
#  services.xserver.desktopManager.pantheon.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====after update====&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
AFTER UPDATE CONFIG&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Edit this configuration file to define what should be installed on&lt;br /&gt;
# your system.  Help is available in the configuration.nix(5) man page&lt;br /&gt;
# and in the NixOS manual (accessible by running `nixos-help`).&lt;br /&gt;
&lt;br /&gt;
{ config, pkgs, ... }:&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  imports =&lt;br /&gt;
    [ # Include the results of the hardware scan.&lt;br /&gt;
      ./hardware-configuration.nix&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
# allow ssh no firewall&lt;br /&gt;
services.openssh.enable = true;&lt;br /&gt;
networking.firewall.enable = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# use grub please&lt;br /&gt;
boot.loader.grub.enable = true;&lt;br /&gt;
boot.loader.grub.devices = [ &amp;quot;nodev&amp;quot; ];&lt;br /&gt;
boot.loader.grub.efiInstallAsRemovable = true ;&lt;br /&gt;
boot.loader.grub.efiSupport = true;&lt;br /&gt;
boot.loader.grub.useOSProber = true;&lt;br /&gt;
&lt;br /&gt;
# zfs &lt;br /&gt;
boot.supportedFilesystems = [  &amp;quot;zfs&amp;quot; ];&lt;br /&gt;
boot.zfs.requestEncryptionCredentials = true;&lt;br /&gt;
## insert return from &#039;head -c 8 /etc/machine-id&#039;&lt;br /&gt;
networking.hostId = &amp;quot;3333abcd&amp;quot;;&lt;br /&gt;
services.zfs.autoScrub.enable = true;&lt;br /&gt;
&lt;br /&gt;
networking.hostName = &amp;quot;t470nix&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
networking.networkmanager.enable = true;&lt;br /&gt;
&lt;br /&gt;
time.timeZone = &amp;quot;Europe/London&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Configure keymap in X11&lt;br /&gt;
  services.xserver = {&lt;br /&gt;
    layout = &amp;quot;gb&amp;quot;;&lt;br /&gt;
    xkbVariant = &amp;quot;&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  # Configure console keymap&lt;br /&gt;
  console.keyMap = &amp;quot;uk&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Select internationalisation properties.&lt;br /&gt;
  i18n.defaultLocale = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  i18n.extraLocaleSettings = {&lt;br /&gt;
    LC_ADDRESS = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_IDENTIFICATION = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MEASUREMENT = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MONETARY = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NAME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NUMERIC = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_PAPER = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TELEPHONE = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TIME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # Enable the X11 windowing system.&lt;br /&gt;
  services.xserver.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Pantheon Desktop Environment.&lt;br /&gt;
#  services.xserver.displayManager.lightdm.enable = true;&lt;br /&gt;
#  services.xserver.desktopManager.pantheon.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
&lt;br /&gt;
# This creates a user called &#039;noob&#039; with the password &#039;CompleteNoob&#039;&lt;br /&gt;
&lt;br /&gt;
users.users.noob = {&lt;br /&gt;
 isNormalUser = true;&lt;br /&gt;
 initialPassword = &amp;quot;CompleteNoob&amp;quot;;&lt;br /&gt;
 extraGroups = [ &amp;quot;wheel&amp;quot; ];&lt;br /&gt;
 packages = with pkgs; [&lt;br /&gt;
   mc&lt;br /&gt;
 ];&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
# Enable automatic login for the user.&lt;br /&gt;
  services.xserver.displayManager.autoLogin.enable = true;&lt;br /&gt;
  services.xserver.displayManager.autoLogin.user = &amp;quot;noob&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 # Enable sound with pipewire.&lt;br /&gt;
  sound.enable = true;&lt;br /&gt;
  hardware.pulseaudio.enable = false;&lt;br /&gt;
  security.rtkit.enable = true;&lt;br /&gt;
  services.pipewire = {&lt;br /&gt;
    enable = true;&lt;br /&gt;
    alsa.enable = true;&lt;br /&gt;
    alsa.support32Bit = true;&lt;br /&gt;
    pulse.enable = true;&lt;br /&gt;
    # If you want to use JACK applications, uncomment this&lt;br /&gt;
    #jack.enable = true;&lt;br /&gt;
&lt;br /&gt;
    # use the example session manager (no others are packaged yet so this is enabled by default,&lt;br /&gt;
    # no need to redefine it in your config for now)&lt;br /&gt;
    #media-session.enable = true;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
environment.systemPackages = with pkgs; [&lt;br /&gt;
  wget&lt;br /&gt;
  vim&lt;br /&gt;
  firefox&lt;br /&gt;
];&lt;br /&gt;
&lt;br /&gt;
  system.stateVersion = &amp;quot;23.11&amp;quot;; # Did you read the comment?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Swap Device setup&lt;br /&gt;
swapDevices = [ {&lt;br /&gt;
    device = &amp;quot;/dev/nvme0n1p3&amp;quot;;&lt;br /&gt;
    randomEncryption.enable = true; &lt;br /&gt;
  } ];&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after config can rebuild&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo nixos-rebuild&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo nixos-rebuild switch&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
sudo nixos-rebuild boot&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And thats a basic install of NixOS on OpenZFS, still learning.&lt;br /&gt;
&lt;br /&gt;
====Adding brave browser====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Adding brave browser&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Edit this configuration file to define what should be installed on&lt;br /&gt;
# your system.  Help is available in the configuration.nix(5) man page&lt;br /&gt;
# and in the NixOS manual (accessible by running `nixos-help`).&lt;br /&gt;
&lt;br /&gt;
{ config, pkgs, ... }:&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
  imports =&lt;br /&gt;
    [ # Include the results of the hardware scan.&lt;br /&gt;
      ./hardware-configuration.nix&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
# allow ssh no firewall&lt;br /&gt;
services.openssh.enable = true;&lt;br /&gt;
networking.firewall.enable = false;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# use grub please&lt;br /&gt;
boot.loader.grub.enable = true;&lt;br /&gt;
boot.loader.grub.devices = [ &amp;quot;nodev&amp;quot; ];&lt;br /&gt;
boot.loader.grub.efiInstallAsRemovable = true ;&lt;br /&gt;
boot.loader.grub.efiSupport = true;&lt;br /&gt;
boot.loader.grub.useOSProber = true;&lt;br /&gt;
&lt;br /&gt;
# zfs &lt;br /&gt;
boot.supportedFilesystems = [  &amp;quot;zfs&amp;quot; ];&lt;br /&gt;
boot.zfs.requestEncryptionCredentials = true;&lt;br /&gt;
## insert return from &#039;head -c 8 /etc/machine-id&#039;&lt;br /&gt;
networking.hostId = &amp;quot;3333abcd&amp;quot;;&lt;br /&gt;
services.zfs.autoScrub.enable = true;&lt;br /&gt;
&lt;br /&gt;
networking.hostName = &amp;quot;t470nix&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
networking.networkmanager.enable = true;&lt;br /&gt;
&lt;br /&gt;
time.timeZone = &amp;quot;Europe/London&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Configure keymap in X11&lt;br /&gt;
  services.xserver = {&lt;br /&gt;
    layout = &amp;quot;gb&amp;quot;;&lt;br /&gt;
    xkbVariant = &amp;quot;&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
  # Configure console keymap&lt;br /&gt;
  console.keyMap = &amp;quot;uk&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# Select internationalisation properties.&lt;br /&gt;
  i18n.defaultLocale = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  i18n.extraLocaleSettings = {&lt;br /&gt;
    LC_ADDRESS = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_IDENTIFICATION = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MEASUREMENT = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_MONETARY = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NAME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_NUMERIC = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_PAPER = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TELEPHONE = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
    LC_TIME = &amp;quot;en_GB.UTF-8&amp;quot;;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  # Enable the X11 windowing system.&lt;br /&gt;
  services.xserver.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Pantheon Desktop Environment.&lt;br /&gt;
#  services.xserver.displayManager.lightdm.enable = true;&lt;br /&gt;
#  services.xserver.desktopManager.pantheon.enable = true;&lt;br /&gt;
&lt;br /&gt;
  # Enable the Plasma 5 Desktop Environment.&lt;br /&gt;
  services.xserver.displayManager.sddm.enable = true;&lt;br /&gt;
  services.xserver.desktopManager.plasma5.enable = true;&lt;br /&gt;
&lt;br /&gt;
# This creates a user called &#039;noob&#039; with the password &#039;CompleteNoob&#039;&lt;br /&gt;
&lt;br /&gt;
users.users.noob = {&lt;br /&gt;
 isNormalUser = true;&lt;br /&gt;
 initialPassword = &amp;quot;CompleteNoob&amp;quot;;&lt;br /&gt;
 extraGroups = [ &amp;quot;wheel&amp;quot; ];&lt;br /&gt;
 packages = with pkgs; [&lt;br /&gt;
   mc&lt;br /&gt;
 ];&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
# Enable automatic login for the user.&lt;br /&gt;
  services.xserver.displayManager.autoLogin.enable = true;&lt;br /&gt;
  services.xserver.displayManager.autoLogin.user = &amp;quot;noob&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 # Enable sound with pipewire.&lt;br /&gt;
  sound.enable = true;&lt;br /&gt;
  hardware.pulseaudio.enable = false;&lt;br /&gt;
  security.rtkit.enable = true;&lt;br /&gt;
  services.pipewire = {&lt;br /&gt;
    enable = true;&lt;br /&gt;
    alsa.enable = true;&lt;br /&gt;
    alsa.support32Bit = true;&lt;br /&gt;
    pulse.enable = true;&lt;br /&gt;
    # If you want to use JACK applications, uncomment this&lt;br /&gt;
    #jack.enable = true;&lt;br /&gt;
&lt;br /&gt;
    # use the example session manager (no others are packaged yet so this is enabled by default,&lt;br /&gt;
    # no need to redefine it in your config for now)&lt;br /&gt;
    #media-session.enable = true;&lt;br /&gt;
  };&lt;br /&gt;
&lt;br /&gt;
environment.systemPackages = with pkgs; [&lt;br /&gt;
  wget&lt;br /&gt;
  vim&lt;br /&gt;
  firefox&lt;br /&gt;
  brave&lt;br /&gt;
];&lt;br /&gt;
&lt;br /&gt;
# use this to prevent brave from opening kwallet all the time&lt;br /&gt;
nixpkgs.config.overlays = [&lt;br /&gt;
      (self: super: {&lt;br /&gt;
        brave = super.brave.override {&lt;br /&gt;
          commandLineArgs =&lt;br /&gt;
            &amp;quot;--password-store=basic&amp;quot;;&lt;br /&gt;
        };&lt;br /&gt;
      })&lt;br /&gt;
    ];&lt;br /&gt;
&lt;br /&gt;
  system.stateVersion = &amp;quot;23.11&amp;quot;; # Did you read the comment?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#Swap Device setup&lt;br /&gt;
swapDevices = [ {&lt;br /&gt;
    device = &amp;quot;/dev/nvme0n1p3&amp;quot;;&lt;br /&gt;
    randomEncryption.enable = true; &lt;br /&gt;
  } ];&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nixos-rebuild switch&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==HatTips==&lt;br /&gt;
&lt;br /&gt;
* Chris McDonough - https://www.youtube.com/watch?v=CboOUrkIZ2k&amp;amp;t=5s&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=User_talk:Test1&amp;diff=451</id>
		<title>User talk:Test1</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=User_talk:Test1&amp;diff=451"/>
		<updated>2024-04-25T08:42:38Z</updated>

		<summary type="html">&lt;p&gt;Noob: Welcome!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Welcome to &#039;&#039;CompleteNoobs&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
We hope you will contribute much and well.&lt;br /&gt;
You will probably want to read the [https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents help pages].&lt;br /&gt;
Again, welcome and have fun! [[User:Noob|Noob]] ([[User talk:Noob|talk]]) 08:42, 25 April 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=User:Test1&amp;diff=450</id>
		<title>User:Test1</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=User:Test1&amp;diff=450"/>
		<updated>2024-04-25T08:42:38Z</updated>

		<summary type="html">&lt;p&gt;Noob: Creating user page for new user.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I am not a bot please let me in&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate&amp;diff=449</id>
		<title>DEMONSTRATE-MIT Introduction to Computer Science and Programming in Python 6.0001 Fall 2016 Undergraduate</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate&amp;diff=449"/>
		<updated>2023-12-03T18:32:47Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{:LICENCE_HEADER_CC_BY-NC-SA_4.0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- This site is non commercial and is a concept development.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Note - this is quickly put together to test and demonstrate hosting heavy data content on IPFS. --&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&lt;br /&gt;
NOTE: This page is for demonstration purposes Only, and is not meant to be hosted on CompleteNoobs.com which is not intended to contain CC_BY-NC-SA Licensed Content.  &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This page is CC_BY-NC-SA It is intended for a fork of &amp;quot;CompleteNoobs.com&amp;quot; called &amp;quot;CompleteNoobz.com&amp;quot;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
CompleteNoobz.com is a noncommercial mirror of CompleteNoobs.com Which can pullin CC_BY-NC-SA Licensed Content&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This page is quickly put together to test and demonstrate hosting heavy data content on IPFS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It is a first draft (UNFINISHED) and required many more Reiterations, This content is first draft concept demonstration content.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Course Information==&lt;br /&gt;
===Source===&lt;br /&gt;
https://ocw.mit.edu/MIT OPEN COURSEWARE - MASSACHUSETTS INSTITUTE OF TECHNOLOGY.&amp;lt;br&amp;gt;&lt;br /&gt;
Donations to support MIT Open Courseware &amp;lt;code&amp;gt;https://giving.mit.edu/give/to/ocw/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/download/&amp;lt;br&amp;gt;&lt;br /&gt;
https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/pages/assignments/&amp;lt;br&amp;gt;&lt;br /&gt;
https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/lecture-videos/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syllabus==&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Syllabus&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Course Meeting Times===&lt;br /&gt;
&lt;br /&gt;
Lectures: 2 sessions / week, 1 hour / session&lt;br /&gt;
&lt;br /&gt;
Recitations: 1 sessions / week, 1 hour / session&lt;br /&gt;
&lt;br /&gt;
===Course Information===&lt;br /&gt;
&lt;br /&gt;
6.0001 Introduction to Computer Science and Programming in Python is intended for students with little or no programming experience. It aims to provide students with an understanding of the role computation can play in solving problems and to help students, regardless of their major, feel justifiably confident of their ability to write small programs that allow them to accomplish useful goals. The class will use the Python 3.5 programming language.&lt;br /&gt;
&lt;br /&gt;
This is a half-semester course. Students who successfully complete 6.0001 may continue into 6.0002 Introduction to Computational Thinking and Data Science, which is taught in the second half of the semester.&lt;br /&gt;
&lt;br /&gt;
===Goals===&lt;br /&gt;
&lt;br /&gt;
*Provide an understanding of the role computation can play in solving problems.&lt;br /&gt;
*Help students, including those who do not plan to major in Computer Science and Electrical Engineering, feel confident of their ability to write small programs that allow them to accomplish useful goals.&lt;br /&gt;
*Position students so that they can compete for research projects and excel in subjects with programming components.&lt;br /&gt;
&lt;br /&gt;
===Textbook===&lt;br /&gt;
&lt;br /&gt;
The textbook is Buy at MIT Press Guttag, John. Introduction to Computation and Programming Using Python: With Application to Understanding Data Second Edition. MIT Press, 2016. ISBN: 9780262529624. The book and the course lectures parallel each other, though there is more detail in the book about some topics. It is available both in hard copy and as an e-book.&lt;br /&gt;
&lt;br /&gt;
===Lecture and Recitation Attendance===&lt;br /&gt;
&lt;br /&gt;
A significant portion of the material for this course will presented only in lecture, so students are expected to regularly attend lectures.&lt;br /&gt;
&lt;br /&gt;
Recitations give students a chance to ask questions about the lecture material or the problem set for the given week. Sometimes, new material may be covered in recitation. Recitation attendance is encouraged but not required.&lt;br /&gt;
&lt;br /&gt;
===Problem Sets and Quizzes===&lt;br /&gt;
&lt;br /&gt;
Each problem set will involve programming in Python. There will be 6 problem sets in the course. There will be two quizzes. All quizzes will be closed-book, though you will be allowed to bring one page of notes to the first quiz and two pages of notes to the second quiz. Pages must be letter-sized, double-sided, either handwritten or typed.&lt;br /&gt;
&lt;br /&gt;
===Grading Policy===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Grades will be roughly computed as follows:&lt;br /&gt;
|-&lt;br /&gt;
|ACTIVITIES&lt;br /&gt;
|PERCENTAGES&lt;br /&gt;
|-&lt;br /&gt;
|Problem sets&lt;br /&gt;
|30%&lt;br /&gt;
|-&lt;br /&gt;
|Completion of mandatory finger exercises&lt;br /&gt;
|10%&lt;br /&gt;
|-&lt;br /&gt;
|Midterm Quiz&lt;br /&gt;
|20%&lt;br /&gt;
|-&lt;br /&gt;
|Final Quiz&lt;br /&gt;
|40%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Problem sets will be graded out of 10 points. Submissions that do not run will receive at most 20% of the points. Please contact your Teaching Assistant if you have a problem understanding your problem set grade.&lt;br /&gt;
&lt;br /&gt;
Note: Quizzes and finger exercises are not available on OpenCourseWare.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Extension and Dropping Problem Sets Policy===&lt;br /&gt;
We do not grant any extensions. Instead, we offer late days and the option of rolling at most 2 problem set grades into the final quiz score.&lt;br /&gt;
&lt;br /&gt;
===Late Days===&lt;br /&gt;
&lt;br /&gt;
At the beginning of the term, students are given two late days that they can use on problem sets. Starting with Problem Set 1, additional late days can be accumulated for each assignment, one late day for each day the assignment is turned in ahead of the deadline. Up to three late days may be accumulated in this fashion in this course, i.e you can only have a maximum of 3 late days at any point in time. Late days are discrete (a student cannot use half a late day). The staff will keep track of late days and feedback for each problem set will include the number of late days the student has remaining. Any additional late work beyond these late days will not be accepted. To avoid surprises, we suggest that after you submit your problem set, you double check to make sure the submission was uploaded correctly.&lt;br /&gt;
&lt;br /&gt;
===Rolling Over Problem Sets===&lt;br /&gt;
&lt;br /&gt;
Before the final quiz, we will send out an announcement in which you can choose at most 2 problem sets that you can drop. If dropped, the percent that the problem sets are worth will be rolled into the final quiz score. We strongly urge you to see the late days and dropping the problem sets as backup in case of an emergency. Your best strategy is to do the problem sets early before work starts to pile up.&lt;br /&gt;
&lt;br /&gt;
===Calendar===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Calendar&lt;br /&gt;
|-&lt;br /&gt;
|SES #&lt;br /&gt;
|TOPICS&lt;br /&gt;
|ASSIGNMENTS&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|What is computation?&lt;br /&gt;
|Pset 0 released&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Branching and Iteration&lt;br /&gt;
|Pset 1 released&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|String Manipulation, Guess and Check, Approximations, Bisection&lt;br /&gt;
|Pset 0 due&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Decomposition, Abstractions, Functions&lt;br /&gt;
|Pset 2 released&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Tuples, Lists, Aliasing, Mutability, Cloning&lt;br /&gt;
|Pset 1 due&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Recursion, Dictionaries&lt;br /&gt;
|Pset 3 released&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Testing, Debugging, Exceptions, Assertions&lt;br /&gt;
|Pset 2 due; Quiz 1&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|Object Oriented Programming&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|Python Classes and Inheritance&lt;br /&gt;
|Pset 3 due; Pset 4 released&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|Understanding Program Efficiency, Part 1&lt;br /&gt;
|Pset 4 due; Pset 5 released&lt;br /&gt;
|-&lt;br /&gt;
|11&lt;br /&gt;
|Understanding Program Efficiency, Part 2&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|12&lt;br /&gt;
|Searching and Sorting&lt;br /&gt;
|Pset 5 due; Final Quiz&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Course Materials==&lt;br /&gt;
&lt;br /&gt;
===Downloading Using IPFS===&lt;br /&gt;
&amp;lt;code&amp;gt;https://github.com/ipfs/ipfs-desktop/releases&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[IPFS_Basics|PFS Basics]]&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
This class is using python3 IDE &amp;lt;b&amp;gt;spyder&amp;lt;/b&amp;gt; which is in Anaconda3&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.anaconda.com/&amp;lt;br&amp;gt;&lt;br /&gt;
How to install is on Problem Set 0&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MIT6_0001F16_Style Guide===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_styleguide/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmUmtyNpSLr2fXwGY1gL2hNnpwbYe8Y7CP2rPwjSNXasxJ&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Set 0==&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/ps0/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmRWpBvwUNiFRjSvgLjRoiCNXQBBL2aLg55PVfGWw7S1ns&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lecture 1: What is Computation?==&lt;br /&gt;
&lt;br /&gt;
{{#evu:https://www.youtube.com/watch?v=4-CmQesbQvw&lt;br /&gt;
|alignment=inline&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/lecture-1-what-is-computation/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmaTdTMxWdz6ySLbx258zQU5McpJTo4ZEVJ63GSKmVEyeM&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Glossary===&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Glossary for lecture with timestamps:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Time: data&amp;lt;br&amp;gt;&lt;br /&gt;
2:10 pset = problem set&amp;lt;br&amp;gt;&lt;br /&gt;
12:18 [[Square_root]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Video transcript===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Video transcript&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The following content is provided under a Creative&lt;br /&gt;
0:03Commons license.&lt;br /&gt;
0:04Your support will help MIT OpenCourseWare&lt;br /&gt;
0:07continue to offer high-quality, educational resources for free.&lt;br /&gt;
0:11To make a donation, or view additional materials&lt;br /&gt;
0:13from hundreds of MIT courses, visit MIT OpenCourseWare&lt;br /&gt;
0:17at ocw.mit.edu.&lt;br /&gt;
0:29ANA BELL: All right.&lt;br /&gt;
0:30Let&#039;s begin.&lt;br /&gt;
0:33As I mentioned before, this lecture&lt;br /&gt;
0:35will be recorded for OCW.&lt;br /&gt;
0:37Again, in future lectures, if you&lt;br /&gt;
0:39don&#039;t want to have the back of your head show up,&lt;br /&gt;
0:41just don&#039;t sit in this front area here.&lt;br /&gt;
0:44First of all, wow, what a crowd, you guys.&lt;br /&gt;
0:46We&#039;re finally in 26-100.&lt;br /&gt;
0:486.0001 made it big, huh?&lt;br /&gt;
0:52Good afternoon and welcome to the very first class of 6.0001,&lt;br /&gt;
0:55and also 600, this semester.&lt;br /&gt;
0:58My name is Ana Bell.&lt;br /&gt;
1:00First name, Ana.&lt;br /&gt;
1:01Last name, Bell.&lt;br /&gt;
1:03I&#039;m a lecturer in the EECS Department.&lt;br /&gt;
1:06And I&#039;ll be giving some of the lectures for today,&lt;br /&gt;
1:08along with later on in the term, Professor Eric Grimson, who&#039;s&lt;br /&gt;
1:13sitting right down there, will be giving some of the lectures,&lt;br /&gt;
1:15as well.&lt;br /&gt;
1:17Today we&#039;re going to go over some basic administrivia,&lt;br /&gt;
1:21a little bit of course information.&lt;br /&gt;
1:23And then, we&#039;re going to talk a little bit&lt;br /&gt;
1:24about what is computation?&lt;br /&gt;
1:26We&#039;ll discuss at a very high level&lt;br /&gt;
1:27what computers do just to make sure we&#039;re all&lt;br /&gt;
1:29on the same page.&lt;br /&gt;
1:31And then, we&#039;re going to dive right into Python basics.&lt;br /&gt;
1:34We&#039;re going to talk a little bit about mathematical operations&lt;br /&gt;
1:36you can do with Python.&lt;br /&gt;
1:38And then, we&#039;re going to talk about Python variables&lt;br /&gt;
1:40and types.&lt;br /&gt;
1:42As I mentioned in my introductory email, all&lt;br /&gt;
1:43the slides and code that I&#039;ll talk about during lectures&lt;br /&gt;
1:46will be up before lecture, so I highly&lt;br /&gt;
1:48encourage you to download them and to have them open.&lt;br /&gt;
1:52We&#039;re going to go through some in-class exercises which will&lt;br /&gt;
1:56be available on those slides.&lt;br /&gt;
1:57And it&#039;s fun to do.&lt;br /&gt;
1:59And it&#039;s also great if could take notes about the code just&lt;br /&gt;
2:07for future reference.&lt;br /&gt;
2:09It&#039;s true.&lt;br /&gt;
2:10This is a really fast-paced course,&lt;br /&gt;
2:12and we ramp up really quickly.&lt;br /&gt;
2:14We do want to position you to succeed in this course.&lt;br /&gt;
2:17As I was writing this, I was trying&lt;br /&gt;
2:19to think about when I was first starting&lt;br /&gt;
2:21to program what helped me get through my very&lt;br /&gt;
2:24first programming course.&lt;br /&gt;
2:26And this is really a good list.&lt;br /&gt;
2:29The first thing was I just read the psets as soon&lt;br /&gt;
2:31as they came out, made sure that the terminology just sunk in.&lt;br /&gt;
2:37And then, during lectures, if the lecturer&lt;br /&gt;
2:39was talking about something that suddenly I remembered,&lt;br /&gt;
2:42oh, I saw that word in the pset and I didn&#039;t know what it was.&lt;br /&gt;
2:45Well, hey, now I know what it is.&lt;br /&gt;
2:46Right?&lt;br /&gt;
2:47So just give it a read.&lt;br /&gt;
2:48You don&#039;t need to start it.&lt;br /&gt;
2:51If you&#039;re new to programming, I think the key word is practice.&lt;br /&gt;
2:55It&#039;s like math or reading.&lt;br /&gt;
2:57The more you practice, the better you get at it.&lt;br /&gt;
3:00You&#039;re not going to absorb programming&lt;br /&gt;
3:01by watching me write programs because I already know how&lt;br /&gt;
3:04to program.&lt;br /&gt;
3:05You guys need to practice.&lt;br /&gt;
3:07Download the code before lecture.&lt;br /&gt;
3:09Follow along.&lt;br /&gt;
3:10Whatever I type, you guys can type.&lt;br /&gt;
3:12And I think, also, one of the big things&lt;br /&gt;
3:14is if you&#039;re new to programming, you&#039;re&lt;br /&gt;
3:16kind of afraid that you&#039;re going to break your computer.&lt;br /&gt;
3:19And you can&#039;t really do that just by running Anaconda&lt;br /&gt;
3:24and typing in some commands.&lt;br /&gt;
3:26So don&#039;t be afraid to just type some stuff in&lt;br /&gt;
3:28and see what it does.&lt;br /&gt;
3:29Worst case, you just restart the computer.&lt;br /&gt;
3:35Yeah.&lt;br /&gt;
3:36That&#039;s probably the big thing right there.&lt;br /&gt;
3:38I should have probably highlighted it,&lt;br /&gt;
3:39but don&#039;t be afraid.&lt;br /&gt;
3:40Great.&lt;br /&gt;
3:41So this is pretty much a roadmap of all of 6.0001 or 600&lt;br /&gt;
3:46as I&#039;ve just explained it.&lt;br /&gt;
3:47There&#039;s three big things we want to get out of this course.&lt;br /&gt;
3:51The first thing is the knowledge of concepts,&lt;br /&gt;
3:54which is pretty much true of any class that you&#039;ll take.&lt;br /&gt;
3:56The class will teach you something through lectures.&lt;br /&gt;
3:59Exams will test how much you know.&lt;br /&gt;
4:02This is a class in programming.&lt;br /&gt;
4:05The other thing we want you to get out of it&lt;br /&gt;
4:08is programming skills.&lt;br /&gt;
4:10And the last thing, and I think this&lt;br /&gt;
4:12is what makes this class really great,&lt;br /&gt;
4:13is we teach you how to solve problems.&lt;br /&gt;
4:16And we do that through the psets.&lt;br /&gt;
4:18That&#039;s really how I feel the roadmap of this course&lt;br /&gt;
4:21looks like.&lt;br /&gt;
4:22And underlying all of these is just practice.&lt;br /&gt;
4:25You have to just type some stuff away and code a lot.&lt;br /&gt;
4:29And you&#039;ll succeed in this course, I think.&lt;br /&gt;
4:33OK.&lt;br /&gt;
4:35So what are the things we&#039;re going to learn in this class?&lt;br /&gt;
4:38I feel like the things we&#039;re going learn in this class&lt;br /&gt;
4:41can be divided into basically three different sections.&lt;br /&gt;
4:44The first one is related to these first two items here.&lt;br /&gt;
4:50It&#039;s really about learning how to program.&lt;br /&gt;
4:53Learning how to program, part of it&lt;br /&gt;
4:55is figuring out what objects to create.&lt;br /&gt;
4:58You&#039;ll learn about these later.&lt;br /&gt;
5:00How do you represent knowledge with data structures?&lt;br /&gt;
5:02That&#039;s sort of the broad term for that.&lt;br /&gt;
5:04And then, as you&#039;re writing programs,&lt;br /&gt;
5:06you need to-- programs aren&#039;t just linear.&lt;br /&gt;
5:08Sometimes programs jump around.&lt;br /&gt;
5:10They make decisions.&lt;br /&gt;
5:11There&#039;s some control flow to programs.&lt;br /&gt;
5:13That&#039;s what the second line is going to be about.&lt;br /&gt;
5:18The second big part of this course&lt;br /&gt;
5:20is a little bit more abstract, and it&lt;br /&gt;
5:24deals with how do you write good code, good style,&lt;br /&gt;
5:29code that&#039;s readable.&lt;br /&gt;
5:30When you write code, you want to write it such&lt;br /&gt;
5:33that-- you&#039;re in big company, other people will read it,&lt;br /&gt;
5:35other people will use it, so it has&lt;br /&gt;
5:37to be readable and understandable by others.&lt;br /&gt;
5:40To that end, you need to write code&lt;br /&gt;
5:41that&#039;s well organized, modular, easy to understand.&lt;br /&gt;
5:48And not only that, not only will your code&lt;br /&gt;
5:50be read by other people, but next year, maybe,&lt;br /&gt;
5:53you&#039;ll take another course, and you&#039;ll&lt;br /&gt;
5:55want to look back at some of the problems&lt;br /&gt;
5:56that you wrote in this class.&lt;br /&gt;
5:58You want to be able to reread your code.&lt;br /&gt;
6:00If it&#039;s a big mess, you might not be able to understand--&lt;br /&gt;
6:03or reunderstand-- what you were doing.&lt;br /&gt;
6:06So writing readable code and organizing code&lt;br /&gt;
6:08is also a big part.&lt;br /&gt;
6:10And the last section is going to deal with-- the first two&lt;br /&gt;
6:15are actually part of the programming in Introduction&lt;br /&gt;
6:19to Programming and Computer Science in Python.&lt;br /&gt;
6:21And the last one deals mostly with the computer science part&lt;br /&gt;
6:26in Introduction to Programming and Computer Science in Python.&lt;br /&gt;
6:29We&#039;re going to talk about, once you have learned&lt;br /&gt;
6:31how to write programs in Python, how do&lt;br /&gt;
6:33you compare programs in Python?&lt;br /&gt;
6:35How do you know that one program is better than the other?&lt;br /&gt;
6:38How do you know that one program is&lt;br /&gt;
6:39more efficient than the other?&lt;br /&gt;
6:41How do you know that one algorithm&lt;br /&gt;
6:42is better than the other?&lt;br /&gt;
6:45That&#039;s what we&#039;re going to talk about in the last part&lt;br /&gt;
6:47of the course.&lt;br /&gt;
6:48OK.&lt;br /&gt;
6:50That&#039;s all for the administrative part&lt;br /&gt;
6:52of the course.&lt;br /&gt;
6:54Let&#039;s start by talking at a high level what does a computer do.&lt;br /&gt;
6:59Fundamentally, it does two things.&lt;br /&gt;
7:03One, performs calculations.&lt;br /&gt;
7:05It performs a lot of calculations.&lt;br /&gt;
7:07Computers these days are really, really fast,&lt;br /&gt;
7:09a billion calculations per second is probably not far off.&lt;br /&gt;
7:15It performs these calculations and it&lt;br /&gt;
7:16has to store them somewhere.&lt;br /&gt;
7:18Right?&lt;br /&gt;
7:19Stores them in computer memory.&lt;br /&gt;
7:21So a computer also has to remember results.&lt;br /&gt;
7:24And these days, it&#039;s not uncommon to find computers&lt;br /&gt;
7:26with hundreds of gigabytes of storage.&lt;br /&gt;
7:30The kinds of calculations that computers do,&lt;br /&gt;
7:34there are two kinds.&lt;br /&gt;
7:35One are calculations that are built into the language.&lt;br /&gt;
7:37These are the very low level types&lt;br /&gt;
7:39of calculations, things like addition,&lt;br /&gt;
7:41subtraction, multiplication, and so on.&lt;br /&gt;
7:45And once you have a language that&lt;br /&gt;
7:47has these primitive calculation types, you, as a programmer,&lt;br /&gt;
7:53can put these types together and then define&lt;br /&gt;
7:55your own calculations.&lt;br /&gt;
7:57You can create new types of calculations.&lt;br /&gt;
8:00And the computer will be able to perform those, as well.&lt;br /&gt;
8:04I think, one thing I want to stress--&lt;br /&gt;
8:07and we&#039;re going to come back to this&lt;br /&gt;
8:09again during this entire lecture, actually--&lt;br /&gt;
8:12is computers only know what you tell them.&lt;br /&gt;
8:15Computers only do what you tell them to do.&lt;br /&gt;
8:18They&#039;re not magical.&lt;br /&gt;
8:19They don&#039;t have a mind.&lt;br /&gt;
8:22They just know how to perform calculations really,&lt;br /&gt;
8:24really quickly.&lt;br /&gt;
8:26But you have to tell them what calculations to do.&lt;br /&gt;
8:32Computers don&#039;t know anything.&lt;br /&gt;
8:34All right.&lt;br /&gt;
8:35We&#039;ve come to that.&lt;br /&gt;
8:40Let&#039;s go into the types of knowledge.&lt;br /&gt;
8:44The first type of knowledge is declarative knowledge.&lt;br /&gt;
8:48And those are things like statements of fact.&lt;br /&gt;
8:50And this is where my email came into play.&lt;br /&gt;
8:53If you read it all the way to the bottom,&lt;br /&gt;
8:55you would have entered a raffle.&lt;br /&gt;
8:57So a statement of fact for today&#039;s lecture&lt;br /&gt;
8:59is, someone will win a prize before class ends.&lt;br /&gt;
9:03And the prize was a Google Cardboard.&lt;br /&gt;
9:06Google state-of-the-art virtual reality glasses.&lt;br /&gt;
9:09And I have them right here.&lt;br /&gt;
9:14Yea.&lt;br /&gt;
9:15I delivered on my promise.&lt;br /&gt;
9:18That&#039;s a statement of fact.&lt;br /&gt;
9:20So pretend I&#039;m a machine.&lt;br /&gt;
9:22OK?&lt;br /&gt;
9:23I don&#039;t know anything except what you tell me.&lt;br /&gt;
9:26I don&#039;t know.&lt;br /&gt;
9:28I know that you tell me this statement.&lt;br /&gt;
9:30I&#039;m like, OK.&lt;br /&gt;
9:31But how is someone going to win a Google Cardboard&lt;br /&gt;
9:33before class ends, right?&lt;br /&gt;
9:35That&#039;s where imperative knowledge comes in.&lt;br /&gt;
9:37Imperative knowledge is the recipe, or the how-to,&lt;br /&gt;
9:39or the sequence of steps.&lt;br /&gt;
9:42Sorry.&lt;br /&gt;
9:43That&#039;s just my funny for that one.&lt;br /&gt;
9:47So the sequence of steps is imperative knowledge.&lt;br /&gt;
9:53If I&#039;m a machine, you need to tell me&lt;br /&gt;
9:57how someone will win a Google Cardboard before class.&lt;br /&gt;
10:00If I follow these steps, then technically,&lt;br /&gt;
10:02I should reach a conclusion.&lt;br /&gt;
10:06Step one, I think we&#039;ve already done that.&lt;br /&gt;
10:08Whoever wanted to sign up has signed up.&lt;br /&gt;
10:11Now I&#039;m going to open my IDE.&lt;br /&gt;
10:13I&#039;m just basically being a machine&lt;br /&gt;
10:14and following the steps that you&#039;ve told me.&lt;br /&gt;
10:17The IDE that we&#039;re using in this class is called Anaconda.&lt;br /&gt;
10:21I&#039;m just scrolling down to the bottom.&lt;br /&gt;
10:25Hopefully, you&#039;ve installed it in problem set zero.&lt;br /&gt;
10:28I&#039;ve opened my IDE.&lt;br /&gt;
10:30I&#039;m going to follow the next set of instructions.&lt;br /&gt;
10:34I&#039;m going to choose a random number between the first&lt;br /&gt;
10:36and the nth responder.&lt;br /&gt;
10:39Now, I&#039;m going to actually use Python to do this .&lt;br /&gt;
10:42And this is also an example of how just&lt;br /&gt;
10:44a really simple task in your life,&lt;br /&gt;
10:46you can use computers or programming to do that.&lt;br /&gt;
10:48Because if I chose a random number,&lt;br /&gt;
10:50I might be biased because, for example,&lt;br /&gt;
10:51I might like the number 8.&lt;br /&gt;
10:53To choose a random number, I&#039;m going to go and say, OK,&lt;br /&gt;
10:57where&#039;s the list of responders?&lt;br /&gt;
10:58It starts at 15.&lt;br /&gt;
10:59Actually, it starts at 16 because that&#039;s me.&lt;br /&gt;
11:03We&#039;re going to choose a random number between 16&lt;br /&gt;
11:05and the end person 266.&lt;br /&gt;
11:09Oh, we just got-- oh.&lt;br /&gt;
11:11OK.&lt;br /&gt;
11:13OK.&lt;br /&gt;
11:13I&#039;m going to cut it off right here.&lt;br /&gt;
11:15271.&lt;br /&gt;
11:15OK.&lt;br /&gt;
11:1616 and 271.&lt;br /&gt;
11:18Perfect.&lt;br /&gt;
11:19OK.&lt;br /&gt;
11:20I&#039;m going to choose a random number.&lt;br /&gt;
11:21I&#039;m going to go to my IDE.&lt;br /&gt;
11:22And you don&#039;t need to know how to do this yet,&lt;br /&gt;
11:24but by the end of this class, you will.&lt;br /&gt;
11:26I&#039;m just going to use Python.&lt;br /&gt;
11:29I&#039;m just going to get the random number package that&#039;s going&lt;br /&gt;
11:31to give me a random number.&lt;br /&gt;
11:32I&#039;m going to say random.randint.&lt;br /&gt;
11:35And I&#039;m going to choose a random number between 16 and 272,&lt;br /&gt;
11:40OK.&lt;br /&gt;
11:4175.&lt;br /&gt;
11:42OK.&lt;br /&gt;
11:43Great.&lt;br /&gt;
11:44I chose a random number.&lt;br /&gt;
11:45And I&#039;m going to find the number in the responder&#039;s sheet.&lt;br /&gt;
11:48What was the number again?&lt;br /&gt;
11:49Sorry.&lt;br /&gt;
11:5175.&lt;br /&gt;
11:52OK.&lt;br /&gt;
11:54Up we go.&lt;br /&gt;
11:56There we go.&lt;br /&gt;
11:57Lauren Z-O-V. Yeah.&lt;br /&gt;
12:01Nice.&lt;br /&gt;
12:02You&#039;re here.&lt;br /&gt;
12:14Awesome.&lt;br /&gt;
12:16All right.&lt;br /&gt;
12:17That&#039;s an example of me being a machine and also,&lt;br /&gt;
12:21at the same time, using Python in my everyday life,&lt;br /&gt;
12:23just lecturing, to find a random number.&lt;br /&gt;
12:28Try to use Python wherever you can.&lt;br /&gt;
12:30And that just gives you practice.&lt;br /&gt;
12:34That was fun.&lt;br /&gt;
12:35But we&#039;re at MIT.&lt;br /&gt;
12:37We&#039;re MIT students.&lt;br /&gt;
12:39And we love numbers here at MIT.&lt;br /&gt;
12:41Here&#039;s a numerical example that shows&lt;br /&gt;
12:44the difference between declarative and imperative&lt;br /&gt;
12:46knowledge.&lt;br /&gt;
12:50An example of declarative knowledge&lt;br /&gt;
12:51is the square root of a number x is y such that y times y&lt;br /&gt;
12:54is equal to x.&lt;br /&gt;
12:57That&#039;s just a statement of fact It&#039;s true.&lt;br /&gt;
13:02Computers don&#039;t know what to do with that.&lt;br /&gt;
13:05They don&#039;t know what to do with that statement.&lt;br /&gt;
13:07But computers do know how to follow a recipe.&lt;br /&gt;
13:11Here&#039;s a well-known algorithm.&lt;br /&gt;
13:13To find the square root of a number x,&lt;br /&gt;
13:16let&#039;s say x is originally 16, if a computer follows&lt;br /&gt;
13:23this algorithm, it&#039;s going to start with a guess, g,&lt;br /&gt;
13:26let&#039;s say, 3.&lt;br /&gt;
13:28We&#039;re trying to find the square root of 16.&lt;br /&gt;
13:30We&#039;re going to calculate g times g is 9.&lt;br /&gt;
13:34And we&#039;re going to ask is if g times g&lt;br /&gt;
13:36is close enough to x, then stop and say, g is the answer.&lt;br /&gt;
13:39I&#039;m not really happy with 9 being really close to 16.&lt;br /&gt;
13:42So I&#039;m going to say, I&#039;m not stopping here.&lt;br /&gt;
13:44I&#039;m going to keep going.&lt;br /&gt;
13:47If it&#039;s not close enough, then I&#039;m&lt;br /&gt;
13:48going to make a new guess by averaging g and x over g.&lt;br /&gt;
13:52That&#039;s x over g here.&lt;br /&gt;
13:54And that&#039;s the average over there.&lt;br /&gt;
13:57And the new average is going to be my new guess.&lt;br /&gt;
14:04And that&#039;s what it says.&lt;br /&gt;
14:05And then, the last step is using the new guess,&lt;br /&gt;
14:07repeat the process.&lt;br /&gt;
14:08Then we go back to the beginning and repeat the whole process&lt;br /&gt;
14:11over and over again.&lt;br /&gt;
14:13And that&#039;s what the rest of the rows do.&lt;br /&gt;
14:15And you keep doing this until you decide&lt;br /&gt;
14:16that you&#039;re close enough.&lt;br /&gt;
14:23What we saw for the imperative knowledge&lt;br /&gt;
14:25in the previous numerical example&lt;br /&gt;
14:26was the recipe for how to find the square root of x.&lt;br /&gt;
14:31What were the three parts of the recipe?&lt;br /&gt;
14:33One was a simple sequence of steps.&lt;br /&gt;
14:36There were four steps.&lt;br /&gt;
14:39The other was a flow of control, so there were&lt;br /&gt;
14:42parts where we made decisions.&lt;br /&gt;
14:45Are we close enough?&lt;br /&gt;
14:46There were parts where we repeated some steps.&lt;br /&gt;
14:49At the end, we said, repeat steps 1, 2, 3.&lt;br /&gt;
14:52That&#039;s the flow of control.&lt;br /&gt;
14:55And the last part of the recipe was a way to stop.&lt;br /&gt;
14:58You don&#039;t want a program that keeps going and going.&lt;br /&gt;
15:00Or for a recipe, you don&#039;t want to keep baking bread forever.&lt;br /&gt;
15:03You want to stop at some point.&lt;br /&gt;
15:05Like 10 breads is enough, right?&lt;br /&gt;
15:07So you have to have a way of stopping.&lt;br /&gt;
15:10In the previous example, the way of stopping&lt;br /&gt;
15:12was that we decided we were close enough.&lt;br /&gt;
15:15Close enough was maybe being within .01, .001,&lt;br /&gt;
15:20whatever you pick.&lt;br /&gt;
15:23This recipe is there for an algorithm.&lt;br /&gt;
15:26In computer science speak, it&#039;s going to be an algorithm.&lt;br /&gt;
15:29And that&#039;s what we&#039;re going to learn about in this class.&lt;br /&gt;
15:34We&#039;re dealing with computers.&lt;br /&gt;
15:35And we actually want to capture a recipe&lt;br /&gt;
15:37inside a computer, a computer being a mechanical process.&lt;br /&gt;
15:49Historically, there were two different types of computers.&lt;br /&gt;
15:55Originally, there were these things&lt;br /&gt;
15:57called fixed-program computers.&lt;br /&gt;
15:59And I&#039;m old enough to have used something&lt;br /&gt;
16:02like this, where there&#039;s just numbers and plus, minus,&lt;br /&gt;
16:06multiplication, divide, and equal.&lt;br /&gt;
16:08But calculators these days are a lot more complicated.&lt;br /&gt;
16:11But way back then, an example of a fixed-program computer&lt;br /&gt;
16:15is this calculator.&lt;br /&gt;
16:16It only knows how to do addition, multiplication,&lt;br /&gt;
16:19subtraction, division.&lt;br /&gt;
16:20If you want to plot something, you can&#039;t.&lt;br /&gt;
16:22If you want to go on the internet, send email with it,&lt;br /&gt;
16:27you can&#039;t.&lt;br /&gt;
16:27It can only do this one thing.&lt;br /&gt;
16:31And if you wanted to create a machine that did another thing,&lt;br /&gt;
16:33then you&#039;d have to create another fixed-program computer&lt;br /&gt;
16:37that did a completely separate test.&lt;br /&gt;
16:39That&#039;s not very great.&lt;br /&gt;
16:41That&#039;s when stored-program computers came into play.&lt;br /&gt;
16:45And these were machines that could store&lt;br /&gt;
16:47a sequence of instructions.&lt;br /&gt;
16:50And these machines could execute the sequence of instructions.&lt;br /&gt;
16:54And you could change the sequence of instructions&lt;br /&gt;
16:56and execute this different sequence of instructions.&lt;br /&gt;
17:00You could do different tasks in the same machine.&lt;br /&gt;
17:03And that&#039;s the computer as we know it these days.&lt;br /&gt;
17:07The central processing unit is where all of these decisions&lt;br /&gt;
17:11get made.&lt;br /&gt;
17:11And these are all the peripherals.&lt;br /&gt;
17:16The basic machine architecture-- at the heart of every computer&lt;br /&gt;
17:20there&#039;s just this basic architecture--&lt;br /&gt;
17:25and it contains, I guess, four main parts.&lt;br /&gt;
17:28The first is the memory.&lt;br /&gt;
17:31Input and output is the other one.&lt;br /&gt;
17:34The ALU is where all of the operations are done.&lt;br /&gt;
17:39And the operations that the ALU can do&lt;br /&gt;
17:41are really primitive operations, addition, subtraction,&lt;br /&gt;
17:44and so on.&lt;br /&gt;
17:46What the memory contains is a bunch of data&lt;br /&gt;
17:52and your sequence of instructions.&lt;br /&gt;
18:00Interacting with the Arithmetic Logic Unit is the Control Unit.&lt;br /&gt;
18:03And the Control Unit contains one program counter.&lt;br /&gt;
18:07When you load a sequence of instructions,&lt;br /&gt;
18:09the program counter starts at the first sequence.&lt;br /&gt;
18:15It starts at the sequence, at the first instruction.&lt;br /&gt;
18:18It gets what the instruction is, and it sends it to the ALU.&lt;br /&gt;
18:22The ALU asks, what are we doing operations on here?&lt;br /&gt;
18:25What&#039;s happening?&lt;br /&gt;
18:27It might get some data.&lt;br /&gt;
18:29If you&#039;re adding two numbers, it might get two numbers&lt;br /&gt;
18:31from memory.&lt;br /&gt;
18:33It might do some operations.&lt;br /&gt;
18:34And it might store data back into memory.&lt;br /&gt;
18:37And after it&#039;s done, the ALU is going to go back,&lt;br /&gt;
18:41and the program counter is going to increase&lt;br /&gt;
18:43by 1, which means that we&#039;re going&lt;br /&gt;
18:45to go to the next sequence in the instruction set.&lt;br /&gt;
18:50And it just goes linearly, instruction by instruction.&lt;br /&gt;
18:53There might be one particular instruction&lt;br /&gt;
18:56that does some sort of test.&lt;br /&gt;
18:58It&#039;s going to say, is this particular value&lt;br /&gt;
19:07greater or equal to or the same as this other particular value?&lt;br /&gt;
19:11That&#039;s a test, an example of a test.&lt;br /&gt;
19:13And the test is going to either return true or false.&lt;br /&gt;
19:17And depending on the result of that test,&lt;br /&gt;
19:20you might either go to the next instruction,&lt;br /&gt;
19:24or you might set the program counter&lt;br /&gt;
19:26to go all the way back to the beginning, and so on.&lt;br /&gt;
19:29You&#039;re not just linearly stepping&lt;br /&gt;
19:32through all the instructions.&lt;br /&gt;
19:33There might be some control flow involved,&lt;br /&gt;
19:35where you might skip an instruction,&lt;br /&gt;
19:36or start from the beginning, or so on.&lt;br /&gt;
19:39And after you&#039;re done, when you finished&lt;br /&gt;
19:42executing the last instruction, then you&lt;br /&gt;
19:44might output something.&lt;br /&gt;
19:47That&#039;s really the basic way that a computer works.&lt;br /&gt;
19:53Just to recap, you have the stored program computer&lt;br /&gt;
19:55that contains these sequences of instructions.&lt;br /&gt;
19:59The primitive operations that it can do&lt;br /&gt;
20:00are addition, subtraction, logic operations, tests--&lt;br /&gt;
20:06which are something equal to something else, something&lt;br /&gt;
20:08less than, and so on-- and moving data,&lt;br /&gt;
20:10so storing data, moving data around, and things like that.&lt;br /&gt;
20:14And the interpreter goes through every instruction&lt;br /&gt;
20:19and decides whether you&#039;re going to go to the next instruction,&lt;br /&gt;
20:22skip instructions, or repeat instructions, and so on.&lt;br /&gt;
20:28So we&#039;ve talked about primitives.&lt;br /&gt;
20:30And in fact, Alan Turing, who was a really great computer&lt;br /&gt;
20:35scientist, he showed that you can compute anything&lt;br /&gt;
20:37using the six primitives.&lt;br /&gt;
20:38And the six primitives are move left, move right, read, write,&lt;br /&gt;
20:46scan, and do nothing.&lt;br /&gt;
20:49Using those six instructions and the piece of tape,&lt;br /&gt;
20:54he showed that you can compute anything.&lt;br /&gt;
20:57And using those six instructions,&lt;br /&gt;
21:00programming languages came about that&lt;br /&gt;
21:03created a more convenient set of primitives.&lt;br /&gt;
21:05You don&#039;t have to program in only these six commands.&lt;br /&gt;
21:11And one interesting thing, or one really important thing,&lt;br /&gt;
21:16that came about from these six primitives&lt;br /&gt;
21:19is that if you can compute something in Python,&lt;br /&gt;
21:22let&#039;s say-- if you write a program that computes something&lt;br /&gt;
21:25in Python, then, in theory, you can&lt;br /&gt;
21:28write a program that computes the exact same thing&lt;br /&gt;
21:31in any other language.&lt;br /&gt;
21:32And that&#039;s a really powerful statement.&lt;br /&gt;
21:36Think about that today when you review your slides.&lt;br /&gt;
21:39Think about that again.&lt;br /&gt;
21:40That&#039;s really powerful.&lt;br /&gt;
21:45Once you have your set of primitives&lt;br /&gt;
21:49for a particular language, you can start creating expressions.&lt;br /&gt;
21:53And these expressions are going to be&lt;br /&gt;
21:55combinations of the primitives in the programming language.&lt;br /&gt;
22:00And the expressions are going to have some value.&lt;br /&gt;
22:02And they&#039;re going up some meaning in the programming&lt;br /&gt;
22:05language.&lt;br /&gt;
22:08Let&#039;s do a little bit of a parallel with English&lt;br /&gt;
22:10just so you see what I mean.&lt;br /&gt;
22:14In English, the primitive constructs&lt;br /&gt;
22:15are going to be words.&lt;br /&gt;
22:17There&#039;s a lot of words in the English language.&lt;br /&gt;
22:19Programming languages-- in Python, there are primitives,&lt;br /&gt;
22:23but there aren&#039;t as many of them.&lt;br /&gt;
22:25There are floats, Booleans, these&lt;br /&gt;
22:28are numbers, strings, and simple operators,&lt;br /&gt;
22:31like addition, subtraction, and so on.&lt;br /&gt;
22:35So we have primitive constructs.&lt;br /&gt;
22:38Using these primitive constructs,&lt;br /&gt;
22:39we can start creating, in English, phrases, sentences,&lt;br /&gt;
22:48and the same in programming languages.&lt;br /&gt;
22:49In English, we can say something like, &amp;quot;cat, dog, boy.&lt;br /&gt;
22:54That, we say, is not syntactically valid.&lt;br /&gt;
22:58That&#039;s bad syntax.&lt;br /&gt;
23:00That&#039;s noun, noun, noun.&lt;br /&gt;
23:01That doesn&#039;t make sense.&lt;br /&gt;
23:05What does have good syntax in English is noun, verb, noun.&lt;br /&gt;
23:08So, &amp;quot;cat, hugs boy&amp;quot; is syntactically valid.&lt;br /&gt;
23:12Similarly, in a programming language,&lt;br /&gt;
23:14something like this-- in Python, in this case-- a word&lt;br /&gt;
23:18and then the number five doesn&#039;t really make sense.&lt;br /&gt;
23:20It&#039;s not syntactically valid.&lt;br /&gt;
23:22But something like operator, operand, operator is OK.&lt;br /&gt;
23:28So once you&#039;ve created these phrases, or these expressions,&lt;br /&gt;
23:34that are syntactically valid, you&lt;br /&gt;
23:37have to think about the static semantics of your phrase,&lt;br /&gt;
23:41or of your expression.&lt;br /&gt;
23:45For example, in English, &amp;quot;I are hungry&amp;quot; is good syntax.&lt;br /&gt;
23:51But it&#039;s weird to say.&lt;br /&gt;
23:55We have a pronoun, a verb, and an adjective, which&lt;br /&gt;
23:58doesn&#039;t really make sense.&lt;br /&gt;
23:59&amp;quot;I am hungry&amp;quot; is better.&lt;br /&gt;
24:03This does not have good static semantics.&lt;br /&gt;
24:07Similarly, in programming languages--&lt;br /&gt;
24:09and you&#039;ll get the hang of this the more&lt;br /&gt;
24:11you do it-- something like this, &amp;quot;3.2 times 5, is OK.&lt;br /&gt;
24:15But what does it mean?&lt;br /&gt;
24:17What&#039;s the meaning to have a word added to a number?&lt;br /&gt;
24:22There&#039;s no meaning behind that.&lt;br /&gt;
24:25Its syntax is OK, because you have&lt;br /&gt;
24:28operator, operand, operator.&lt;br /&gt;
24:30But it doesn&#039;t really make sense to add a number to a word,&lt;br /&gt;
24:32for example.&lt;br /&gt;
24:36Once you have created these expressions that&lt;br /&gt;
24:39are syntactically correct and static, semantically correct,&lt;br /&gt;
24:44in English, for example, you think about the semantics.&lt;br /&gt;
24:48What&#039;s the meaning of the phrase?&lt;br /&gt;
24:50In English, you can actually have more than one&lt;br /&gt;
24:52meaning to an entire phrase.&lt;br /&gt;
24:56In this case, &amp;quot;flying planes can be dangerous&amp;quot;&lt;br /&gt;
25:01can have two meanings.&lt;br /&gt;
25:02It&#039;s the act of flying a plane is dangerous,&lt;br /&gt;
25:04or the plane that is in the air is dangerous.&lt;br /&gt;
25:08And this might be a cuter example.&lt;br /&gt;
25:10&amp;quot;This reading lamp hasn&#039;t uttered a word&lt;br /&gt;
25:12since I bought it.&lt;br /&gt;
25:13What&#039;s going on?&amp;quot;&lt;br /&gt;
25:15So that has two meanings.&lt;br /&gt;
25:16It&#039;s playing on the word &amp;quot;reading lamp.&amp;quot;&lt;br /&gt;
25:21That&#039;s in English.&lt;br /&gt;
25:21In English, you can have a sentence&lt;br /&gt;
25:23that has more than one meaning, that&#039;s&lt;br /&gt;
25:25syntactically correct and static, semantically correct.&lt;br /&gt;
25:28But in programming languages, the program that you write,&lt;br /&gt;
25:31the set of instructions that you write, only has one meaning.&lt;br /&gt;
25:34Remember, we&#039;re coming back to the fact&lt;br /&gt;
25:35that the computer only does what you tell it to do.&lt;br /&gt;
25:40It&#039;s not going to suddenly decide&lt;br /&gt;
25:42to add another variable for some reason.&lt;br /&gt;
25:46It&#039;s just going to execute whatever statements you&#039;ve&lt;br /&gt;
25:49put up.&lt;br /&gt;
25:50In programming languages, there&#039;s only one meaning.&lt;br /&gt;
25:52But the problem that comes into play in programming languages&lt;br /&gt;
25:58is it&#039;s not the meaning that you might have&lt;br /&gt;
25:59intended, as the programmer.&lt;br /&gt;
26:03That&#039;s where things can go wrong.&lt;br /&gt;
26:05And there&#039;s going to be a lecture&lt;br /&gt;
26:07on debugging a little bit later in the course.&lt;br /&gt;
26:10But this is here just to tell you&lt;br /&gt;
26:12that if you see an error pop up in your program,&lt;br /&gt;
26:16it&#039;s just some text that says, error.&lt;br /&gt;
26:21For example, if we do something like this,&lt;br /&gt;
26:28this is syntactically correct.&lt;br /&gt;
26:30Incorrect.&lt;br /&gt;
26:31Syntactically incorrect.&lt;br /&gt;
26:32See?&lt;br /&gt;
26:32There&#039;s some angry text right here.&lt;br /&gt;
26:36What is going on?&lt;br /&gt;
26:37The more you program, the more you&#039;ll&lt;br /&gt;
26:39get the hang of reading these errors.&lt;br /&gt;
26:41But this is basically telling me the line&lt;br /&gt;
26:43that I wrote is syntactically incorrect.&lt;br /&gt;
26:45And it&#039;s pointing to the exact line and says, this is wrong,&lt;br /&gt;
26:49so I can go back and fix it as a programmer.&lt;br /&gt;
26:55Syntax errors are actually really easily caught by Python.&lt;br /&gt;
27:00That was an example of a syntax error.&lt;br /&gt;
27:02Static semantic errors can also be&lt;br /&gt;
27:04caught by Python as long as, if your program has some decisions&lt;br /&gt;
27:09to make, as long as you&#039;ve gone down the branch where&lt;br /&gt;
27:13the static semantic error happens.&lt;br /&gt;
27:18And this is probably going to be the most frustrating one,&lt;br /&gt;
27:22especially as you&#039;re starting out.&lt;br /&gt;
27:23The program might do something different than what&lt;br /&gt;
27:25you expected it to do.&lt;br /&gt;
27:27And that&#039;s not because the program suddenly-- for example,&lt;br /&gt;
27:32you expected the program to give you an output of 0&lt;br /&gt;
27:34for a certain test case, and the output that you got was 10.&lt;br /&gt;
27:37Well, the program didn&#039;t suddenly&lt;br /&gt;
27:39decide to change its answer to 10.&lt;br /&gt;
27:42It just executed the program that you wrote.&lt;br /&gt;
27:48That&#039;s the case where the program gave you&lt;br /&gt;
27:50a different answer than expected.&lt;br /&gt;
27:53Programs might crash, which means they stop running.&lt;br /&gt;
27:55That&#039;s OK.&lt;br /&gt;
27:57Just go back to your code and figure out what was wrong.&lt;br /&gt;
28:00And another example of a different meaning&lt;br /&gt;
28:03than what you intended was maybe the program won&#039;t stop.&lt;br /&gt;
28:06It&#039;s also OK.&lt;br /&gt;
28:07There are ways to stop it besides restarting&lt;br /&gt;
28:10the computer.&lt;br /&gt;
28:12So then Python programs are going&lt;br /&gt;
28:17to be sequences of definitions and commands.&lt;br /&gt;
28:20We&#039;re going to have expressions that are going to be evaluated&lt;br /&gt;
28:25and commands that tell the interpreter to do something.&lt;br /&gt;
28:33If you&#039;ve done problem set 0, you&#039;ll&lt;br /&gt;
28:35see that you can type commands directly&lt;br /&gt;
28:37in the shell here, which is the part on the right where&lt;br /&gt;
28:40I did some really simple things, 2 plus 4.&lt;br /&gt;
28:44Or you can type commands up in here, on the left-hand side,&lt;br /&gt;
28:49and then run your program.&lt;br /&gt;
28:52Notice that, well, we&#039;ll talk about this-- I&lt;br /&gt;
28:54won&#039;t talk about this now.&lt;br /&gt;
28:55But these are-- on the right-hand side, typically,&lt;br /&gt;
28:59you write very simple commands just if you&#039;re&lt;br /&gt;
29:01testing something out.&lt;br /&gt;
29:03And on the left-hand side here in the editor,&lt;br /&gt;
29:04you write more lines and more complicated programs.&lt;br /&gt;
29:15Now we&#039;re going to start talking about Python.&lt;br /&gt;
29:18And in Python, we&#039;re going to come back to this,&lt;br /&gt;
29:20everything is an object.&lt;br /&gt;
29:23And Python programs manipulate these data objects.&lt;br /&gt;
29:27All objects in Python are going to have a type.&lt;br /&gt;
29:30And the type is going to tell Python the kinds of operations&lt;br /&gt;
29:34that you can do on these objects.&lt;br /&gt;
29:37If an object is the number five, for example,&lt;br /&gt;
29:39you can add the number to another number,&lt;br /&gt;
29:42subtract the number, take it to the power of something,&lt;br /&gt;
29:45and so on.&lt;br /&gt;
29:47As a more general example, for example, I am a human.&lt;br /&gt;
29:51So that&#039;s my type.&lt;br /&gt;
29:52And I can walk, speak English, et cetera.&lt;br /&gt;
29:55Chewbacca is going to be a type Wookie.&lt;br /&gt;
29:59He can walk, do that sound that I can&#039;t do.&lt;br /&gt;
30:02He can do that, but I can&#039;t.&lt;br /&gt;
30:04I&#039;m not even going to try, and so on.&lt;br /&gt;
30:09Once you have these Python objects,&lt;br /&gt;
30:11everything is an object in Python.&lt;br /&gt;
30:14There are actually two types of objects.&lt;br /&gt;
30:16One are scalar objects.&lt;br /&gt;
30:18That means these are very basic objects in Python from which&lt;br /&gt;
30:21everything can be made.&lt;br /&gt;
30:24These are scalar objects.&lt;br /&gt;
30:26That can&#039;t be subdivided.&lt;br /&gt;
30:28The other type of object is a non-scalar object.&lt;br /&gt;
30:31And these are objects that have some internal structure.&lt;br /&gt;
30:33For example, the number five is a scalar&lt;br /&gt;
30:36object because it can&#039;t be subdivided.&lt;br /&gt;
30:39But a list of numbers, for example, 5, 6,&lt;br /&gt;
30:417,8, is going to be a non-scalar object&lt;br /&gt;
30:45because you can subdivide it.&lt;br /&gt;
30:46You can subdivide it into-- you can find parts to it.&lt;br /&gt;
30:53It&#039;s made up of a sequence of numbers.&lt;br /&gt;
30:58Here&#039;s the list of all of the scalar objects in Python.&lt;br /&gt;
31:01We have integers, for example, all of the whole numbers.&lt;br /&gt;
31:05Floats, which are all of the real numbers, anything&lt;br /&gt;
31:10with a decimal.&lt;br /&gt;
31:11Bools are Booleans.&lt;br /&gt;
31:13There&#039;s only two values to Booleans.&lt;br /&gt;
31:16That&#039;s True and False.&lt;br /&gt;
31:18Note the capitalization, capital T and capital F.&lt;br /&gt;
31:23And this other thing called NoneType.&lt;br /&gt;
31:24It&#039;s special.&lt;br /&gt;
31:26It has only one value called None.&lt;br /&gt;
31:28And it represents the absence of a type.&lt;br /&gt;
31:30And it sometimes comes in handy for some programs.&lt;br /&gt;
31:34If you want to find the type of an object,&lt;br /&gt;
31:36you can use this special command called type.&lt;br /&gt;
31:39And then in the parentheses, you put down&lt;br /&gt;
31:41what you want to find the type of.&lt;br /&gt;
31:44You can write into the shell &amp;quot;type of 5,&amp;quot;&lt;br /&gt;
31:47and the shell will tell you, that&#039;s an integer.&lt;br /&gt;
31:52If you happen to want to convert between two different types,&lt;br /&gt;
31:56Python allows you to do that.&lt;br /&gt;
31:58And to do that, you put the type that you&lt;br /&gt;
32:01want to convert to right before the object&lt;br /&gt;
32:03that you want to convert to.&lt;br /&gt;
32:05So float(3) will convert the integer 3 to the float 3.0.&lt;br /&gt;
32:12And similarly, you can convert any float into an integer.&lt;br /&gt;
32:16And converting to an integer just truncates.&lt;br /&gt;
32:20It just takes away the decimal and whatever&#039;s&lt;br /&gt;
32:22after it-- it does not round-- and keeps just the integer&lt;br /&gt;
32:26part.&lt;br /&gt;
32:30For this slide, I&#039;m going to talk about it.&lt;br /&gt;
32:31But if you&#039;d like if you have the slides up,&lt;br /&gt;
32:35go to go to this exercise.&lt;br /&gt;
32:37And after I&#039;m done talking about the slide,&lt;br /&gt;
32:41we&#039;ll see what people think for that exercise.&lt;br /&gt;
32:45One of the most important things that you&lt;br /&gt;
32:47can do in basically any programming,&lt;br /&gt;
32:51in Python also, is to print things out.&lt;br /&gt;
32:55Printing out is how you interact with the user.&lt;br /&gt;
33:00To print things out, you use the print command.&lt;br /&gt;
33:04If you&#039;re in the shell, if you simply type &amp;quot;3 plus 2,&amp;quot;&lt;br /&gt;
33:07you do see a value here.&lt;br /&gt;
33:09Five, right?&lt;br /&gt;
33:11But that&#039;s not actually printing something out.&lt;br /&gt;
33:13And that becomes apparent when you actually&lt;br /&gt;
33:18type things into the editor.&lt;br /&gt;
33:19If you just do &amp;quot;3 plus 2,&amp;quot; and you run the program-- that&#039;s&lt;br /&gt;
33:23the green button here-- you see on the right-hand side here,&lt;br /&gt;
33:26it ran my program.&lt;br /&gt;
33:27But it didn&#039;t actually print anything.&lt;br /&gt;
33:30If you type this into the console,&lt;br /&gt;
33:32it does show you this value, but that&#039;s&lt;br /&gt;
33:33just like peeking into the value for you as a programmer.&lt;br /&gt;
33:39It&#039;s not actually printing it out to anyone.&lt;br /&gt;
33:41If you want to print something out,&lt;br /&gt;
33:42you have to use the print statement like that.&lt;br /&gt;
33:47In this case, this is actually going to print this number&lt;br /&gt;
33:50five to the console.&lt;br /&gt;
33:58That&#039;s basically what it says.&lt;br /&gt;
33:59It just tells you it&#039;s an interaction within the shell&lt;br /&gt;
34:01only.&lt;br /&gt;
34:02It&#039;s not interacting with anyone else.&lt;br /&gt;
34:04And if you don&#039;t have any &amp;quot;Out,&amp;quot; that&lt;br /&gt;
34:06means it got printed out to the console.&lt;br /&gt;
34:09All right.&lt;br /&gt;
34:09We talked a little bit about objects.&lt;br /&gt;
34:13Once you have objects, you can combine objects and operators&lt;br /&gt;
34:16to form these expressions.&lt;br /&gt;
34:17And each expression is going to have a value.&lt;br /&gt;
34:19So an expression evaluates to a value.&lt;br /&gt;
34:22The syntax for an expression is going&lt;br /&gt;
34:24to be object, operator, object, like that.&lt;br /&gt;
34:30And these are some operators you can do on ints and floats.&lt;br /&gt;
34:34There&#039;s the typical ones, addition, subtraction,&lt;br /&gt;
34:36multiplication, and division.&lt;br /&gt;
34:38If, for the first three, the answer&lt;br /&gt;
34:43that you get-- the type of the answer that you get--&lt;br /&gt;
34:45is going to depend on the type of your variables.&lt;br /&gt;
34:48If both of the variables of the operands are integers,&lt;br /&gt;
34:52then the result you&#039;re going to get is of type integer.&lt;br /&gt;
34:55But if at least one of them is a float, then&lt;br /&gt;
34:56the result you&#039;re going to get is a float.&lt;br /&gt;
34:58Division is a little bit special in that&lt;br /&gt;
35:02no matter what the operands are, the result&lt;br /&gt;
35:04is always going to be a float.&lt;br /&gt;
35:09The other operations you can do, and these are also useful,&lt;br /&gt;
35:14are the remainder, so the percent sign.&lt;br /&gt;
35:19If you use the percent sign between two operands,&lt;br /&gt;
35:22that&#039;s going to give you the remainder when you divide i&lt;br /&gt;
35:25by j.&lt;br /&gt;
35:28And raising something to the power of something else&lt;br /&gt;
35:30is using the star star operator.&lt;br /&gt;
35:32And i star stars j is going to take i to the power of j.&lt;br /&gt;
35:41These operations have the typical precedence&lt;br /&gt;
35:43that you might expect in math, for example.&lt;br /&gt;
35:47And if you&#039;d like to put precedence&lt;br /&gt;
35:49toward some other operations, you&lt;br /&gt;
35:50can use parentheses to do that.&lt;br /&gt;
36:01All right.&lt;br /&gt;
36:03So we have ways of creating expressions.&lt;br /&gt;
36:07And we have operations we can do on objects.&lt;br /&gt;
36:13But what&#039;s going to be useful is to be able to save values&lt;br /&gt;
36:19to some name.&lt;br /&gt;
36:21And the name is going to be something that you pick.&lt;br /&gt;
36:24And it should be a descriptive name.&lt;br /&gt;
36:27And when you save the value to a name,&lt;br /&gt;
36:32you&#039;re going to be able to access that value later&lt;br /&gt;
36:36on in your program.&lt;br /&gt;
36:37And that&#039;s very useful.&lt;br /&gt;
36:40To save a value to a variable name, you use the equal sign.&lt;br /&gt;
36:49And the equal sign is an assignment.&lt;br /&gt;
36:51It assigns the right-hand side, which&lt;br /&gt;
36:53is a value, to the left-hand side, which&lt;br /&gt;
36:55is going to be a variable name.&lt;br /&gt;
36:59In this case, I assigned the float 3.14159&lt;br /&gt;
37:03to the variable pi.&lt;br /&gt;
37:05And in the second line, I&#039;m going&lt;br /&gt;
37:08to take this expression, 22 divided by 7,&lt;br /&gt;
37:10I&#039;m going to evaluate it.&lt;br /&gt;
37:13It&#039;s going to come up with some decimal number.&lt;br /&gt;
37:16And I&#039;m going to save it into the variable pi_approx.&lt;br /&gt;
37:19values are stored in memory.&lt;br /&gt;
37:21And this assignment in Python, we&lt;br /&gt;
37:22say the assignment binds the name to the value.&lt;br /&gt;
37:26When you use that name later on in your program,&lt;br /&gt;
37:30you&#039;re going to be referring to the value in memory.&lt;br /&gt;
37:35And if you ever want to refer to the value&lt;br /&gt;
37:37later on in your code, you just simply type&lt;br /&gt;
37:39the name of the variable that you&#039;ve assigned it to.&lt;br /&gt;
37:44So why do we want to give names to expressions?&lt;br /&gt;
37:48Well, you want to reuse the names instead of the values.&lt;br /&gt;
37:51And it makes your code look a lot nicer.&lt;br /&gt;
37:54This is a piece of code that calculates&lt;br /&gt;
37:56the area of a circle.&lt;br /&gt;
37:59And notice, I&#039;ve assigned a variable pi to 3.14159.&lt;br /&gt;
38:03I&#039;ve assigned another variable called radius to be 2.2.&lt;br /&gt;
38:07And then, later on in my code, I have another line&lt;br /&gt;
38:09that says area-- this is another variable-- is&lt;br /&gt;
38:12equal to-- this is an assignment--&lt;br /&gt;
38:15to this expression.&lt;br /&gt;
38:17And this expression is referring to these variable names, pi&lt;br /&gt;
38:23and radius.&lt;br /&gt;
38:24And it&#039;s going look up their values in memory.&lt;br /&gt;
38:26And it&#039;s going to replace these variable names&lt;br /&gt;
38:29with those values.&lt;br /&gt;
38:30And it&#039;s going to do the calculation for me.&lt;br /&gt;
38:32And in the end, this whole expression&lt;br /&gt;
38:34is going to be replaced by one number.&lt;br /&gt;
38:36And it&#039;s going to be the float.&lt;br /&gt;
38:40Here&#039;s another exercise, while I&#039;m talking about the slide.&lt;br /&gt;
38:45I do want to make a note about programming versus math.&lt;br /&gt;
38:49In math, you&#039;re often presented with a problem&lt;br /&gt;
38:55that says, solve for x.&lt;br /&gt;
38:57x plus y is equal to something something.&lt;br /&gt;
39:00Solve for x, for example.&lt;br /&gt;
39:03That&#039;s coming back to the fact that computers don&#039;t&lt;br /&gt;
39:09know what to do with that.&lt;br /&gt;
39:10Computers need to be told what to do.&lt;br /&gt;
39:12In programming, if you want to solve for x,&lt;br /&gt;
39:14you need to tell the computer exactly how to solve for x.&lt;br /&gt;
39:18You need to figure out what formula&lt;br /&gt;
39:20you need to give the computer in order to be&lt;br /&gt;
39:22able to solve for x.&lt;br /&gt;
39:25That means always in programming the right-hand side is&lt;br /&gt;
39:29going to be an expression.&lt;br /&gt;
39:33It&#039;s something that&#039;s going to be evaluated to a value.&lt;br /&gt;
39:35And the left-hand side is always a variable.&lt;br /&gt;
39:39It&#039;s going to be an assignment.&lt;br /&gt;
39:40The equal sign is not like in math&lt;br /&gt;
39:43where you can have a lot of things to the left&lt;br /&gt;
39:45and a lot of things to the right of the equal sign.&lt;br /&gt;
39:47There&#039;s only one thing to the left of the equal sign.&lt;br /&gt;
39:49And that&#039;s going to be a variable.&lt;br /&gt;
39:50An equal sign stands for an assignment.&lt;br /&gt;
39:53Once we&#039;ve created expressions, and we have these assignments,&lt;br /&gt;
39:57you can rebind variable names using new assignment&lt;br /&gt;
39:59statements.&lt;br /&gt;
40:03Let&#039;s look at an example for that.&lt;br /&gt;
40:05Let&#039;s say this is our memory.&lt;br /&gt;
40:07Let&#039;s type back in the example with finding the radius.&lt;br /&gt;
40:13Let&#039;s say, pi is equal to 3.14.&lt;br /&gt;
40:19In memory, we&#039;re going to create this value 3.14.&lt;br /&gt;
40:22We&#039;re going to bind it to the variable named pi.&lt;br /&gt;
40:28Next line, radius is equal to 2.2.&lt;br /&gt;
40:31In memory, we&#039;re creating this value 2.2.&lt;br /&gt;
40:35And we&#039;re going to bind it to the variable named radius.&lt;br /&gt;
40:40Then we have this expression here.&lt;br /&gt;
40:44It&#039;s going to substitute the values for pi&lt;br /&gt;
40:46from memory and the value for radius from memory.&lt;br /&gt;
40:49It&#039;s going to calculate the value that this expression&lt;br /&gt;
40:54evaluates to.&lt;br /&gt;
40:56It&#039;s going to pop that into the memory.&lt;br /&gt;
40:57And it&#039;s going to assign-- because we&#039;re&lt;br /&gt;
40:59using the equal sign-- it&#039;s going&lt;br /&gt;
41:01to assign that value to that variable area.&lt;br /&gt;
41:08Now, let&#039;s say we rebind radius to be something else.&lt;br /&gt;
41:14Radius i is bound to the value 2.2.&lt;br /&gt;
41:21But when we do this line, radius is equal to radius plus 1,&lt;br /&gt;
41:24we&#039;re going to take away the binding to 2.2.&lt;br /&gt;
41:27We&#039;re going to do this calculation.&lt;br /&gt;
41:29The new value is 3.2.&lt;br /&gt;
41:31And we&#039;re going to rebind that value to that same variable.&lt;br /&gt;
41:38In memory, notice we&#039;re still going&lt;br /&gt;
41:40to have this value, 2.2, floating around.&lt;br /&gt;
41:43But we&#039;ve lost the handle for it.&lt;br /&gt;
41:46There&#039;s no way to get it back.&lt;br /&gt;
41:48It&#039;s just in memory sitting there.&lt;br /&gt;
41:52At some point, it might get collected by what&lt;br /&gt;
41:55we call the garbage collector.&lt;br /&gt;
41:56In Python, And it&#039;ll retrieve these lost values,&lt;br /&gt;
42:00and it&#039;ll reuse them for new values, and things like that.&lt;br /&gt;
42:05But radius now points to the new value.&lt;br /&gt;
42:08We can never get back 2.2.&lt;br /&gt;
42:13And that&#039;s it.&lt;br /&gt;
42:16The value of area-- notice, this is very important.&lt;br /&gt;
42:18The value of area did not change.&lt;br /&gt;
42:23And it did not change because these are all the instructions&lt;br /&gt;
42:26we told the computer to do.&lt;br /&gt;
42:28We just told it to change radius to be radius plus 1.&lt;br /&gt;
42:33We never told it to recalculate the value of area.&lt;br /&gt;
42:37If I copied that line down here, then the value of area&lt;br /&gt;
42:41would change.&lt;br /&gt;
42:42But we never told it to do that.&lt;br /&gt;
42:44The computer only does what we tell it to do.&lt;br /&gt;
42:46That&#039;s the last thing.&lt;br /&gt;
42:47Next lecture, we&#039;re going to talk about adding control&lt;br /&gt;
42:51flow to our programs, so how do you tell the computer&lt;br /&gt;
42:53to do one thing or another?&lt;br /&gt;
42:55All right.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lecture Notes - lecture 1 py===&lt;br /&gt;
Source: https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/920cc911b6eb5747f2ccd431bbc4306b_lec1.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
lecture 1 py&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi = 3.14159&lt;br /&gt;
radius = 2.2&lt;br /&gt;
# area of circle equation &amp;lt;- this is a comment&lt;br /&gt;
area = pi*(radius**2)&lt;br /&gt;
print(area)&lt;br /&gt;
&lt;br /&gt;
# change values of radius &amp;lt;- another comment&lt;br /&gt;
# use comments to help others understand what you are doing in code&lt;br /&gt;
radius = radius + 1&lt;br /&gt;
print(area)     # area doesn&#039;t change&lt;br /&gt;
area = pi*(radius**2)&lt;br /&gt;
print(area)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#############################&lt;br /&gt;
#### COMMENTING LINES #######&lt;br /&gt;
#############################&lt;br /&gt;
# to comment MANY lines at a time, highlight all of them then CTRL+1&lt;br /&gt;
# do CTRL+1 again to uncomment them&lt;br /&gt;
# try it on the next few lines below!&lt;br /&gt;
&lt;br /&gt;
#area = pi*(radius**2)&lt;br /&gt;
#print(area)&lt;br /&gt;
#radius = radius + 1&lt;br /&gt;
#area = pi*(radius**2)&lt;br /&gt;
#print(area)&lt;br /&gt;
&lt;br /&gt;
#############################&lt;br /&gt;
#### AUTOCOMPLETE #######&lt;br /&gt;
#############################&lt;br /&gt;
# Spyder can autocomplete names for you&lt;br /&gt;
# start typing a variable name defined in your program and hit tab &lt;br /&gt;
# before you finish typing -- try it below&lt;br /&gt;
&lt;br /&gt;
# define a variable&lt;br /&gt;
a_very_long_variable_name_dont_name_them_this_long_pls = 0&lt;br /&gt;
&lt;br /&gt;
# below, start typing a_ve then hit tab... cool, right!&lt;br /&gt;
# use autocomplete to change the value of that variable to 1&lt;br /&gt;
&lt;br /&gt;
# use autocomplete to write a line that prints the value of that long variable&lt;br /&gt;
# notice that Spyder also automatically adds the closed parentheses for you!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===pdf-Slides for Lecture 1===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_lec1/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmemB25bVuN2fuiAq3JaDM4J5MYit6HfCCsU3EFTWL7wpF&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Set 1===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_ps1/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmbxaDU9U4hquK4Dhb365nD5qG5eEFUM6NABqXRaux6tRB&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Additional Python Resources ===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_additional/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmYWPVdHEbhmdFXNR9R46ey5eykyFPeCZ1joXE6z28L1VB&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Additional Python Resources:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
If you&#039;re having trouble with a particular concept or simply want to have access to more&lt;br /&gt;
information, try one of the following links.&lt;br /&gt;
&lt;br /&gt;
====DOCUMENTATION====&lt;br /&gt;
* [[https://docs.python.org/3/library/index.html Official Python 3 Documentation]] - &amp;quot;official&amp;quot;/technical explanation of what a particular function/operator&lt;br /&gt;
does, examples of correct syntax, what the various libraries are, etc.&lt;br /&gt;
&lt;br /&gt;
====TEXTBOOKS/TUTORIALS====&lt;br /&gt;
* [[https://diveintopython3.net/ Dive Into Python]] - another survey of Python syntax, datatypes, etc.&lt;br /&gt;
* [[http://greenteapress.com/wp/think-python-2e/ Think Python by Allen Downey]] - a good general overview of the Python language. Includes exercises.&lt;br /&gt;
* [[https://docs.python.org/3/tutorial/ The Official Python Tutorial]] - self-explanatory&lt;br /&gt;
* [[https://learnpythonthehardway.org/book/ Learn Python the Hard Way]] - (note: for Python 2) another free online text&lt;br /&gt;
* [[https://docs.python.org/3.0/reference/lexical_analysis.html#id8 Reserved Keywords in Python]] - don&#039;t use these as variable names&lt;br /&gt;
* [[https://peps.python.org/pep-0008/ PEP 8 - Style Guide for Python Code]] - learn what is good and bad style in Python&lt;br /&gt;
* [[https://checkio.org/ CheckIO]] - learn Python by exploring a game world&lt;br /&gt;
* [[https://inventwithpython.com/ Invent with Python]] - develop your Python skills by making games or hacking ciphers&lt;br /&gt;
* [[https://www.codecademy.com/catalog Codecademy]] - (note: for Python 2) learn Python by building web apps and manipulating data; interactive&lt;br /&gt;
tutorial sequence&lt;br /&gt;
* [[https://pythontutor.com Python Tutor]] - interactive tutorial sequence of exercises&lt;br /&gt;
&lt;br /&gt;
====DEBUGGING====&lt;br /&gt;
* [[https://pythontutor.com/ Python Tutor]] - an excellent way to actually visualize how the interpreter actually reads and executes&lt;br /&gt;
your code&lt;br /&gt;
* [[https://www.diffchecker.com/ DiffChecker]] - compares two sets of text and shows you which lines are different&lt;br /&gt;
* [[https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ Debugging in Python]] - steps you can take to try to debug your program&lt;br /&gt;
&lt;br /&gt;
====OTHER Q&amp;amp;A====&lt;br /&gt;
* [[https://stackoverflow.com/questions/tagged/python Stack Overflow]] - a large Q&amp;amp;A forum for programming concepts (not just Python). Try searching here&lt;br /&gt;
before you post on the edX forum, and you may find that someone has already answered your question.&lt;br /&gt;
&lt;br /&gt;
====MORE PRACTICE PROBLEMS====&lt;br /&gt;
* [[http://www.pythonchallenge.com/ Python Challenge]] - a series of puzzles you can try to test your Python abilities&lt;br /&gt;
* [[https://projecteuler.net/ Project Euler]] - additional programming challenges you can try once your Python knowledge becomes&lt;br /&gt;
stronger; problems are sorted by increasing difficulty&lt;br /&gt;
* [[https://codingbat.com/python Coding Bat]] - problems you can solve within an online interpreter&lt;br /&gt;
* [[https://www.codewars.com/?language=python Codewars]] - improve your skills by training on real code challenges&lt;br /&gt;
&lt;br /&gt;
MIT OpenCourseWare&lt;br /&gt;
https://ocw.mit.edu&lt;br /&gt;
6.0001 Introduction to Computer Science and Programming in Python&lt;br /&gt;
Fall 2016&lt;br /&gt;
For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==2==&lt;br /&gt;
mit-test-course/2/MIT6_0001F16_Lecture_02_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
https://ipfs.io/ipfs/QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
mit-test-course/2/ba2947b25b1580e4a84df0ec5dbe5cdd_MIT6_0001F16_Lec2.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
https://ipfs.io/ipfs/QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
mit-test-course/2/d6ee838ee4c85ace93a4e170cfd83c03_lec2_branch_loops.py&amp;lt;br&amp;gt;&lt;br /&gt;
https://ipfs.io/ipfs/QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3==&lt;br /&gt;
&lt;br /&gt;
MIT6_0001F16_Lecture_03_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmTTCsuhbnjXWuigZLSgKAt4DjFsm78MANo3KUMGcK98s1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
88de925a1fb925e46a08bc5f34d029bd_lec3_strings_algos.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmYppDgGMptihHA7ixFw2GHvspN8Bw1HY21HtUpQNxi23i&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
b9b9a82a29e8746db1facfbd30c07940_MIT6_0001F16_Lec3.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmP2AZfUx8RTqCGamJtPyodFU8dHG8QrBHYKkP79YepEe9&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==4==&lt;br /&gt;
&lt;br /&gt;
MIT6_0001F16_Lecture_04_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmQuc5zpaJdMfRYxTLyZc5DQuota1FjuJiqgWf8ctGmRsU&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
6ba59859535f1566dd57a7279aeba5d1_MIT6_0001F16_Lec4.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmP1p4h21ogMxWeeX2PiDibQbHqWer7ABCsMrfMxEx7QBW&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
9e8439a27af18817e046ac37333d03f6_lec4_functions.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmNtPQncXMYNBnX4NoNfx2ifetrfvrATamdrsjx4u9iQ7c&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==5==&lt;br /&gt;
MIT6_0001F16_Lecture_05_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Qmco5sKKQfnWUNP9ZUxLkDhoV6jfjv8L4AdzES7En41AzP&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
1776670e271578eeb99fc25975f20586_MIT6_0001F16_Lec5.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmSdxg2inPbK1FSynNdPUka6CUZtEGG6sdPZgxaAgb46GE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
cdf5f8e7f109952655f4d253ed955555_lec5_tuples_lists.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmThDori5ETa3U27DFpndU7RmsLgG7zjpqGVxAncCupSuc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==6==&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_06_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmVzK3PVETv69Y27UKDfaQQM5um8ByMdYQS3TzD2EkoR42&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;876348c652c5353daccc96e1b7d577bb_MIT6_0001F16_Lec6.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmQAqSGJAeoypUMyUnb7hRrziDyRAwymcTGdcaydT5i73s&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;706228e592761d9c7c1c073f8ba7a6cc_lec6_recursion_dictionaries.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmaGhNYnR5yUMYZf4q7qLsNwEW6B7pbLbgJokJBTNSA2FT&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==7==&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_07_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmUyiqpAUA91w4Xm2Dz2wPr6kE6wTzA1apwJziTdBysRLw&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
51bdde43dfd773ba20747ce5d89119ac_MIT6_0001F16_Lec7.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmcqZoeVrsfBv4Ri6M8KtiLdy3VpKnyznDFhX8zvfd3Qrs&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
abdd1d61892ccce9be2ad84e52004e07_lec7_debug_except.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmeVKCB6ponYr4f72MuNwegukX9t42NTywNHpDPgyNi9ae&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==8==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_08_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmZFSSPndvRfPT2vyehuyEQitfb8CzdYkA7orFAKyvhA4u&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;7a6f85d03f132dcd9d7592bc4643be1c_MIT6_0001F16_Lec8.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmdccChFuYBCiLmufEmk6oXCHybaUQiPXajD3c3xMupiaC&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;0705ac9dcc7e637a0e8e9d97eb258a26_lec8_classes.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmQCaZZA75UQ5pAKy8zhcz6Ci8yY13UVHUvsuXmid86GUH&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==9==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_09_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmdENonCipE7TK99i7dFz9paqDUSefR4PFdveEmVi5oXAb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;2dd6c75e7b4bd6bd135078e6f3701201_MIT6_0001F16_Lec9.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmbaJFk4mFRmCbtQybK94etyfRA2LcM22Kfvjbvdf6X8Gw&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bf8e8195044d5f6aefc1a455968e2f3e_lec9_inheritance.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmQ7UB4PaGBRHvHfDshrASwynvansFVXrp3RNULwhThUsC&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==10==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_10_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmQNooq1g25LFp1Fxj2tfpKKMKi8NbutkhuXNf5Ppo7t5f&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;066eba6ea6d56a88e56ae325940d4c4c_MIT6_0001F16_Lec10.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmbyP59ttPKGe5ZNADsgqTsgBF3oYGzhZXFfBhszG2nuPm&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bfa32fd241d88ae02cd3157aed232bac_lec10_complexity_part1.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmUtgXQXjj2C3qb2UXFrPmKHkFdEjmehk4ZLQhcZ37rEmw&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==11==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_11_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmR7Ned6iZytjpVHVN6W53EZ5Qg4Zd6EkEcXxn8DjYMgrd&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bb953fb81d4afa3bc837c16eba613955_MIT6_0001F16_Lec11.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmNPjN3616QdmEWLPokwuTkLL1vrzcLVRSFLWUcukqtxZL&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bdf800867e6762c6758ecd2230178f41_lec11_complexity_part2.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmdpwFTFkwnkqWW3CozBBAfeYHchDeVAV7ArkA1dUqbUZ4&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==12==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_12_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmPWidAv5mBrgEcKDVqWe62JaAiwBWs8KZc1S8r3bbJsvY&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;6425d0dabb1cea1a076b8c46c0ae2da6_MIT6_0001F16_Lec12.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmToP68Knz71euVuntRWtz6UshRoiRssELJNFMeP1f2sR5&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;310536cd5f5aa1fc0c11726ce13c565e_lec12_sorting.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmbV8ct8DEQyRGRDSX4PaQBXk8r8ryYLDNwTa2buC7kcP5&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate&amp;diff=448</id>
		<title>DEMONSTRATE-MIT Introduction to Computer Science and Programming in Python 6.0001 Fall 2016 Undergraduate</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=DEMONSTRATE-MIT_Introduction_to_Computer_Science_and_Programming_in_Python_6.0001_Fall_2016_Undergraduate&amp;diff=448"/>
		<updated>2023-12-03T18:31:26Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;{{:LICENCE_HEADER_CC_BY-NC-SA_4.0}}   &amp;lt;!-- This site is non commercial and is a concept development. &amp;lt;br&amp;gt; Note - this is quickly put together to test and demonstrate hosting heavy data content on IPFS. --&amp;gt; &amp;lt;b&amp;gt; NOTE: This page is for demonstration purposes Only, and is not meant to be hosted on CompleteNoobs.com which is not intended to contain CC_BY-NC-SA Licensed Content.   &amp;lt;br&amp;gt; This page is CC_BY-NC-SA It is intended for a fork of &amp;quot;CompleteNoobs.com&amp;quot; called &amp;quot;CompleteNo...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{:LICENCE_HEADER_CC_BY-NC-SA_4.0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- This site is non commercial and is a concept development.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Note - this is quickly put together to test and demonstrate hosting heavy data content on IPFS. --&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&lt;br /&gt;
NOTE: This page is for demonstration purposes Only, and is not meant to be hosted on CompleteNoobs.com which is not intended to contain CC_BY-NC-SA Licensed Content.  &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This page is CC_BY-NC-SA It is intended for a fork of &amp;quot;CompleteNoobs.com&amp;quot; called &amp;quot;CompleteNoobz.com&amp;quot;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
CompleteNoobz.com is a noncommercial mirror of CompleteNoobs.com Which can pullin CC_BY-NC-SA Licensed Content&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
This page is quickly put together to test and demonstrate hosting heavy data content on IPFS.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
It is a first draft and required many more Reiterations, This content is first draft concept demonstration content.&lt;br /&gt;
&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Course Information==&lt;br /&gt;
===Source===&lt;br /&gt;
https://ocw.mit.edu/MIT OPEN COURSEWARE - MASSACHUSETTS INSTITUTE OF TECHNOLOGY.&amp;lt;br&amp;gt;&lt;br /&gt;
Donations to support MIT Open Courseware &amp;lt;code&amp;gt;https://giving.mit.edu/give/to/ocw/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/download/&amp;lt;br&amp;gt;&lt;br /&gt;
https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/pages/assignments/&amp;lt;br&amp;gt;&lt;br /&gt;
https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/lecture-videos/&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syllabus==&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Syllabus&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Course Meeting Times===&lt;br /&gt;
&lt;br /&gt;
Lectures: 2 sessions / week, 1 hour / session&lt;br /&gt;
&lt;br /&gt;
Recitations: 1 sessions / week, 1 hour / session&lt;br /&gt;
&lt;br /&gt;
===Course Information===&lt;br /&gt;
&lt;br /&gt;
6.0001 Introduction to Computer Science and Programming in Python is intended for students with little or no programming experience. It aims to provide students with an understanding of the role computation can play in solving problems and to help students, regardless of their major, feel justifiably confident of their ability to write small programs that allow them to accomplish useful goals. The class will use the Python 3.5 programming language.&lt;br /&gt;
&lt;br /&gt;
This is a half-semester course. Students who successfully complete 6.0001 may continue into 6.0002 Introduction to Computational Thinking and Data Science, which is taught in the second half of the semester.&lt;br /&gt;
&lt;br /&gt;
===Goals===&lt;br /&gt;
&lt;br /&gt;
*Provide an understanding of the role computation can play in solving problems.&lt;br /&gt;
*Help students, including those who do not plan to major in Computer Science and Electrical Engineering, feel confident of their ability to write small programs that allow them to accomplish useful goals.&lt;br /&gt;
*Position students so that they can compete for research projects and excel in subjects with programming components.&lt;br /&gt;
&lt;br /&gt;
===Textbook===&lt;br /&gt;
&lt;br /&gt;
The textbook is Buy at MIT Press Guttag, John. Introduction to Computation and Programming Using Python: With Application to Understanding Data Second Edition. MIT Press, 2016. ISBN: 9780262529624. The book and the course lectures parallel each other, though there is more detail in the book about some topics. It is available both in hard copy and as an e-book.&lt;br /&gt;
&lt;br /&gt;
===Lecture and Recitation Attendance===&lt;br /&gt;
&lt;br /&gt;
A significant portion of the material for this course will presented only in lecture, so students are expected to regularly attend lectures.&lt;br /&gt;
&lt;br /&gt;
Recitations give students a chance to ask questions about the lecture material or the problem set for the given week. Sometimes, new material may be covered in recitation. Recitation attendance is encouraged but not required.&lt;br /&gt;
&lt;br /&gt;
===Problem Sets and Quizzes===&lt;br /&gt;
&lt;br /&gt;
Each problem set will involve programming in Python. There will be 6 problem sets in the course. There will be two quizzes. All quizzes will be closed-book, though you will be allowed to bring one page of notes to the first quiz and two pages of notes to the second quiz. Pages must be letter-sized, double-sided, either handwritten or typed.&lt;br /&gt;
&lt;br /&gt;
===Grading Policy===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Grades will be roughly computed as follows:&lt;br /&gt;
|-&lt;br /&gt;
|ACTIVITIES&lt;br /&gt;
|PERCENTAGES&lt;br /&gt;
|-&lt;br /&gt;
|Problem sets&lt;br /&gt;
|30%&lt;br /&gt;
|-&lt;br /&gt;
|Completion of mandatory finger exercises&lt;br /&gt;
|10%&lt;br /&gt;
|-&lt;br /&gt;
|Midterm Quiz&lt;br /&gt;
|20%&lt;br /&gt;
|-&lt;br /&gt;
|Final Quiz&lt;br /&gt;
|40%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Problem sets will be graded out of 10 points. Submissions that do not run will receive at most 20% of the points. Please contact your Teaching Assistant if you have a problem understanding your problem set grade.&lt;br /&gt;
&lt;br /&gt;
Note: Quizzes and finger exercises are not available on OpenCourseWare.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Extension and Dropping Problem Sets Policy===&lt;br /&gt;
We do not grant any extensions. Instead, we offer late days and the option of rolling at most 2 problem set grades into the final quiz score.&lt;br /&gt;
&lt;br /&gt;
===Late Days===&lt;br /&gt;
&lt;br /&gt;
At the beginning of the term, students are given two late days that they can use on problem sets. Starting with Problem Set 1, additional late days can be accumulated for each assignment, one late day for each day the assignment is turned in ahead of the deadline. Up to three late days may be accumulated in this fashion in this course, i.e you can only have a maximum of 3 late days at any point in time. Late days are discrete (a student cannot use half a late day). The staff will keep track of late days and feedback for each problem set will include the number of late days the student has remaining. Any additional late work beyond these late days will not be accepted. To avoid surprises, we suggest that after you submit your problem set, you double check to make sure the submission was uploaded correctly.&lt;br /&gt;
&lt;br /&gt;
===Rolling Over Problem Sets===&lt;br /&gt;
&lt;br /&gt;
Before the final quiz, we will send out an announcement in which you can choose at most 2 problem sets that you can drop. If dropped, the percent that the problem sets are worth will be rolled into the final quiz score. We strongly urge you to see the late days and dropping the problem sets as backup in case of an emergency. Your best strategy is to do the problem sets early before work starts to pile up.&lt;br /&gt;
&lt;br /&gt;
===Calendar===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Calendar&lt;br /&gt;
|-&lt;br /&gt;
|SES #&lt;br /&gt;
|TOPICS&lt;br /&gt;
|ASSIGNMENTS&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|What is computation?&lt;br /&gt;
|Pset 0 released&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Branching and Iteration&lt;br /&gt;
|Pset 1 released&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|String Manipulation, Guess and Check, Approximations, Bisection&lt;br /&gt;
|Pset 0 due&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Decomposition, Abstractions, Functions&lt;br /&gt;
|Pset 2 released&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Tuples, Lists, Aliasing, Mutability, Cloning&lt;br /&gt;
|Pset 1 due&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Recursion, Dictionaries&lt;br /&gt;
|Pset 3 released&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Testing, Debugging, Exceptions, Assertions&lt;br /&gt;
|Pset 2 due; Quiz 1&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|Object Oriented Programming&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|9&lt;br /&gt;
|Python Classes and Inheritance&lt;br /&gt;
|Pset 3 due; Pset 4 released&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|Understanding Program Efficiency, Part 1&lt;br /&gt;
|Pset 4 due; Pset 5 released&lt;br /&gt;
|-&lt;br /&gt;
|11&lt;br /&gt;
|Understanding Program Efficiency, Part 2&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|12&lt;br /&gt;
|Searching and Sorting&lt;br /&gt;
|Pset 5 due; Final Quiz&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Course Materials==&lt;br /&gt;
&lt;br /&gt;
===Downloading Using IPFS===&lt;br /&gt;
&amp;lt;code&amp;gt;https://github.com/ipfs/ipfs-desktop/releases&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[[IPFS_Basics|PFS Basics]]&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
This class is using python3 IDE &amp;lt;b&amp;gt;spyder&amp;lt;/b&amp;gt; which is in Anaconda3&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.anaconda.com/&amp;lt;br&amp;gt;&lt;br /&gt;
How to install is on Problem Set 0&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MIT6_0001F16_Style Guide===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_styleguide/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmUmtyNpSLr2fXwGY1gL2hNnpwbYe8Y7CP2rPwjSNXasxJ&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Problem Set 0==&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/ps0/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmRWpBvwUNiFRjSvgLjRoiCNXQBBL2aLg55PVfGWw7S1ns&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Lecture 1: What is Computation?==&lt;br /&gt;
&lt;br /&gt;
{{#evu:https://www.youtube.com/watch?v=4-CmQesbQvw&lt;br /&gt;
|alignment=inline&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/lecture-1-what-is-computation/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmaTdTMxWdz6ySLbx258zQU5McpJTo4ZEVJ63GSKmVEyeM&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Glossary===&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Glossary for lecture with timestamps:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Time: data&amp;lt;br&amp;gt;&lt;br /&gt;
2:10 pset = problem set&amp;lt;br&amp;gt;&lt;br /&gt;
12:18 [[Square_root]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Video transcript===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Video transcript&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
The following content is provided under a Creative&lt;br /&gt;
0:03Commons license.&lt;br /&gt;
0:04Your support will help MIT OpenCourseWare&lt;br /&gt;
0:07continue to offer high-quality, educational resources for free.&lt;br /&gt;
0:11To make a donation, or view additional materials&lt;br /&gt;
0:13from hundreds of MIT courses, visit MIT OpenCourseWare&lt;br /&gt;
0:17at ocw.mit.edu.&lt;br /&gt;
0:29ANA BELL: All right.&lt;br /&gt;
0:30Let&#039;s begin.&lt;br /&gt;
0:33As I mentioned before, this lecture&lt;br /&gt;
0:35will be recorded for OCW.&lt;br /&gt;
0:37Again, in future lectures, if you&lt;br /&gt;
0:39don&#039;t want to have the back of your head show up,&lt;br /&gt;
0:41just don&#039;t sit in this front area here.&lt;br /&gt;
0:44First of all, wow, what a crowd, you guys.&lt;br /&gt;
0:46We&#039;re finally in 26-100.&lt;br /&gt;
0:486.0001 made it big, huh?&lt;br /&gt;
0:52Good afternoon and welcome to the very first class of 6.0001,&lt;br /&gt;
0:55and also 600, this semester.&lt;br /&gt;
0:58My name is Ana Bell.&lt;br /&gt;
1:00First name, Ana.&lt;br /&gt;
1:01Last name, Bell.&lt;br /&gt;
1:03I&#039;m a lecturer in the EECS Department.&lt;br /&gt;
1:06And I&#039;ll be giving some of the lectures for today,&lt;br /&gt;
1:08along with later on in the term, Professor Eric Grimson, who&#039;s&lt;br /&gt;
1:13sitting right down there, will be giving some of the lectures,&lt;br /&gt;
1:15as well.&lt;br /&gt;
1:17Today we&#039;re going to go over some basic administrivia,&lt;br /&gt;
1:21a little bit of course information.&lt;br /&gt;
1:23And then, we&#039;re going to talk a little bit&lt;br /&gt;
1:24about what is computation?&lt;br /&gt;
1:26We&#039;ll discuss at a very high level&lt;br /&gt;
1:27what computers do just to make sure we&#039;re all&lt;br /&gt;
1:29on the same page.&lt;br /&gt;
1:31And then, we&#039;re going to dive right into Python basics.&lt;br /&gt;
1:34We&#039;re going to talk a little bit about mathematical operations&lt;br /&gt;
1:36you can do with Python.&lt;br /&gt;
1:38And then, we&#039;re going to talk about Python variables&lt;br /&gt;
1:40and types.&lt;br /&gt;
1:42As I mentioned in my introductory email, all&lt;br /&gt;
1:43the slides and code that I&#039;ll talk about during lectures&lt;br /&gt;
1:46will be up before lecture, so I highly&lt;br /&gt;
1:48encourage you to download them and to have them open.&lt;br /&gt;
1:52We&#039;re going to go through some in-class exercises which will&lt;br /&gt;
1:56be available on those slides.&lt;br /&gt;
1:57And it&#039;s fun to do.&lt;br /&gt;
1:59And it&#039;s also great if could take notes about the code just&lt;br /&gt;
2:07for future reference.&lt;br /&gt;
2:09It&#039;s true.&lt;br /&gt;
2:10This is a really fast-paced course,&lt;br /&gt;
2:12and we ramp up really quickly.&lt;br /&gt;
2:14We do want to position you to succeed in this course.&lt;br /&gt;
2:17As I was writing this, I was trying&lt;br /&gt;
2:19to think about when I was first starting&lt;br /&gt;
2:21to program what helped me get through my very&lt;br /&gt;
2:24first programming course.&lt;br /&gt;
2:26And this is really a good list.&lt;br /&gt;
2:29The first thing was I just read the psets as soon&lt;br /&gt;
2:31as they came out, made sure that the terminology just sunk in.&lt;br /&gt;
2:37And then, during lectures, if the lecturer&lt;br /&gt;
2:39was talking about something that suddenly I remembered,&lt;br /&gt;
2:42oh, I saw that word in the pset and I didn&#039;t know what it was.&lt;br /&gt;
2:45Well, hey, now I know what it is.&lt;br /&gt;
2:46Right?&lt;br /&gt;
2:47So just give it a read.&lt;br /&gt;
2:48You don&#039;t need to start it.&lt;br /&gt;
2:51If you&#039;re new to programming, I think the key word is practice.&lt;br /&gt;
2:55It&#039;s like math or reading.&lt;br /&gt;
2:57The more you practice, the better you get at it.&lt;br /&gt;
3:00You&#039;re not going to absorb programming&lt;br /&gt;
3:01by watching me write programs because I already know how&lt;br /&gt;
3:04to program.&lt;br /&gt;
3:05You guys need to practice.&lt;br /&gt;
3:07Download the code before lecture.&lt;br /&gt;
3:09Follow along.&lt;br /&gt;
3:10Whatever I type, you guys can type.&lt;br /&gt;
3:12And I think, also, one of the big things&lt;br /&gt;
3:14is if you&#039;re new to programming, you&#039;re&lt;br /&gt;
3:16kind of afraid that you&#039;re going to break your computer.&lt;br /&gt;
3:19And you can&#039;t really do that just by running Anaconda&lt;br /&gt;
3:24and typing in some commands.&lt;br /&gt;
3:26So don&#039;t be afraid to just type some stuff in&lt;br /&gt;
3:28and see what it does.&lt;br /&gt;
3:29Worst case, you just restart the computer.&lt;br /&gt;
3:35Yeah.&lt;br /&gt;
3:36That&#039;s probably the big thing right there.&lt;br /&gt;
3:38I should have probably highlighted it,&lt;br /&gt;
3:39but don&#039;t be afraid.&lt;br /&gt;
3:40Great.&lt;br /&gt;
3:41So this is pretty much a roadmap of all of 6.0001 or 600&lt;br /&gt;
3:46as I&#039;ve just explained it.&lt;br /&gt;
3:47There&#039;s three big things we want to get out of this course.&lt;br /&gt;
3:51The first thing is the knowledge of concepts,&lt;br /&gt;
3:54which is pretty much true of any class that you&#039;ll take.&lt;br /&gt;
3:56The class will teach you something through lectures.&lt;br /&gt;
3:59Exams will test how much you know.&lt;br /&gt;
4:02This is a class in programming.&lt;br /&gt;
4:05The other thing we want you to get out of it&lt;br /&gt;
4:08is programming skills.&lt;br /&gt;
4:10And the last thing, and I think this&lt;br /&gt;
4:12is what makes this class really great,&lt;br /&gt;
4:13is we teach you how to solve problems.&lt;br /&gt;
4:16And we do that through the psets.&lt;br /&gt;
4:18That&#039;s really how I feel the roadmap of this course&lt;br /&gt;
4:21looks like.&lt;br /&gt;
4:22And underlying all of these is just practice.&lt;br /&gt;
4:25You have to just type some stuff away and code a lot.&lt;br /&gt;
4:29And you&#039;ll succeed in this course, I think.&lt;br /&gt;
4:33OK.&lt;br /&gt;
4:35So what are the things we&#039;re going to learn in this class?&lt;br /&gt;
4:38I feel like the things we&#039;re going learn in this class&lt;br /&gt;
4:41can be divided into basically three different sections.&lt;br /&gt;
4:44The first one is related to these first two items here.&lt;br /&gt;
4:50It&#039;s really about learning how to program.&lt;br /&gt;
4:53Learning how to program, part of it&lt;br /&gt;
4:55is figuring out what objects to create.&lt;br /&gt;
4:58You&#039;ll learn about these later.&lt;br /&gt;
5:00How do you represent knowledge with data structures?&lt;br /&gt;
5:02That&#039;s sort of the broad term for that.&lt;br /&gt;
5:04And then, as you&#039;re writing programs,&lt;br /&gt;
5:06you need to-- programs aren&#039;t just linear.&lt;br /&gt;
5:08Sometimes programs jump around.&lt;br /&gt;
5:10They make decisions.&lt;br /&gt;
5:11There&#039;s some control flow to programs.&lt;br /&gt;
5:13That&#039;s what the second line is going to be about.&lt;br /&gt;
5:18The second big part of this course&lt;br /&gt;
5:20is a little bit more abstract, and it&lt;br /&gt;
5:24deals with how do you write good code, good style,&lt;br /&gt;
5:29code that&#039;s readable.&lt;br /&gt;
5:30When you write code, you want to write it such&lt;br /&gt;
5:33that-- you&#039;re in big company, other people will read it,&lt;br /&gt;
5:35other people will use it, so it has&lt;br /&gt;
5:37to be readable and understandable by others.&lt;br /&gt;
5:40To that end, you need to write code&lt;br /&gt;
5:41that&#039;s well organized, modular, easy to understand.&lt;br /&gt;
5:48And not only that, not only will your code&lt;br /&gt;
5:50be read by other people, but next year, maybe,&lt;br /&gt;
5:53you&#039;ll take another course, and you&#039;ll&lt;br /&gt;
5:55want to look back at some of the problems&lt;br /&gt;
5:56that you wrote in this class.&lt;br /&gt;
5:58You want to be able to reread your code.&lt;br /&gt;
6:00If it&#039;s a big mess, you might not be able to understand--&lt;br /&gt;
6:03or reunderstand-- what you were doing.&lt;br /&gt;
6:06So writing readable code and organizing code&lt;br /&gt;
6:08is also a big part.&lt;br /&gt;
6:10And the last section is going to deal with-- the first two&lt;br /&gt;
6:15are actually part of the programming in Introduction&lt;br /&gt;
6:19to Programming and Computer Science in Python.&lt;br /&gt;
6:21And the last one deals mostly with the computer science part&lt;br /&gt;
6:26in Introduction to Programming and Computer Science in Python.&lt;br /&gt;
6:29We&#039;re going to talk about, once you have learned&lt;br /&gt;
6:31how to write programs in Python, how do&lt;br /&gt;
6:33you compare programs in Python?&lt;br /&gt;
6:35How do you know that one program is better than the other?&lt;br /&gt;
6:38How do you know that one program is&lt;br /&gt;
6:39more efficient than the other?&lt;br /&gt;
6:41How do you know that one algorithm&lt;br /&gt;
6:42is better than the other?&lt;br /&gt;
6:45That&#039;s what we&#039;re going to talk about in the last part&lt;br /&gt;
6:47of the course.&lt;br /&gt;
6:48OK.&lt;br /&gt;
6:50That&#039;s all for the administrative part&lt;br /&gt;
6:52of the course.&lt;br /&gt;
6:54Let&#039;s start by talking at a high level what does a computer do.&lt;br /&gt;
6:59Fundamentally, it does two things.&lt;br /&gt;
7:03One, performs calculations.&lt;br /&gt;
7:05It performs a lot of calculations.&lt;br /&gt;
7:07Computers these days are really, really fast,&lt;br /&gt;
7:09a billion calculations per second is probably not far off.&lt;br /&gt;
7:15It performs these calculations and it&lt;br /&gt;
7:16has to store them somewhere.&lt;br /&gt;
7:18Right?&lt;br /&gt;
7:19Stores them in computer memory.&lt;br /&gt;
7:21So a computer also has to remember results.&lt;br /&gt;
7:24And these days, it&#039;s not uncommon to find computers&lt;br /&gt;
7:26with hundreds of gigabytes of storage.&lt;br /&gt;
7:30The kinds of calculations that computers do,&lt;br /&gt;
7:34there are two kinds.&lt;br /&gt;
7:35One are calculations that are built into the language.&lt;br /&gt;
7:37These are the very low level types&lt;br /&gt;
7:39of calculations, things like addition,&lt;br /&gt;
7:41subtraction, multiplication, and so on.&lt;br /&gt;
7:45And once you have a language that&lt;br /&gt;
7:47has these primitive calculation types, you, as a programmer,&lt;br /&gt;
7:53can put these types together and then define&lt;br /&gt;
7:55your own calculations.&lt;br /&gt;
7:57You can create new types of calculations.&lt;br /&gt;
8:00And the computer will be able to perform those, as well.&lt;br /&gt;
8:04I think, one thing I want to stress--&lt;br /&gt;
8:07and we&#039;re going to come back to this&lt;br /&gt;
8:09again during this entire lecture, actually--&lt;br /&gt;
8:12is computers only know what you tell them.&lt;br /&gt;
8:15Computers only do what you tell them to do.&lt;br /&gt;
8:18They&#039;re not magical.&lt;br /&gt;
8:19They don&#039;t have a mind.&lt;br /&gt;
8:22They just know how to perform calculations really,&lt;br /&gt;
8:24really quickly.&lt;br /&gt;
8:26But you have to tell them what calculations to do.&lt;br /&gt;
8:32Computers don&#039;t know anything.&lt;br /&gt;
8:34All right.&lt;br /&gt;
8:35We&#039;ve come to that.&lt;br /&gt;
8:40Let&#039;s go into the types of knowledge.&lt;br /&gt;
8:44The first type of knowledge is declarative knowledge.&lt;br /&gt;
8:48And those are things like statements of fact.&lt;br /&gt;
8:50And this is where my email came into play.&lt;br /&gt;
8:53If you read it all the way to the bottom,&lt;br /&gt;
8:55you would have entered a raffle.&lt;br /&gt;
8:57So a statement of fact for today&#039;s lecture&lt;br /&gt;
8:59is, someone will win a prize before class ends.&lt;br /&gt;
9:03And the prize was a Google Cardboard.&lt;br /&gt;
9:06Google state-of-the-art virtual reality glasses.&lt;br /&gt;
9:09And I have them right here.&lt;br /&gt;
9:14Yea.&lt;br /&gt;
9:15I delivered on my promise.&lt;br /&gt;
9:18That&#039;s a statement of fact.&lt;br /&gt;
9:20So pretend I&#039;m a machine.&lt;br /&gt;
9:22OK?&lt;br /&gt;
9:23I don&#039;t know anything except what you tell me.&lt;br /&gt;
9:26I don&#039;t know.&lt;br /&gt;
9:28I know that you tell me this statement.&lt;br /&gt;
9:30I&#039;m like, OK.&lt;br /&gt;
9:31But how is someone going to win a Google Cardboard&lt;br /&gt;
9:33before class ends, right?&lt;br /&gt;
9:35That&#039;s where imperative knowledge comes in.&lt;br /&gt;
9:37Imperative knowledge is the recipe, or the how-to,&lt;br /&gt;
9:39or the sequence of steps.&lt;br /&gt;
9:42Sorry.&lt;br /&gt;
9:43That&#039;s just my funny for that one.&lt;br /&gt;
9:47So the sequence of steps is imperative knowledge.&lt;br /&gt;
9:53If I&#039;m a machine, you need to tell me&lt;br /&gt;
9:57how someone will win a Google Cardboard before class.&lt;br /&gt;
10:00If I follow these steps, then technically,&lt;br /&gt;
10:02I should reach a conclusion.&lt;br /&gt;
10:06Step one, I think we&#039;ve already done that.&lt;br /&gt;
10:08Whoever wanted to sign up has signed up.&lt;br /&gt;
10:11Now I&#039;m going to open my IDE.&lt;br /&gt;
10:13I&#039;m just basically being a machine&lt;br /&gt;
10:14and following the steps that you&#039;ve told me.&lt;br /&gt;
10:17The IDE that we&#039;re using in this class is called Anaconda.&lt;br /&gt;
10:21I&#039;m just scrolling down to the bottom.&lt;br /&gt;
10:25Hopefully, you&#039;ve installed it in problem set zero.&lt;br /&gt;
10:28I&#039;ve opened my IDE.&lt;br /&gt;
10:30I&#039;m going to follow the next set of instructions.&lt;br /&gt;
10:34I&#039;m going to choose a random number between the first&lt;br /&gt;
10:36and the nth responder.&lt;br /&gt;
10:39Now, I&#039;m going to actually use Python to do this .&lt;br /&gt;
10:42And this is also an example of how just&lt;br /&gt;
10:44a really simple task in your life,&lt;br /&gt;
10:46you can use computers or programming to do that.&lt;br /&gt;
10:48Because if I chose a random number,&lt;br /&gt;
10:50I might be biased because, for example,&lt;br /&gt;
10:51I might like the number 8.&lt;br /&gt;
10:53To choose a random number, I&#039;m going to go and say, OK,&lt;br /&gt;
10:57where&#039;s the list of responders?&lt;br /&gt;
10:58It starts at 15.&lt;br /&gt;
10:59Actually, it starts at 16 because that&#039;s me.&lt;br /&gt;
11:03We&#039;re going to choose a random number between 16&lt;br /&gt;
11:05and the end person 266.&lt;br /&gt;
11:09Oh, we just got-- oh.&lt;br /&gt;
11:11OK.&lt;br /&gt;
11:13OK.&lt;br /&gt;
11:13I&#039;m going to cut it off right here.&lt;br /&gt;
11:15271.&lt;br /&gt;
11:15OK.&lt;br /&gt;
11:1616 and 271.&lt;br /&gt;
11:18Perfect.&lt;br /&gt;
11:19OK.&lt;br /&gt;
11:20I&#039;m going to choose a random number.&lt;br /&gt;
11:21I&#039;m going to go to my IDE.&lt;br /&gt;
11:22And you don&#039;t need to know how to do this yet,&lt;br /&gt;
11:24but by the end of this class, you will.&lt;br /&gt;
11:26I&#039;m just going to use Python.&lt;br /&gt;
11:29I&#039;m just going to get the random number package that&#039;s going&lt;br /&gt;
11:31to give me a random number.&lt;br /&gt;
11:32I&#039;m going to say random.randint.&lt;br /&gt;
11:35And I&#039;m going to choose a random number between 16 and 272,&lt;br /&gt;
11:40OK.&lt;br /&gt;
11:4175.&lt;br /&gt;
11:42OK.&lt;br /&gt;
11:43Great.&lt;br /&gt;
11:44I chose a random number.&lt;br /&gt;
11:45And I&#039;m going to find the number in the responder&#039;s sheet.&lt;br /&gt;
11:48What was the number again?&lt;br /&gt;
11:49Sorry.&lt;br /&gt;
11:5175.&lt;br /&gt;
11:52OK.&lt;br /&gt;
11:54Up we go.&lt;br /&gt;
11:56There we go.&lt;br /&gt;
11:57Lauren Z-O-V. Yeah.&lt;br /&gt;
12:01Nice.&lt;br /&gt;
12:02You&#039;re here.&lt;br /&gt;
12:14Awesome.&lt;br /&gt;
12:16All right.&lt;br /&gt;
12:17That&#039;s an example of me being a machine and also,&lt;br /&gt;
12:21at the same time, using Python in my everyday life,&lt;br /&gt;
12:23just lecturing, to find a random number.&lt;br /&gt;
12:28Try to use Python wherever you can.&lt;br /&gt;
12:30And that just gives you practice.&lt;br /&gt;
12:34That was fun.&lt;br /&gt;
12:35But we&#039;re at MIT.&lt;br /&gt;
12:37We&#039;re MIT students.&lt;br /&gt;
12:39And we love numbers here at MIT.&lt;br /&gt;
12:41Here&#039;s a numerical example that shows&lt;br /&gt;
12:44the difference between declarative and imperative&lt;br /&gt;
12:46knowledge.&lt;br /&gt;
12:50An example of declarative knowledge&lt;br /&gt;
12:51is the square root of a number x is y such that y times y&lt;br /&gt;
12:54is equal to x.&lt;br /&gt;
12:57That&#039;s just a statement of fact It&#039;s true.&lt;br /&gt;
13:02Computers don&#039;t know what to do with that.&lt;br /&gt;
13:05They don&#039;t know what to do with that statement.&lt;br /&gt;
13:07But computers do know how to follow a recipe.&lt;br /&gt;
13:11Here&#039;s a well-known algorithm.&lt;br /&gt;
13:13To find the square root of a number x,&lt;br /&gt;
13:16let&#039;s say x is originally 16, if a computer follows&lt;br /&gt;
13:23this algorithm, it&#039;s going to start with a guess, g,&lt;br /&gt;
13:26let&#039;s say, 3.&lt;br /&gt;
13:28We&#039;re trying to find the square root of 16.&lt;br /&gt;
13:30We&#039;re going to calculate g times g is 9.&lt;br /&gt;
13:34And we&#039;re going to ask is if g times g&lt;br /&gt;
13:36is close enough to x, then stop and say, g is the answer.&lt;br /&gt;
13:39I&#039;m not really happy with 9 being really close to 16.&lt;br /&gt;
13:42So I&#039;m going to say, I&#039;m not stopping here.&lt;br /&gt;
13:44I&#039;m going to keep going.&lt;br /&gt;
13:47If it&#039;s not close enough, then I&#039;m&lt;br /&gt;
13:48going to make a new guess by averaging g and x over g.&lt;br /&gt;
13:52That&#039;s x over g here.&lt;br /&gt;
13:54And that&#039;s the average over there.&lt;br /&gt;
13:57And the new average is going to be my new guess.&lt;br /&gt;
14:04And that&#039;s what it says.&lt;br /&gt;
14:05And then, the last step is using the new guess,&lt;br /&gt;
14:07repeat the process.&lt;br /&gt;
14:08Then we go back to the beginning and repeat the whole process&lt;br /&gt;
14:11over and over again.&lt;br /&gt;
14:13And that&#039;s what the rest of the rows do.&lt;br /&gt;
14:15And you keep doing this until you decide&lt;br /&gt;
14:16that you&#039;re close enough.&lt;br /&gt;
14:23What we saw for the imperative knowledge&lt;br /&gt;
14:25in the previous numerical example&lt;br /&gt;
14:26was the recipe for how to find the square root of x.&lt;br /&gt;
14:31What were the three parts of the recipe?&lt;br /&gt;
14:33One was a simple sequence of steps.&lt;br /&gt;
14:36There were four steps.&lt;br /&gt;
14:39The other was a flow of control, so there were&lt;br /&gt;
14:42parts where we made decisions.&lt;br /&gt;
14:45Are we close enough?&lt;br /&gt;
14:46There were parts where we repeated some steps.&lt;br /&gt;
14:49At the end, we said, repeat steps 1, 2, 3.&lt;br /&gt;
14:52That&#039;s the flow of control.&lt;br /&gt;
14:55And the last part of the recipe was a way to stop.&lt;br /&gt;
14:58You don&#039;t want a program that keeps going and going.&lt;br /&gt;
15:00Or for a recipe, you don&#039;t want to keep baking bread forever.&lt;br /&gt;
15:03You want to stop at some point.&lt;br /&gt;
15:05Like 10 breads is enough, right?&lt;br /&gt;
15:07So you have to have a way of stopping.&lt;br /&gt;
15:10In the previous example, the way of stopping&lt;br /&gt;
15:12was that we decided we were close enough.&lt;br /&gt;
15:15Close enough was maybe being within .01, .001,&lt;br /&gt;
15:20whatever you pick.&lt;br /&gt;
15:23This recipe is there for an algorithm.&lt;br /&gt;
15:26In computer science speak, it&#039;s going to be an algorithm.&lt;br /&gt;
15:29And that&#039;s what we&#039;re going to learn about in this class.&lt;br /&gt;
15:34We&#039;re dealing with computers.&lt;br /&gt;
15:35And we actually want to capture a recipe&lt;br /&gt;
15:37inside a computer, a computer being a mechanical process.&lt;br /&gt;
15:49Historically, there were two different types of computers.&lt;br /&gt;
15:55Originally, there were these things&lt;br /&gt;
15:57called fixed-program computers.&lt;br /&gt;
15:59And I&#039;m old enough to have used something&lt;br /&gt;
16:02like this, where there&#039;s just numbers and plus, minus,&lt;br /&gt;
16:06multiplication, divide, and equal.&lt;br /&gt;
16:08But calculators these days are a lot more complicated.&lt;br /&gt;
16:11But way back then, an example of a fixed-program computer&lt;br /&gt;
16:15is this calculator.&lt;br /&gt;
16:16It only knows how to do addition, multiplication,&lt;br /&gt;
16:19subtraction, division.&lt;br /&gt;
16:20If you want to plot something, you can&#039;t.&lt;br /&gt;
16:22If you want to go on the internet, send email with it,&lt;br /&gt;
16:27you can&#039;t.&lt;br /&gt;
16:27It can only do this one thing.&lt;br /&gt;
16:31And if you wanted to create a machine that did another thing,&lt;br /&gt;
16:33then you&#039;d have to create another fixed-program computer&lt;br /&gt;
16:37that did a completely separate test.&lt;br /&gt;
16:39That&#039;s not very great.&lt;br /&gt;
16:41That&#039;s when stored-program computers came into play.&lt;br /&gt;
16:45And these were machines that could store&lt;br /&gt;
16:47a sequence of instructions.&lt;br /&gt;
16:50And these machines could execute the sequence of instructions.&lt;br /&gt;
16:54And you could change the sequence of instructions&lt;br /&gt;
16:56and execute this different sequence of instructions.&lt;br /&gt;
17:00You could do different tasks in the same machine.&lt;br /&gt;
17:03And that&#039;s the computer as we know it these days.&lt;br /&gt;
17:07The central processing unit is where all of these decisions&lt;br /&gt;
17:11get made.&lt;br /&gt;
17:11And these are all the peripherals.&lt;br /&gt;
17:16The basic machine architecture-- at the heart of every computer&lt;br /&gt;
17:20there&#039;s just this basic architecture--&lt;br /&gt;
17:25and it contains, I guess, four main parts.&lt;br /&gt;
17:28The first is the memory.&lt;br /&gt;
17:31Input and output is the other one.&lt;br /&gt;
17:34The ALU is where all of the operations are done.&lt;br /&gt;
17:39And the operations that the ALU can do&lt;br /&gt;
17:41are really primitive operations, addition, subtraction,&lt;br /&gt;
17:44and so on.&lt;br /&gt;
17:46What the memory contains is a bunch of data&lt;br /&gt;
17:52and your sequence of instructions.&lt;br /&gt;
18:00Interacting with the Arithmetic Logic Unit is the Control Unit.&lt;br /&gt;
18:03And the Control Unit contains one program counter.&lt;br /&gt;
18:07When you load a sequence of instructions,&lt;br /&gt;
18:09the program counter starts at the first sequence.&lt;br /&gt;
18:15It starts at the sequence, at the first instruction.&lt;br /&gt;
18:18It gets what the instruction is, and it sends it to the ALU.&lt;br /&gt;
18:22The ALU asks, what are we doing operations on here?&lt;br /&gt;
18:25What&#039;s happening?&lt;br /&gt;
18:27It might get some data.&lt;br /&gt;
18:29If you&#039;re adding two numbers, it might get two numbers&lt;br /&gt;
18:31from memory.&lt;br /&gt;
18:33It might do some operations.&lt;br /&gt;
18:34And it might store data back into memory.&lt;br /&gt;
18:37And after it&#039;s done, the ALU is going to go back,&lt;br /&gt;
18:41and the program counter is going to increase&lt;br /&gt;
18:43by 1, which means that we&#039;re going&lt;br /&gt;
18:45to go to the next sequence in the instruction set.&lt;br /&gt;
18:50And it just goes linearly, instruction by instruction.&lt;br /&gt;
18:53There might be one particular instruction&lt;br /&gt;
18:56that does some sort of test.&lt;br /&gt;
18:58It&#039;s going to say, is this particular value&lt;br /&gt;
19:07greater or equal to or the same as this other particular value?&lt;br /&gt;
19:11That&#039;s a test, an example of a test.&lt;br /&gt;
19:13And the test is going to either return true or false.&lt;br /&gt;
19:17And depending on the result of that test,&lt;br /&gt;
19:20you might either go to the next instruction,&lt;br /&gt;
19:24or you might set the program counter&lt;br /&gt;
19:26to go all the way back to the beginning, and so on.&lt;br /&gt;
19:29You&#039;re not just linearly stepping&lt;br /&gt;
19:32through all the instructions.&lt;br /&gt;
19:33There might be some control flow involved,&lt;br /&gt;
19:35where you might skip an instruction,&lt;br /&gt;
19:36or start from the beginning, or so on.&lt;br /&gt;
19:39And after you&#039;re done, when you finished&lt;br /&gt;
19:42executing the last instruction, then you&lt;br /&gt;
19:44might output something.&lt;br /&gt;
19:47That&#039;s really the basic way that a computer works.&lt;br /&gt;
19:53Just to recap, you have the stored program computer&lt;br /&gt;
19:55that contains these sequences of instructions.&lt;br /&gt;
19:59The primitive operations that it can do&lt;br /&gt;
20:00are addition, subtraction, logic operations, tests--&lt;br /&gt;
20:06which are something equal to something else, something&lt;br /&gt;
20:08less than, and so on-- and moving data,&lt;br /&gt;
20:10so storing data, moving data around, and things like that.&lt;br /&gt;
20:14And the interpreter goes through every instruction&lt;br /&gt;
20:19and decides whether you&#039;re going to go to the next instruction,&lt;br /&gt;
20:22skip instructions, or repeat instructions, and so on.&lt;br /&gt;
20:28So we&#039;ve talked about primitives.&lt;br /&gt;
20:30And in fact, Alan Turing, who was a really great computer&lt;br /&gt;
20:35scientist, he showed that you can compute anything&lt;br /&gt;
20:37using the six primitives.&lt;br /&gt;
20:38And the six primitives are move left, move right, read, write,&lt;br /&gt;
20:46scan, and do nothing.&lt;br /&gt;
20:49Using those six instructions and the piece of tape,&lt;br /&gt;
20:54he showed that you can compute anything.&lt;br /&gt;
20:57And using those six instructions,&lt;br /&gt;
21:00programming languages came about that&lt;br /&gt;
21:03created a more convenient set of primitives.&lt;br /&gt;
21:05You don&#039;t have to program in only these six commands.&lt;br /&gt;
21:11And one interesting thing, or one really important thing,&lt;br /&gt;
21:16that came about from these six primitives&lt;br /&gt;
21:19is that if you can compute something in Python,&lt;br /&gt;
21:22let&#039;s say-- if you write a program that computes something&lt;br /&gt;
21:25in Python, then, in theory, you can&lt;br /&gt;
21:28write a program that computes the exact same thing&lt;br /&gt;
21:31in any other language.&lt;br /&gt;
21:32And that&#039;s a really powerful statement.&lt;br /&gt;
21:36Think about that today when you review your slides.&lt;br /&gt;
21:39Think about that again.&lt;br /&gt;
21:40That&#039;s really powerful.&lt;br /&gt;
21:45Once you have your set of primitives&lt;br /&gt;
21:49for a particular language, you can start creating expressions.&lt;br /&gt;
21:53And these expressions are going to be&lt;br /&gt;
21:55combinations of the primitives in the programming language.&lt;br /&gt;
22:00And the expressions are going to have some value.&lt;br /&gt;
22:02And they&#039;re going up some meaning in the programming&lt;br /&gt;
22:05language.&lt;br /&gt;
22:08Let&#039;s do a little bit of a parallel with English&lt;br /&gt;
22:10just so you see what I mean.&lt;br /&gt;
22:14In English, the primitive constructs&lt;br /&gt;
22:15are going to be words.&lt;br /&gt;
22:17There&#039;s a lot of words in the English language.&lt;br /&gt;
22:19Programming languages-- in Python, there are primitives,&lt;br /&gt;
22:23but there aren&#039;t as many of them.&lt;br /&gt;
22:25There are floats, Booleans, these&lt;br /&gt;
22:28are numbers, strings, and simple operators,&lt;br /&gt;
22:31like addition, subtraction, and so on.&lt;br /&gt;
22:35So we have primitive constructs.&lt;br /&gt;
22:38Using these primitive constructs,&lt;br /&gt;
22:39we can start creating, in English, phrases, sentences,&lt;br /&gt;
22:48and the same in programming languages.&lt;br /&gt;
22:49In English, we can say something like, &amp;quot;cat, dog, boy.&lt;br /&gt;
22:54That, we say, is not syntactically valid.&lt;br /&gt;
22:58That&#039;s bad syntax.&lt;br /&gt;
23:00That&#039;s noun, noun, noun.&lt;br /&gt;
23:01That doesn&#039;t make sense.&lt;br /&gt;
23:05What does have good syntax in English is noun, verb, noun.&lt;br /&gt;
23:08So, &amp;quot;cat, hugs boy&amp;quot; is syntactically valid.&lt;br /&gt;
23:12Similarly, in a programming language,&lt;br /&gt;
23:14something like this-- in Python, in this case-- a word&lt;br /&gt;
23:18and then the number five doesn&#039;t really make sense.&lt;br /&gt;
23:20It&#039;s not syntactically valid.&lt;br /&gt;
23:22But something like operator, operand, operator is OK.&lt;br /&gt;
23:28So once you&#039;ve created these phrases, or these expressions,&lt;br /&gt;
23:34that are syntactically valid, you&lt;br /&gt;
23:37have to think about the static semantics of your phrase,&lt;br /&gt;
23:41or of your expression.&lt;br /&gt;
23:45For example, in English, &amp;quot;I are hungry&amp;quot; is good syntax.&lt;br /&gt;
23:51But it&#039;s weird to say.&lt;br /&gt;
23:55We have a pronoun, a verb, and an adjective, which&lt;br /&gt;
23:58doesn&#039;t really make sense.&lt;br /&gt;
23:59&amp;quot;I am hungry&amp;quot; is better.&lt;br /&gt;
24:03This does not have good static semantics.&lt;br /&gt;
24:07Similarly, in programming languages--&lt;br /&gt;
24:09and you&#039;ll get the hang of this the more&lt;br /&gt;
24:11you do it-- something like this, &amp;quot;3.2 times 5, is OK.&lt;br /&gt;
24:15But what does it mean?&lt;br /&gt;
24:17What&#039;s the meaning to have a word added to a number?&lt;br /&gt;
24:22There&#039;s no meaning behind that.&lt;br /&gt;
24:25Its syntax is OK, because you have&lt;br /&gt;
24:28operator, operand, operator.&lt;br /&gt;
24:30But it doesn&#039;t really make sense to add a number to a word,&lt;br /&gt;
24:32for example.&lt;br /&gt;
24:36Once you have created these expressions that&lt;br /&gt;
24:39are syntactically correct and static, semantically correct,&lt;br /&gt;
24:44in English, for example, you think about the semantics.&lt;br /&gt;
24:48What&#039;s the meaning of the phrase?&lt;br /&gt;
24:50In English, you can actually have more than one&lt;br /&gt;
24:52meaning to an entire phrase.&lt;br /&gt;
24:56In this case, &amp;quot;flying planes can be dangerous&amp;quot;&lt;br /&gt;
25:01can have two meanings.&lt;br /&gt;
25:02It&#039;s the act of flying a plane is dangerous,&lt;br /&gt;
25:04or the plane that is in the air is dangerous.&lt;br /&gt;
25:08And this might be a cuter example.&lt;br /&gt;
25:10&amp;quot;This reading lamp hasn&#039;t uttered a word&lt;br /&gt;
25:12since I bought it.&lt;br /&gt;
25:13What&#039;s going on?&amp;quot;&lt;br /&gt;
25:15So that has two meanings.&lt;br /&gt;
25:16It&#039;s playing on the word &amp;quot;reading lamp.&amp;quot;&lt;br /&gt;
25:21That&#039;s in English.&lt;br /&gt;
25:21In English, you can have a sentence&lt;br /&gt;
25:23that has more than one meaning, that&#039;s&lt;br /&gt;
25:25syntactically correct and static, semantically correct.&lt;br /&gt;
25:28But in programming languages, the program that you write,&lt;br /&gt;
25:31the set of instructions that you write, only has one meaning.&lt;br /&gt;
25:34Remember, we&#039;re coming back to the fact&lt;br /&gt;
25:35that the computer only does what you tell it to do.&lt;br /&gt;
25:40It&#039;s not going to suddenly decide&lt;br /&gt;
25:42to add another variable for some reason.&lt;br /&gt;
25:46It&#039;s just going to execute whatever statements you&#039;ve&lt;br /&gt;
25:49put up.&lt;br /&gt;
25:50In programming languages, there&#039;s only one meaning.&lt;br /&gt;
25:52But the problem that comes into play in programming languages&lt;br /&gt;
25:58is it&#039;s not the meaning that you might have&lt;br /&gt;
25:59intended, as the programmer.&lt;br /&gt;
26:03That&#039;s where things can go wrong.&lt;br /&gt;
26:05And there&#039;s going to be a lecture&lt;br /&gt;
26:07on debugging a little bit later in the course.&lt;br /&gt;
26:10But this is here just to tell you&lt;br /&gt;
26:12that if you see an error pop up in your program,&lt;br /&gt;
26:16it&#039;s just some text that says, error.&lt;br /&gt;
26:21For example, if we do something like this,&lt;br /&gt;
26:28this is syntactically correct.&lt;br /&gt;
26:30Incorrect.&lt;br /&gt;
26:31Syntactically incorrect.&lt;br /&gt;
26:32See?&lt;br /&gt;
26:32There&#039;s some angry text right here.&lt;br /&gt;
26:36What is going on?&lt;br /&gt;
26:37The more you program, the more you&#039;ll&lt;br /&gt;
26:39get the hang of reading these errors.&lt;br /&gt;
26:41But this is basically telling me the line&lt;br /&gt;
26:43that I wrote is syntactically incorrect.&lt;br /&gt;
26:45And it&#039;s pointing to the exact line and says, this is wrong,&lt;br /&gt;
26:49so I can go back and fix it as a programmer.&lt;br /&gt;
26:55Syntax errors are actually really easily caught by Python.&lt;br /&gt;
27:00That was an example of a syntax error.&lt;br /&gt;
27:02Static semantic errors can also be&lt;br /&gt;
27:04caught by Python as long as, if your program has some decisions&lt;br /&gt;
27:09to make, as long as you&#039;ve gone down the branch where&lt;br /&gt;
27:13the static semantic error happens.&lt;br /&gt;
27:18And this is probably going to be the most frustrating one,&lt;br /&gt;
27:22especially as you&#039;re starting out.&lt;br /&gt;
27:23The program might do something different than what&lt;br /&gt;
27:25you expected it to do.&lt;br /&gt;
27:27And that&#039;s not because the program suddenly-- for example,&lt;br /&gt;
27:32you expected the program to give you an output of 0&lt;br /&gt;
27:34for a certain test case, and the output that you got was 10.&lt;br /&gt;
27:37Well, the program didn&#039;t suddenly&lt;br /&gt;
27:39decide to change its answer to 10.&lt;br /&gt;
27:42It just executed the program that you wrote.&lt;br /&gt;
27:48That&#039;s the case where the program gave you&lt;br /&gt;
27:50a different answer than expected.&lt;br /&gt;
27:53Programs might crash, which means they stop running.&lt;br /&gt;
27:55That&#039;s OK.&lt;br /&gt;
27:57Just go back to your code and figure out what was wrong.&lt;br /&gt;
28:00And another example of a different meaning&lt;br /&gt;
28:03than what you intended was maybe the program won&#039;t stop.&lt;br /&gt;
28:06It&#039;s also OK.&lt;br /&gt;
28:07There are ways to stop it besides restarting&lt;br /&gt;
28:10the computer.&lt;br /&gt;
28:12So then Python programs are going&lt;br /&gt;
28:17to be sequences of definitions and commands.&lt;br /&gt;
28:20We&#039;re going to have expressions that are going to be evaluated&lt;br /&gt;
28:25and commands that tell the interpreter to do something.&lt;br /&gt;
28:33If you&#039;ve done problem set 0, you&#039;ll&lt;br /&gt;
28:35see that you can type commands directly&lt;br /&gt;
28:37in the shell here, which is the part on the right where&lt;br /&gt;
28:40I did some really simple things, 2 plus 4.&lt;br /&gt;
28:44Or you can type commands up in here, on the left-hand side,&lt;br /&gt;
28:49and then run your program.&lt;br /&gt;
28:52Notice that, well, we&#039;ll talk about this-- I&lt;br /&gt;
28:54won&#039;t talk about this now.&lt;br /&gt;
28:55But these are-- on the right-hand side, typically,&lt;br /&gt;
28:59you write very simple commands just if you&#039;re&lt;br /&gt;
29:01testing something out.&lt;br /&gt;
29:03And on the left-hand side here in the editor,&lt;br /&gt;
29:04you write more lines and more complicated programs.&lt;br /&gt;
29:15Now we&#039;re going to start talking about Python.&lt;br /&gt;
29:18And in Python, we&#039;re going to come back to this,&lt;br /&gt;
29:20everything is an object.&lt;br /&gt;
29:23And Python programs manipulate these data objects.&lt;br /&gt;
29:27All objects in Python are going to have a type.&lt;br /&gt;
29:30And the type is going to tell Python the kinds of operations&lt;br /&gt;
29:34that you can do on these objects.&lt;br /&gt;
29:37If an object is the number five, for example,&lt;br /&gt;
29:39you can add the number to another number,&lt;br /&gt;
29:42subtract the number, take it to the power of something,&lt;br /&gt;
29:45and so on.&lt;br /&gt;
29:47As a more general example, for example, I am a human.&lt;br /&gt;
29:51So that&#039;s my type.&lt;br /&gt;
29:52And I can walk, speak English, et cetera.&lt;br /&gt;
29:55Chewbacca is going to be a type Wookie.&lt;br /&gt;
29:59He can walk, do that sound that I can&#039;t do.&lt;br /&gt;
30:02He can do that, but I can&#039;t.&lt;br /&gt;
30:04I&#039;m not even going to try, and so on.&lt;br /&gt;
30:09Once you have these Python objects,&lt;br /&gt;
30:11everything is an object in Python.&lt;br /&gt;
30:14There are actually two types of objects.&lt;br /&gt;
30:16One are scalar objects.&lt;br /&gt;
30:18That means these are very basic objects in Python from which&lt;br /&gt;
30:21everything can be made.&lt;br /&gt;
30:24These are scalar objects.&lt;br /&gt;
30:26That can&#039;t be subdivided.&lt;br /&gt;
30:28The other type of object is a non-scalar object.&lt;br /&gt;
30:31And these are objects that have some internal structure.&lt;br /&gt;
30:33For example, the number five is a scalar&lt;br /&gt;
30:36object because it can&#039;t be subdivided.&lt;br /&gt;
30:39But a list of numbers, for example, 5, 6,&lt;br /&gt;
30:417,8, is going to be a non-scalar object&lt;br /&gt;
30:45because you can subdivide it.&lt;br /&gt;
30:46You can subdivide it into-- you can find parts to it.&lt;br /&gt;
30:53It&#039;s made up of a sequence of numbers.&lt;br /&gt;
30:58Here&#039;s the list of all of the scalar objects in Python.&lt;br /&gt;
31:01We have integers, for example, all of the whole numbers.&lt;br /&gt;
31:05Floats, which are all of the real numbers, anything&lt;br /&gt;
31:10with a decimal.&lt;br /&gt;
31:11Bools are Booleans.&lt;br /&gt;
31:13There&#039;s only two values to Booleans.&lt;br /&gt;
31:16That&#039;s True and False.&lt;br /&gt;
31:18Note the capitalization, capital T and capital F.&lt;br /&gt;
31:23And this other thing called NoneType.&lt;br /&gt;
31:24It&#039;s special.&lt;br /&gt;
31:26It has only one value called None.&lt;br /&gt;
31:28And it represents the absence of a type.&lt;br /&gt;
31:30And it sometimes comes in handy for some programs.&lt;br /&gt;
31:34If you want to find the type of an object,&lt;br /&gt;
31:36you can use this special command called type.&lt;br /&gt;
31:39And then in the parentheses, you put down&lt;br /&gt;
31:41what you want to find the type of.&lt;br /&gt;
31:44You can write into the shell &amp;quot;type of 5,&amp;quot;&lt;br /&gt;
31:47and the shell will tell you, that&#039;s an integer.&lt;br /&gt;
31:52If you happen to want to convert between two different types,&lt;br /&gt;
31:56Python allows you to do that.&lt;br /&gt;
31:58And to do that, you put the type that you&lt;br /&gt;
32:01want to convert to right before the object&lt;br /&gt;
32:03that you want to convert to.&lt;br /&gt;
32:05So float(3) will convert the integer 3 to the float 3.0.&lt;br /&gt;
32:12And similarly, you can convert any float into an integer.&lt;br /&gt;
32:16And converting to an integer just truncates.&lt;br /&gt;
32:20It just takes away the decimal and whatever&#039;s&lt;br /&gt;
32:22after it-- it does not round-- and keeps just the integer&lt;br /&gt;
32:26part.&lt;br /&gt;
32:30For this slide, I&#039;m going to talk about it.&lt;br /&gt;
32:31But if you&#039;d like if you have the slides up,&lt;br /&gt;
32:35go to go to this exercise.&lt;br /&gt;
32:37And after I&#039;m done talking about the slide,&lt;br /&gt;
32:41we&#039;ll see what people think for that exercise.&lt;br /&gt;
32:45One of the most important things that you&lt;br /&gt;
32:47can do in basically any programming,&lt;br /&gt;
32:51in Python also, is to print things out.&lt;br /&gt;
32:55Printing out is how you interact with the user.&lt;br /&gt;
33:00To print things out, you use the print command.&lt;br /&gt;
33:04If you&#039;re in the shell, if you simply type &amp;quot;3 plus 2,&amp;quot;&lt;br /&gt;
33:07you do see a value here.&lt;br /&gt;
33:09Five, right?&lt;br /&gt;
33:11But that&#039;s not actually printing something out.&lt;br /&gt;
33:13And that becomes apparent when you actually&lt;br /&gt;
33:18type things into the editor.&lt;br /&gt;
33:19If you just do &amp;quot;3 plus 2,&amp;quot; and you run the program-- that&#039;s&lt;br /&gt;
33:23the green button here-- you see on the right-hand side here,&lt;br /&gt;
33:26it ran my program.&lt;br /&gt;
33:27But it didn&#039;t actually print anything.&lt;br /&gt;
33:30If you type this into the console,&lt;br /&gt;
33:32it does show you this value, but that&#039;s&lt;br /&gt;
33:33just like peeking into the value for you as a programmer.&lt;br /&gt;
33:39It&#039;s not actually printing it out to anyone.&lt;br /&gt;
33:41If you want to print something out,&lt;br /&gt;
33:42you have to use the print statement like that.&lt;br /&gt;
33:47In this case, this is actually going to print this number&lt;br /&gt;
33:50five to the console.&lt;br /&gt;
33:58That&#039;s basically what it says.&lt;br /&gt;
33:59It just tells you it&#039;s an interaction within the shell&lt;br /&gt;
34:01only.&lt;br /&gt;
34:02It&#039;s not interacting with anyone else.&lt;br /&gt;
34:04And if you don&#039;t have any &amp;quot;Out,&amp;quot; that&lt;br /&gt;
34:06means it got printed out to the console.&lt;br /&gt;
34:09All right.&lt;br /&gt;
34:09We talked a little bit about objects.&lt;br /&gt;
34:13Once you have objects, you can combine objects and operators&lt;br /&gt;
34:16to form these expressions.&lt;br /&gt;
34:17And each expression is going to have a value.&lt;br /&gt;
34:19So an expression evaluates to a value.&lt;br /&gt;
34:22The syntax for an expression is going&lt;br /&gt;
34:24to be object, operator, object, like that.&lt;br /&gt;
34:30And these are some operators you can do on ints and floats.&lt;br /&gt;
34:34There&#039;s the typical ones, addition, subtraction,&lt;br /&gt;
34:36multiplication, and division.&lt;br /&gt;
34:38If, for the first three, the answer&lt;br /&gt;
34:43that you get-- the type of the answer that you get--&lt;br /&gt;
34:45is going to depend on the type of your variables.&lt;br /&gt;
34:48If both of the variables of the operands are integers,&lt;br /&gt;
34:52then the result you&#039;re going to get is of type integer.&lt;br /&gt;
34:55But if at least one of them is a float, then&lt;br /&gt;
34:56the result you&#039;re going to get is a float.&lt;br /&gt;
34:58Division is a little bit special in that&lt;br /&gt;
35:02no matter what the operands are, the result&lt;br /&gt;
35:04is always going to be a float.&lt;br /&gt;
35:09The other operations you can do, and these are also useful,&lt;br /&gt;
35:14are the remainder, so the percent sign.&lt;br /&gt;
35:19If you use the percent sign between two operands,&lt;br /&gt;
35:22that&#039;s going to give you the remainder when you divide i&lt;br /&gt;
35:25by j.&lt;br /&gt;
35:28And raising something to the power of something else&lt;br /&gt;
35:30is using the star star operator.&lt;br /&gt;
35:32And i star stars j is going to take i to the power of j.&lt;br /&gt;
35:41These operations have the typical precedence&lt;br /&gt;
35:43that you might expect in math, for example.&lt;br /&gt;
35:47And if you&#039;d like to put precedence&lt;br /&gt;
35:49toward some other operations, you&lt;br /&gt;
35:50can use parentheses to do that.&lt;br /&gt;
36:01All right.&lt;br /&gt;
36:03So we have ways of creating expressions.&lt;br /&gt;
36:07And we have operations we can do on objects.&lt;br /&gt;
36:13But what&#039;s going to be useful is to be able to save values&lt;br /&gt;
36:19to some name.&lt;br /&gt;
36:21And the name is going to be something that you pick.&lt;br /&gt;
36:24And it should be a descriptive name.&lt;br /&gt;
36:27And when you save the value to a name,&lt;br /&gt;
36:32you&#039;re going to be able to access that value later&lt;br /&gt;
36:36on in your program.&lt;br /&gt;
36:37And that&#039;s very useful.&lt;br /&gt;
36:40To save a value to a variable name, you use the equal sign.&lt;br /&gt;
36:49And the equal sign is an assignment.&lt;br /&gt;
36:51It assigns the right-hand side, which&lt;br /&gt;
36:53is a value, to the left-hand side, which&lt;br /&gt;
36:55is going to be a variable name.&lt;br /&gt;
36:59In this case, I assigned the float 3.14159&lt;br /&gt;
37:03to the variable pi.&lt;br /&gt;
37:05And in the second line, I&#039;m going&lt;br /&gt;
37:08to take this expression, 22 divided by 7,&lt;br /&gt;
37:10I&#039;m going to evaluate it.&lt;br /&gt;
37:13It&#039;s going to come up with some decimal number.&lt;br /&gt;
37:16And I&#039;m going to save it into the variable pi_approx.&lt;br /&gt;
37:19values are stored in memory.&lt;br /&gt;
37:21And this assignment in Python, we&lt;br /&gt;
37:22say the assignment binds the name to the value.&lt;br /&gt;
37:26When you use that name later on in your program,&lt;br /&gt;
37:30you&#039;re going to be referring to the value in memory.&lt;br /&gt;
37:35And if you ever want to refer to the value&lt;br /&gt;
37:37later on in your code, you just simply type&lt;br /&gt;
37:39the name of the variable that you&#039;ve assigned it to.&lt;br /&gt;
37:44So why do we want to give names to expressions?&lt;br /&gt;
37:48Well, you want to reuse the names instead of the values.&lt;br /&gt;
37:51And it makes your code look a lot nicer.&lt;br /&gt;
37:54This is a piece of code that calculates&lt;br /&gt;
37:56the area of a circle.&lt;br /&gt;
37:59And notice, I&#039;ve assigned a variable pi to 3.14159.&lt;br /&gt;
38:03I&#039;ve assigned another variable called radius to be 2.2.&lt;br /&gt;
38:07And then, later on in my code, I have another line&lt;br /&gt;
38:09that says area-- this is another variable-- is&lt;br /&gt;
38:12equal to-- this is an assignment--&lt;br /&gt;
38:15to this expression.&lt;br /&gt;
38:17And this expression is referring to these variable names, pi&lt;br /&gt;
38:23and radius.&lt;br /&gt;
38:24And it&#039;s going look up their values in memory.&lt;br /&gt;
38:26And it&#039;s going to replace these variable names&lt;br /&gt;
38:29with those values.&lt;br /&gt;
38:30And it&#039;s going to do the calculation for me.&lt;br /&gt;
38:32And in the end, this whole expression&lt;br /&gt;
38:34is going to be replaced by one number.&lt;br /&gt;
38:36And it&#039;s going to be the float.&lt;br /&gt;
38:40Here&#039;s another exercise, while I&#039;m talking about the slide.&lt;br /&gt;
38:45I do want to make a note about programming versus math.&lt;br /&gt;
38:49In math, you&#039;re often presented with a problem&lt;br /&gt;
38:55that says, solve for x.&lt;br /&gt;
38:57x plus y is equal to something something.&lt;br /&gt;
39:00Solve for x, for example.&lt;br /&gt;
39:03That&#039;s coming back to the fact that computers don&#039;t&lt;br /&gt;
39:09know what to do with that.&lt;br /&gt;
39:10Computers need to be told what to do.&lt;br /&gt;
39:12In programming, if you want to solve for x,&lt;br /&gt;
39:14you need to tell the computer exactly how to solve for x.&lt;br /&gt;
39:18You need to figure out what formula&lt;br /&gt;
39:20you need to give the computer in order to be&lt;br /&gt;
39:22able to solve for x.&lt;br /&gt;
39:25That means always in programming the right-hand side is&lt;br /&gt;
39:29going to be an expression.&lt;br /&gt;
39:33It&#039;s something that&#039;s going to be evaluated to a value.&lt;br /&gt;
39:35And the left-hand side is always a variable.&lt;br /&gt;
39:39It&#039;s going to be an assignment.&lt;br /&gt;
39:40The equal sign is not like in math&lt;br /&gt;
39:43where you can have a lot of things to the left&lt;br /&gt;
39:45and a lot of things to the right of the equal sign.&lt;br /&gt;
39:47There&#039;s only one thing to the left of the equal sign.&lt;br /&gt;
39:49And that&#039;s going to be a variable.&lt;br /&gt;
39:50An equal sign stands for an assignment.&lt;br /&gt;
39:53Once we&#039;ve created expressions, and we have these assignments,&lt;br /&gt;
39:57you can rebind variable names using new assignment&lt;br /&gt;
39:59statements.&lt;br /&gt;
40:03Let&#039;s look at an example for that.&lt;br /&gt;
40:05Let&#039;s say this is our memory.&lt;br /&gt;
40:07Let&#039;s type back in the example with finding the radius.&lt;br /&gt;
40:13Let&#039;s say, pi is equal to 3.14.&lt;br /&gt;
40:19In memory, we&#039;re going to create this value 3.14.&lt;br /&gt;
40:22We&#039;re going to bind it to the variable named pi.&lt;br /&gt;
40:28Next line, radius is equal to 2.2.&lt;br /&gt;
40:31In memory, we&#039;re creating this value 2.2.&lt;br /&gt;
40:35And we&#039;re going to bind it to the variable named radius.&lt;br /&gt;
40:40Then we have this expression here.&lt;br /&gt;
40:44It&#039;s going to substitute the values for pi&lt;br /&gt;
40:46from memory and the value for radius from memory.&lt;br /&gt;
40:49It&#039;s going to calculate the value that this expression&lt;br /&gt;
40:54evaluates to.&lt;br /&gt;
40:56It&#039;s going to pop that into the memory.&lt;br /&gt;
40:57And it&#039;s going to assign-- because we&#039;re&lt;br /&gt;
40:59using the equal sign-- it&#039;s going&lt;br /&gt;
41:01to assign that value to that variable area.&lt;br /&gt;
41:08Now, let&#039;s say we rebind radius to be something else.&lt;br /&gt;
41:14Radius i is bound to the value 2.2.&lt;br /&gt;
41:21But when we do this line, radius is equal to radius plus 1,&lt;br /&gt;
41:24we&#039;re going to take away the binding to 2.2.&lt;br /&gt;
41:27We&#039;re going to do this calculation.&lt;br /&gt;
41:29The new value is 3.2.&lt;br /&gt;
41:31And we&#039;re going to rebind that value to that same variable.&lt;br /&gt;
41:38In memory, notice we&#039;re still going&lt;br /&gt;
41:40to have this value, 2.2, floating around.&lt;br /&gt;
41:43But we&#039;ve lost the handle for it.&lt;br /&gt;
41:46There&#039;s no way to get it back.&lt;br /&gt;
41:48It&#039;s just in memory sitting there.&lt;br /&gt;
41:52At some point, it might get collected by what&lt;br /&gt;
41:55we call the garbage collector.&lt;br /&gt;
41:56In Python, And it&#039;ll retrieve these lost values,&lt;br /&gt;
42:00and it&#039;ll reuse them for new values, and things like that.&lt;br /&gt;
42:05But radius now points to the new value.&lt;br /&gt;
42:08We can never get back 2.2.&lt;br /&gt;
42:13And that&#039;s it.&lt;br /&gt;
42:16The value of area-- notice, this is very important.&lt;br /&gt;
42:18The value of area did not change.&lt;br /&gt;
42:23And it did not change because these are all the instructions&lt;br /&gt;
42:26we told the computer to do.&lt;br /&gt;
42:28We just told it to change radius to be radius plus 1.&lt;br /&gt;
42:33We never told it to recalculate the value of area.&lt;br /&gt;
42:37If I copied that line down here, then the value of area&lt;br /&gt;
42:41would change.&lt;br /&gt;
42:42But we never told it to do that.&lt;br /&gt;
42:44The computer only does what we tell it to do.&lt;br /&gt;
42:46That&#039;s the last thing.&lt;br /&gt;
42:47Next lecture, we&#039;re going to talk about adding control&lt;br /&gt;
42:51flow to our programs, so how do you tell the computer&lt;br /&gt;
42:53to do one thing or another?&lt;br /&gt;
42:55All right.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lecture Notes - lecture 1 py===&lt;br /&gt;
Source: https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/920cc911b6eb5747f2ccd431bbc4306b_lec1.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
lecture 1 py&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pi = 3.14159&lt;br /&gt;
radius = 2.2&lt;br /&gt;
# area of circle equation &amp;lt;- this is a comment&lt;br /&gt;
area = pi*(radius**2)&lt;br /&gt;
print(area)&lt;br /&gt;
&lt;br /&gt;
# change values of radius &amp;lt;- another comment&lt;br /&gt;
# use comments to help others understand what you are doing in code&lt;br /&gt;
radius = radius + 1&lt;br /&gt;
print(area)     # area doesn&#039;t change&lt;br /&gt;
area = pi*(radius**2)&lt;br /&gt;
print(area)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#############################&lt;br /&gt;
#### COMMENTING LINES #######&lt;br /&gt;
#############################&lt;br /&gt;
# to comment MANY lines at a time, highlight all of them then CTRL+1&lt;br /&gt;
# do CTRL+1 again to uncomment them&lt;br /&gt;
# try it on the next few lines below!&lt;br /&gt;
&lt;br /&gt;
#area = pi*(radius**2)&lt;br /&gt;
#print(area)&lt;br /&gt;
#radius = radius + 1&lt;br /&gt;
#area = pi*(radius**2)&lt;br /&gt;
#print(area)&lt;br /&gt;
&lt;br /&gt;
#############################&lt;br /&gt;
#### AUTOCOMPLETE #######&lt;br /&gt;
#############################&lt;br /&gt;
# Spyder can autocomplete names for you&lt;br /&gt;
# start typing a variable name defined in your program and hit tab &lt;br /&gt;
# before you finish typing -- try it below&lt;br /&gt;
&lt;br /&gt;
# define a variable&lt;br /&gt;
a_very_long_variable_name_dont_name_them_this_long_pls = 0&lt;br /&gt;
&lt;br /&gt;
# below, start typing a_ve then hit tab... cool, right!&lt;br /&gt;
# use autocomplete to change the value of that variable to 1&lt;br /&gt;
&lt;br /&gt;
# use autocomplete to write a line that prints the value of that long variable&lt;br /&gt;
# notice that Spyder also automatically adds the closed parentheses for you!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===pdf-Slides for Lecture 1===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_lec1/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmemB25bVuN2fuiAq3JaDM4J5MYit6HfCCsU3EFTWL7wpF&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Problem Set 1===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_ps1/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmbxaDU9U4hquK4Dhb365nD5qG5eEFUM6NABqXRaux6tRB&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Additional Python Resources ===&lt;br /&gt;
Source:https://ocw.mit.edu/courses/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/resources/mit6_0001f16_additional/&amp;lt;br&amp;gt;&lt;br /&gt;
IPFS:&amp;lt;code&amp;gt;QmYWPVdHEbhmdFXNR9R46ey5eykyFPeCZ1joXE6z28L1VB&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Additional Python Resources:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
If you&#039;re having trouble with a particular concept or simply want to have access to more&lt;br /&gt;
information, try one of the following links.&lt;br /&gt;
&lt;br /&gt;
====DOCUMENTATION====&lt;br /&gt;
* [[https://docs.python.org/3/library/index.html Official Python 3 Documentation]] - &amp;quot;official&amp;quot;/technical explanation of what a particular function/operator&lt;br /&gt;
does, examples of correct syntax, what the various libraries are, etc.&lt;br /&gt;
&lt;br /&gt;
====TEXTBOOKS/TUTORIALS====&lt;br /&gt;
* [[https://diveintopython3.net/ Dive Into Python]] - another survey of Python syntax, datatypes, etc.&lt;br /&gt;
* [[http://greenteapress.com/wp/think-python-2e/ Think Python by Allen Downey]] - a good general overview of the Python language. Includes exercises.&lt;br /&gt;
* [[https://docs.python.org/3/tutorial/ The Official Python Tutorial]] - self-explanatory&lt;br /&gt;
* [[https://learnpythonthehardway.org/book/ Learn Python the Hard Way]] - (note: for Python 2) another free online text&lt;br /&gt;
* [[https://docs.python.org/3.0/reference/lexical_analysis.html#id8 Reserved Keywords in Python]] - don&#039;t use these as variable names&lt;br /&gt;
* [[https://peps.python.org/pep-0008/ PEP 8 - Style Guide for Python Code]] - learn what is good and bad style in Python&lt;br /&gt;
* [[https://checkio.org/ CheckIO]] - learn Python by exploring a game world&lt;br /&gt;
* [[https://inventwithpython.com/ Invent with Python]] - develop your Python skills by making games or hacking ciphers&lt;br /&gt;
* [[https://www.codecademy.com/catalog Codecademy]] - (note: for Python 2) learn Python by building web apps and manipulating data; interactive&lt;br /&gt;
tutorial sequence&lt;br /&gt;
* [[https://pythontutor.com Python Tutor]] - interactive tutorial sequence of exercises&lt;br /&gt;
&lt;br /&gt;
====DEBUGGING====&lt;br /&gt;
* [[https://pythontutor.com/ Python Tutor]] - an excellent way to actually visualize how the interpreter actually reads and executes&lt;br /&gt;
your code&lt;br /&gt;
* [[https://www.diffchecker.com/ DiffChecker]] - compares two sets of text and shows you which lines are different&lt;br /&gt;
* [[https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ Debugging in Python]] - steps you can take to try to debug your program&lt;br /&gt;
&lt;br /&gt;
====OTHER Q&amp;amp;A====&lt;br /&gt;
* [[https://stackoverflow.com/questions/tagged/python Stack Overflow]] - a large Q&amp;amp;A forum for programming concepts (not just Python). Try searching here&lt;br /&gt;
before you post on the edX forum, and you may find that someone has already answered your question.&lt;br /&gt;
&lt;br /&gt;
====MORE PRACTICE PROBLEMS====&lt;br /&gt;
* [[http://www.pythonchallenge.com/ Python Challenge]] - a series of puzzles you can try to test your Python abilities&lt;br /&gt;
* [[https://projecteuler.net/ Project Euler]] - additional programming challenges you can try once your Python knowledge becomes&lt;br /&gt;
stronger; problems are sorted by increasing difficulty&lt;br /&gt;
* [[https://codingbat.com/python Coding Bat]] - problems you can solve within an online interpreter&lt;br /&gt;
* [[https://www.codewars.com/?language=python Codewars]] - improve your skills by training on real code challenges&lt;br /&gt;
&lt;br /&gt;
MIT OpenCourseWare&lt;br /&gt;
https://ocw.mit.edu&lt;br /&gt;
6.0001 Introduction to Computer Science and Programming in Python&lt;br /&gt;
Fall 2016&lt;br /&gt;
For information about citing these materials or our Terms of Use, visit: https://ocw.mit.edu/terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==2==&lt;br /&gt;
mit-test-course/2/MIT6_0001F16_Lecture_02_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
https://ipfs.io/ipfs/QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
mit-test-course/2/ba2947b25b1580e4a84df0ec5dbe5cdd_MIT6_0001F16_Lec2.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
https://ipfs.io/ipfs/QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
mit-test-course/2/d6ee838ee4c85ace93a4e170cfd83c03_lec2_branch_loops.py&amp;lt;br&amp;gt;&lt;br /&gt;
https://ipfs.io/ipfs/QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==3==&lt;br /&gt;
&lt;br /&gt;
MIT6_0001F16_Lecture_03_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmTTCsuhbnjXWuigZLSgKAt4DjFsm78MANo3KUMGcK98s1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
88de925a1fb925e46a08bc5f34d029bd_lec3_strings_algos.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmYppDgGMptihHA7ixFw2GHvspN8Bw1HY21HtUpQNxi23i&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
b9b9a82a29e8746db1facfbd30c07940_MIT6_0001F16_Lec3.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmP2AZfUx8RTqCGamJtPyodFU8dHG8QrBHYKkP79YepEe9&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==4==&lt;br /&gt;
&lt;br /&gt;
MIT6_0001F16_Lecture_04_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmQuc5zpaJdMfRYxTLyZc5DQuota1FjuJiqgWf8ctGmRsU&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
6ba59859535f1566dd57a7279aeba5d1_MIT6_0001F16_Lec4.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmP1p4h21ogMxWeeX2PiDibQbHqWer7ABCsMrfMxEx7QBW&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
9e8439a27af18817e046ac37333d03f6_lec4_functions.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmNtPQncXMYNBnX4NoNfx2ifetrfvrATamdrsjx4u9iQ7c&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==5==&lt;br /&gt;
MIT6_0001F16_Lecture_05_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Qmco5sKKQfnWUNP9ZUxLkDhoV6jfjv8L4AdzES7En41AzP&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
1776670e271578eeb99fc25975f20586_MIT6_0001F16_Lec5.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmSdxg2inPbK1FSynNdPUka6CUZtEGG6sdPZgxaAgb46GE&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
cdf5f8e7f109952655f4d253ed955555_lec5_tuples_lists.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmThDori5ETa3U27DFpndU7RmsLgG7zjpqGVxAncCupSuc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==6==&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_06_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmVzK3PVETv69Y27UKDfaQQM5um8ByMdYQS3TzD2EkoR42&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;876348c652c5353daccc96e1b7d577bb_MIT6_0001F16_Lec6.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmQAqSGJAeoypUMyUnb7hRrziDyRAwymcTGdcaydT5i73s&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;706228e592761d9c7c1c073f8ba7a6cc_lec6_recursion_dictionaries.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmaGhNYnR5yUMYZf4q7qLsNwEW6B7pbLbgJokJBTNSA2FT&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==7==&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_07_300k.mp4&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmUyiqpAUA91w4Xm2Dz2wPr6kE6wTzA1apwJziTdBysRLw&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
51bdde43dfd773ba20747ce5d89119ac_MIT6_0001F16_Lec7.pdf&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmcqZoeVrsfBv4Ri6M8KtiLdy3VpKnyznDFhX8zvfd3Qrs&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
abdd1d61892ccce9be2ad84e52004e07_lec7_debug_except.py&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;QmeVKCB6ponYr4f72MuNwegukX9t42NTywNHpDPgyNi9ae&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==8==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_08_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmZFSSPndvRfPT2vyehuyEQitfb8CzdYkA7orFAKyvhA4u&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;7a6f85d03f132dcd9d7592bc4643be1c_MIT6_0001F16_Lec8.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmdccChFuYBCiLmufEmk6oXCHybaUQiPXajD3c3xMupiaC&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;0705ac9dcc7e637a0e8e9d97eb258a26_lec8_classes.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmQCaZZA75UQ5pAKy8zhcz6Ci8yY13UVHUvsuXmid86GUH&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==9==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_09_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmdENonCipE7TK99i7dFz9paqDUSefR4PFdveEmVi5oXAb&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;2dd6c75e7b4bd6bd135078e6f3701201_MIT6_0001F16_Lec9.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmbaJFk4mFRmCbtQybK94etyfRA2LcM22Kfvjbvdf6X8Gw&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bf8e8195044d5f6aefc1a455968e2f3e_lec9_inheritance.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmQ7UB4PaGBRHvHfDshrASwynvansFVXrp3RNULwhThUsC&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==10==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_10_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmQNooq1g25LFp1Fxj2tfpKKMKi8NbutkhuXNf5Ppo7t5f&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;066eba6ea6d56a88e56ae325940d4c4c_MIT6_0001F16_Lec10.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmbyP59ttPKGe5ZNADsgqTsgBF3oYGzhZXFfBhszG2nuPm&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bfa32fd241d88ae02cd3157aed232bac_lec10_complexity_part1.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmUtgXQXjj2C3qb2UXFrPmKHkFdEjmehk4ZLQhcZ37rEmw&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==11==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_11_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmR7Ned6iZytjpVHVN6W53EZ5Qg4Zd6EkEcXxn8DjYMgrd&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bb953fb81d4afa3bc837c16eba613955_MIT6_0001F16_Lec11.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmNPjN3616QdmEWLPokwuTkLL1vrzcLVRSFLWUcukqtxZL&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;bdf800867e6762c6758ecd2230178f41_lec11_complexity_part2.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmdpwFTFkwnkqWW3CozBBAfeYHchDeVAV7ArkA1dUqbUZ4&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==12==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;MIT6_0001F16_Lecture_12_300k.mp4&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmPWidAv5mBrgEcKDVqWe62JaAiwBWs8KZc1S8r3bbJsvY&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;6425d0dabb1cea1a076b8c46c0ae2da6_MIT6_0001F16_Lec12.pdf&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmToP68Knz71euVuntRWtz6UshRoiRssELJNFMeP1f2sR5&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;310536cd5f5aa1fc0c11726ce13c565e_lec12_sorting.py&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;code&amp;gt;QmbV8ct8DEQyRGRDSX4PaQBXk8r8ryYLDNwTa2buC7kcP5&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Nix_Package_Manager_in_an_Ubuntu_22.04_LXC_Container_for_Testing&amp;diff=447</id>
		<title>Nix Package Manager in an Ubuntu 22.04 LXC Container for Testing</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Nix_Package_Manager_in_an_Ubuntu_22.04_LXC_Container_for_Testing&amp;diff=447"/>
		<updated>2023-07-17T13:45:21Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Remove/Uninstall a Package */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==prerequisite==&lt;br /&gt;
&lt;br /&gt;
* LXD - Basic knowledge , install LXD and launch a container&lt;br /&gt;
* Terminal: will be using the terminal.&lt;br /&gt;
&lt;br /&gt;
== Create a container ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc launch ubuntu:2204 nix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec nix bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional steps for the paranoid ==&lt;br /&gt;
&lt;br /&gt;
The default Ubuntu containers come with a user named &#039;&#039;&#039;ubuntu&#039;&#039;&#039;. In a new container, this user does not have a password set and can run sudo without being prompted for a password. This configuration is not ideal from a security perspective.&lt;br /&gt;
&lt;br /&gt;
=== Create a new user ===&lt;br /&gt;
&lt;br /&gt;
Next, we will create a new user named &#039;&#039;&#039;nix&#039;&#039;&#039; and set a password for this user. This user will be used for the rest of the setup and general use of the container.&lt;br /&gt;
&lt;br /&gt;
Create the new user:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser nix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the prompts to set a password and provide any other requested information.&lt;br /&gt;
&lt;br /&gt;
====Adding new user to &#039;&#039;&#039;sudoers&#039;&#039;&#039; file====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING&#039;&#039;&#039;: Be cautious while editing the sudoers file as errors could lead to some serious issues with the system. A syntax error in the sudoers file could potentially lock out all users from gaining superuser privileges.&lt;br /&gt;
&lt;br /&gt;
* Note: by default in Ubuntu when you use &#039;&#039;&#039;visudo&#039;&#039;&#039; the default terminal editor is &#039;&#039;&#039;nano&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;visudo&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you&#039;re in the editor, you can navigate using the arrow keys. Go down to the section that looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# User privilege specification&lt;br /&gt;
root    ALL=(ALL:ALL) ALL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below the root user line, add a similar line for the &#039;nix&#039; user:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nix    ALL=(ALL:ALL) ALL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
press &amp;lt;code&amp;gt;CTRL O&amp;lt;/code&amp;gt; to write to file and &amp;lt;code&amp;gt;CTRL X&amp;lt;/code&amp;gt; to exit.&lt;br /&gt;
&lt;br /&gt;
=== Delete the &#039;ubuntu&#039; user ===&lt;br /&gt;
&lt;br /&gt;
Now that we have a new, secure user set up, we can delete the default ubuntu user for added security.&lt;br /&gt;
&lt;br /&gt;
Delete the ubuntu user:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;deluser --remove-home ubuntu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, switch to the new nix user:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;su - nix&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You now have a container set up with the nix user. This user is more secure than the default ubuntu user because it requires a password for sudo operations. You can now proceed with the rest of your setup process.&lt;br /&gt;
&lt;br /&gt;
==Download and install==&lt;br /&gt;
If you did not follow the &#039;&#039;&#039;Optional steps for the paranoid&#039;&#039;&#039; change user to &#039;&#039;&#039;ubuntu&#039;&#039;&#039;&lt;br /&gt;
* &amp;lt;code&amp;gt;su - ubuntu&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://nixos.org/nix/install&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* install using &#039;&#039;&#039;Single-user installation&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;sh install --no-daemon&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Return Output:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ubuntu@nix:~$ sh install --no-daemon &lt;br /&gt;
downloading Nix 2.16.1 binary tarball for x86_64-linux from &#039;https://releases.nixos.org/nix/nix-2.16.1/nix-2.16.1-x86_64-linux.tar.xz&#039; to &#039;/tmp/nix-binary-tarball-unpack.g0HlgbTnoO&#039;...&lt;br /&gt;
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current&lt;br /&gt;
                                 Dload  Upload   Total   Spent    Left  Speed&lt;br /&gt;
100 21.0M  100 21.0M    0     0  5176k      0  0:00:04  0:00:04 --:--:-- 5178k&lt;br /&gt;
Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation&lt;br /&gt;
performing a single-user installation of Nix...&lt;br /&gt;
directory /nix does not exist; creating it by running &#039;mkdir -m 0755 /nix &amp;amp;&amp;amp; chown ubuntu /nix&#039; using sudo&lt;br /&gt;
copying Nix to /nix/store.................................................&lt;br /&gt;
installing &#039;nix-2.16.1&#039;&lt;br /&gt;
building &#039;/nix/store/2bdqkggqrhiwrklp7y9sfrqdkrw9xihd-user-environment.drv&#039;...&lt;br /&gt;
unpacking channels...&lt;br /&gt;
modifying /home/ubuntu/.profile...&lt;br /&gt;
&lt;br /&gt;
Installation finished!  To ensure that the necessary environment&lt;br /&gt;
variables are set, either log in again, or type&lt;br /&gt;
&lt;br /&gt;
  . /home/ubuntu/.nix-profile/etc/profile.d/nix.sh&lt;br /&gt;
&lt;br /&gt;
in your shell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* set necessary environment variables&lt;br /&gt;
&amp;lt;code&amp;gt;. /home/ubuntu/.nix-profile/etc/profile.d/nix.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;. /home/ubuntu/.nix-profile/etc/profile.d/nix.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Let&#039;s break down the command &amp;lt;code&amp;gt;. /home/ubuntu/.nix-profile/etc/profile.d/nix.sh&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;.&#039;&#039;&#039; (also known as source in bash): This is a shell built-in command which reads and executes commands from the file specified as its argument, in the current shell environment. So it is as if they were typed at the keyboard.&lt;br /&gt;
&lt;br /&gt;
:    &amp;lt;code&amp;gt;/home/ubuntu/.nix-profile/etc/profile.d/nix.sh&amp;lt;/code&amp;gt; This is the full path of the script that is sourced.&lt;br /&gt;
&lt;br /&gt;
When you execute the command &amp;lt;code&amp;gt;. /home/ubuntu/.nix-profile/etc/profile.d/nix.sh&amp;lt;/code&amp;gt;, you are essentially telling your shell to execute the commands in the nix.sh file within the same shell you&#039;re currently running. This is done instead of starting a new shell process, which would be the case if you ran the script like a typical shell script with bash /path/to/script.sh or ./script.sh.&lt;br /&gt;
&lt;br /&gt;
The nix.sh script contains environment variable settings and possibly other setup needed for using Nix packages. By running this script with ., these environment settings are preserved in your current shell.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;.&#039;&#039;&#039; command is often used in configuration and startup scripts where you want settings within a script to affect your current shell&#039;s environment.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Channels ==&lt;br /&gt;
&lt;br /&gt;
A channel in Nix is a collection of Nix expressions (the packages available for installation) that are versioned and updated together. In other words, a channel in Nix is similar to a repository in other types of package management systems.&lt;br /&gt;
&lt;br /&gt;
===List channels===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-channel --list&amp;lt;/code&amp;gt;&lt;br /&gt;
* Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nixpkgs https://nixos.org/channels/nixpkgs-unstable&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Update channels===&lt;br /&gt;
When you update your channels (with the nix-channel --update command), you&#039;re downloading the latest set of package expressions from the channels you are subscribed to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-channel --update&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Search a package===&lt;br /&gt;
&lt;br /&gt;
Syntax: &amp;lt;code&amp;gt;nix search nixpkgs &amp;lt;PACKAGE_NAME&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix search nixpkgs bluefish&amp;lt;/code&amp;gt;&lt;br /&gt;
* Return Output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ubuntu@nix:~$ nix search nixpkgs bluefish&lt;br /&gt;
error: experimental Nix feature &#039;nix-command&#039; is disabled; use &#039;--extra-experimental-features nix-command&#039; to override&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FIX:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix search nixpkgs bluefish --extra-experimental-features nix-command&amp;lt;/code&amp;gt;&lt;br /&gt;
*Return Ouput:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
error: experimental Nix feature &#039;flakes&#039; is disabled; use &#039;--extra-experimental-features flakes&#039; to override&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FIX:&lt;br /&gt;
&amp;lt;code&amp;gt;nix search nixpkgs bluefish --extra-experimental-features nix-command --extra-experimental-features flakes&amp;lt;/code&amp;gt;&lt;br /&gt;
* Ruturn output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* legacyPackages.x86_64-linux.bluefish (2.2.12)&lt;br /&gt;
  A powerful editor targeted towards programmers and webdevelopers&lt;br /&gt;
trace: warning: qt5 now uses makeScopeWithSplicing which does not have &amp;quot;overrideScope&#039;&amp;quot;, use &amp;quot;overrideScope&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
This warning is a developer-oriented message and doesn&#039;t directly impact you as an end-user:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The trace: warning message is intended for the maintainers of the package you&#039;re trying to install (in this case, the bluefish package from nixpkgs).&lt;br /&gt;
&lt;br /&gt;
Nix is telling us that the qt5 package (which bluefish may depend on) has switched to a different method for managing its internal dependencies. More specifically, it&#039;s switched to a method called makeScopeWithSplicing.&lt;br /&gt;
&lt;br /&gt;
This is just a way that Nix organizes and overrides dependencies within packages. It seems like qt5 previously used something called overrideScope&#039;, but it now uses makeScopeWithSplicing.&lt;br /&gt;
&lt;br /&gt;
The overrideScope&#039; method is no longer available in this context, so the warning is instructing developers to use makeScopeWithSplicing instead when they&#039;re working on the qt5 package or packages that depend on it.&lt;br /&gt;
&lt;br /&gt;
For you as an end-user, there is no action required unless the warning turns into an error or if the package does not work as expected. The package should still install and function normally. This warning is more of an FYI for people maintaining or developing with these packages.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Bluefish is a GUI program and we have not setup container for X forwarding so lets try cowsay.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix search nixpkgs cowsay --extra-experimental-features nix-command --extra-experimental-features flakes&amp;lt;/code&amp;gt;&lt;br /&gt;
* Return output:&lt;br /&gt;
** Note: the package name is after &amp;lt;code&amp;gt;legacyPackages.x86_64-linux.&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;legacyPackages.x86_64-linux.&amp;lt;PACKAGE_NAME&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
* legacyPackages.x86_64-linux.charasay (3.0.0)&lt;br /&gt;
  The future of cowsay - Colorful characters saying something&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.cowsay (3.7.0)&lt;br /&gt;
  A program which generates ASCII pictures of a cow with a message&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.emacsPackages.cowsay (20210510.1540)&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.neo-cowsay (2.0.1)&lt;br /&gt;
  Cowsay reborn, written in Go&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.pokemonsay (1.0.0)&lt;br /&gt;
  Print pokemon in the CLI! An adaptation of the classic cowsay&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.ponysay (2021-03-27)&lt;br /&gt;
  Cowsay reimplemention for ponies&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.tewisay (2022-11-04)&lt;br /&gt;
  Cowsay replacement with unicode and partial ansi escape support&lt;br /&gt;
&lt;br /&gt;
* legacyPackages.x86_64-linux.xcowsay (1.6)&lt;br /&gt;
  Tool to display a cute cow and messages&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Install a package===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-env -iA nixpkgs.pokemonsay&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-env -iA nixpkgs.pokemonsay&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The command &#039;&#039;&#039;nix-env -iA nixpkgs.pokemonsay&#039;&#039;&#039; is used to install the pokemonsay package from the nixpkgs channel in Nix.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the command:&lt;br /&gt;
&lt;br /&gt;
:    nix-env: This is the main command used for user environment management in Nix. It can install, upgrade, and remove software, among other tasks.&lt;br /&gt;
&lt;br /&gt;
:    -iA: This is a combination of two options. -i stands for install and -A stands for attribute. The -A option allows you to install a package using its attribute path (nixpkgs.pokemonsay in this case), which is often more reliable than using the package name.&lt;br /&gt;
&lt;br /&gt;
:    nixpkgs.pokemonsay: This is the attribute path of the package you want to install. nixpkgs is the name of the channel, and pokemonsay is the name of the package in that channel.&lt;br /&gt;
&lt;br /&gt;
So, when you run nix-env -iA nixpkgs.pokemonsay, Nix will look for the pokemonsay package in the nixpkgs channel and install it into your user environment.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Understanding -A flag in Nix commands:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The command &#039;&#039;&#039;nix-env -i &amp;lt;package&amp;gt;&#039;&#039;&#039; installs a package by its name rather than its attribute path. For example, &#039;&#039;&#039;nix-env -i firefox&#039;&#039;&#039; will install the Firefox browser.&lt;br /&gt;
&lt;br /&gt;
This command can sometimes lead to ambiguity because multiple versions of the same package may be available in the channel, or there may be similarly-named packages. This is why it is often recommended to install packages using the -A flag and the package&#039;s attribute path, like &#039;&#039;&#039;nix-env -iA nixpkgs.firefox&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to note that while the attribute path usually includes the package name, it might also include other information. For instance, a channel might have separate attributes for different versions of a package, or for the same package built with different options.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a little more information on the difference between these two commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;nix-env -i &amp;lt;package&amp;gt;&#039;&#039;&#039;: This command installs a package by its name. The name is a human-readable identifier for the package, like &amp;quot;firefox&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;nix-env -iA &amp;lt;attribute path&amp;gt;&#039;&#039;&#039;: This command installs a package by its attribute path. The attribute path is a precise identifier for the package within a channel, like &amp;quot;nixpkgs.firefox&amp;quot;. This command is more reliable because it is more specific.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re uncertain about the attribute path for a package, you can find it by searching the package in the [https://nixos.org/nixos/packages.html Nix Packages Search] page.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Where does Nix Package Manager install packages?&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you install a package using Nix, the package&#039;s files are installed into a directory in the Nix store, which is typically located at &#039;&#039;&#039;/nix/store&#039;&#039;&#039;. Each package gets its own unique directory in the Nix store, which includes a hash of the package&#039;s dependencies to ensure isolation and reproducibility.&lt;br /&gt;
&lt;br /&gt;
For example, if you install the &#039;&#039;&#039;pokemonsay&#039;&#039;&#039; package, you might end up with a directory like &#039;&#039;&#039;/nix/store/abcd1234-pokemonsay-0.0.1&#039;&#039;&#039; (the actual hash will be different).&lt;br /&gt;
&lt;br /&gt;
The binary executables of a package are typically located in the &#039;&#039;&#039;bin&#039;&#039;&#039; subdirectory of the package&#039;s directory in the Nix store. For example, the &#039;&#039;&#039;pokemonsay&#039;&#039;&#039; executable might be located at &#039;&#039;&#039;/nix/store/abcd1234-pokemonsay-0.0.1/bin/pokemonsay&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When you install a package with &#039;&#039;&#039;nix-env -i&#039;&#039;&#039;, Nix creates symlinks in your user profile (usually in &#039;&#039;&#039;/nix/var/nix/profiles&#039;&#039;&#039;) to the package&#039;s files in the Nix store. When you run a command like &#039;&#039;&#039;pokemonsay&#039;&#039;&#039;, your shell finds the &#039;&#039;&#039;pokemonsay&#039;&#039;&#039; executable through these symlinks.&lt;br /&gt;
&lt;br /&gt;
The result is that each user can have their own set of installed packages, and packages can be installed, upgraded, and removed atomically and without interfering with each other.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====using pokemonsay====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;pokemonsay&#039;&#039;&#039; is a fun little command line utility that generates an ASCII picture of a random Pokemon saying a message you provide. Here&#039;s how to use it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pokemonsay -p Pikachu &amp;quot;Greetings fellow Noob&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explain Syntax: &amp;lt;code&amp;gt;pokemonsay -p Pikachu &amp;quot;Greetings fellow Noob&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*    &#039;&#039;&#039;pokemonsay&#039;&#039;&#039; is the main command. It&#039;s the name of the program you&#039;re running. It generates an ASCII art image of a Pokémon saying a message.&lt;br /&gt;
&lt;br /&gt;
*    &#039;&#039;&#039;-p Pikachu&#039;&#039;&#039; is an option given to the pokemonsay command. The -p flag specifies that the next argument will be the name of the Pokémon you want to use. In this case, you&#039;re asking for Pikachu.&lt;br /&gt;
**   &#039;&#039;&#039;See list of Pokemon&#039;&#039;&#039; Use: &amp;lt;code&amp;gt;pokemonsay -l&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
*    &#039;&#039;&#039;&amp;quot;Greetings fellow Noob&amp;quot;&#039;&#039;&#039; is the message you&#039;re asking Pikachu to say. The quotes are used to group the words together into a single argument to the command. Without the quotes, each word would be treated as a separate argument, which is not what you want in this case.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pokemonsay --help&amp;lt;/code&amp;gt; for more info.&lt;br /&gt;
&lt;br /&gt;
===Upgrade a package===&lt;br /&gt;
&lt;br /&gt;
To upgrade a package installed with Nix, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-env -uA nixpkgs.pokemonsay&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-env -uA nixpkgs.pokemonsay&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The command &#039;&#039;&#039;nix-env -uA nixpkgs.pokemonsay&#039;&#039;&#039; is used to upgrade the pokemonsay package from the nixpkgs channel in Nix.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the command:&lt;br /&gt;
&lt;br /&gt;
: nix-env: This is the main command used for user environment management in Nix. It can install, upgrade, and remove software, among other tasks.&lt;br /&gt;
&lt;br /&gt;
: -uA: This is a combination of two options. -u stands for upgrade and -A stands for attribute. The -A option allows you to upgrade a package using its attribute path (nixpkgs.pokemonsay in this case), which is often more reliable than using the package name.&lt;br /&gt;
&lt;br /&gt;
: nixpkgs.pokemonsay: This is the attribute path of the package you want to upgrade. nixpkgs is the name of the channel, and pokemonsay is the name of the package in that channel.&lt;br /&gt;
&lt;br /&gt;
When you run &#039;&#039;&#039;nix-env -uA nixpkgs.pokemonsay&#039;&#039;&#039;, Nix will look for the pokemonsay package in the nixpkgs channel and upgrade it in your user environment.&lt;br /&gt;
&lt;br /&gt;
To upgrade all installed packages in your user environment, you can use the command &amp;lt;code&amp;gt;nix-env -u&amp;lt;/code&amp;gt; without specifying a package.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Check for updates===&lt;br /&gt;
&lt;br /&gt;
To check for updates to the packages installed on your system without actually installing them, you can use the `nix-env -u` command in &amp;quot;dry run&amp;quot; mode by including the `--dry-run` option. The command would look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-env -u --dry-run&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-env -u --dry-run&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;nix-env -u --dry-run&#039;&#039;&#039; command will list the updates available for the packages installed on your system without actually applying the updates.&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;nix-env&#039;&#039;&#039; : This is the main command used for user environment management in Nix.&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;-u&#039;&#039;&#039; : This flag stands for update. When used alone, it will update all installed packages to their latest versions. &lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;--dry-run&#039;&#039;&#039; : This option prevents the command from actually installing the updates. Instead, it just shows what updates would be installed if you ran the command without the --dry-run option.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List installed packages===&lt;br /&gt;
&lt;br /&gt;
To list the packages that you have installed using Nix, you can use the nix-env -q command. If you want to see more details, including the version number, you can use the --verbose flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-env -q --verbose&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-env -q --verbose&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;nix-env -q --verbose&#039;&#039;&#039; command lists all installed packages, showing their names and versions:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;nix-env&#039;&#039;&#039; : This is the main command used for user environment management in Nix. It can install, upgrade, and remove software, among other tasks.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;-q&#039;&#039;&#039; : This option stands for &amp;quot;query&amp;quot;. It lists the installed packages.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;--verbose&#039;&#039;&#039; : This option shows more detailed information, including the version number of each installed package.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Check for specific package version===&lt;br /&gt;
&lt;br /&gt;
To check the version of a specific package available in the Nix packages channel, you can use the `nix-env -qaP` command with a regex pattern matching the package name:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-env -qaP &#039;.*pokemonsay.*&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-env -qaP &#039;.*pokemonsay.*&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;nix-env -qaP &#039;.*pokemonsay.*&#039;&#039;&#039; command queries the Nix packages channel for available versions of &#039;pokemonsay&#039;, and shows the latest version that is available in the channel.&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;nix-env&#039;&#039;&#039; : This is the main command used for user environment management in Nix.&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;-qaP&#039;&#039;&#039; : These options stand for &amp;quot;query available --attr-path&amp;quot;. It queries the available packages in the Nix packages channel and shows their attribute paths and versions.&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;.*pokemonsay.*&#039;&#039;&#039; : This is a regex pattern matching the package name. It will match any package name that contains &#039;pokemonsay&#039;.&lt;br /&gt;
&lt;br /&gt;
::*    &#039;&#039;&#039;.*&#039;&#039;&#039;: This part of the pattern matches any number of any characters. The . means &amp;quot;any character&amp;quot;, and the * means &amp;quot;zero or more times&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
::*    &#039;&#039;&#039;pokemonsay&#039;&#039;&#039;&#039;: This is the sequence of characters that you want to find.&lt;br /&gt;
&lt;br /&gt;
::*    &#039;&#039;&#039;.*&#039;&#039;&#039;: This part of the pattern matches any number of any characters after &#039;pokemonsay&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Certainly, here&#039;s the formatted wiki entry:&lt;br /&gt;
&lt;br /&gt;
===Remove/Uninstall a Package===&lt;br /&gt;
&lt;br /&gt;
To remove or uninstall a package that you have installed using Nix, you can use the nix-env -e command followed by the package name:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-env -e pokemonsay&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-env -e pokemonsay&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
The &#039;&#039;&#039;nix-env -e pokemonsay&#039;&#039;&#039; command uninstalls the &#039;pokemonsay&#039; package from your user environment in Nix. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the command:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;nix-env&#039;&#039;&#039;: This is the main command used for user environment management in Nix.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;-e&#039;&#039;&#039;: This option stands for &amp;quot;erase&amp;quot;, which is used to remove a package.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;pokemonsay&#039;&#039;&#039;: This is the name of the package that you want to remove. You should use the same name format that nix-env -q uses when it lists your installed packages.&lt;br /&gt;
&lt;br /&gt;
After running this command, the &#039;pokemonsay&#039; package will be removed from your user environment.&lt;br /&gt;
&lt;br /&gt;
To confirm the package has been removed successfully, you can run the nix-env -q command again and you should not see the uninstalled package in the list of installed packages.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Troubleshooting: Uninstalling a Package&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
In case you encounter an error similar to the following:&lt;br /&gt;
&amp;lt;code&amp;gt;warning: selector &#039;nixpkgs.pokemonsay&#039; matched no installed derivations&amp;lt;/code&amp;gt;&lt;br /&gt;
This might mean that the package name you&#039;re trying to uninstall does not match exactly with the installed version. You should use the name format that appears when you list your installed packages with the `nix-env -q` command.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will only remove the package from your user environment. The package&#039;s files will remain in the Nix store (/nix/store) until you run a garbage collection operation, which you can do with the nix-collect-garbage command. This is because other users or profiles might still be using the package.&lt;br /&gt;
&lt;br /&gt;
The garbage collector in Nix works by deleting any packages from the Nix store that are no longer referenced by any profiles or by the Nix packages channel. This ensures that it&#039;s safe to delete the package: it won&#039;t break anything else that depends on it.&lt;br /&gt;
&lt;br /&gt;
===Using nix-shell for Temporary Environment===&lt;br /&gt;
&lt;br /&gt;
Nix-shell is a command that creates a temporary environment in your shell with certain packages available. The -p option allows you to specify the packages you want to include. For example, if you want to have gcc (the GNU Compiler Collection) available in your shell, you would use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nix-shell -p gcc&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Explanation: &amp;lt;code&amp;gt;nix-shell -p gcc&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;nix-shell -p gcc&#039;&#039;&#039; command creates a temporary environment with the specified packages available for use:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;nix-shell&#039;&#039;&#039; : This command creates a temporary shell environment. It&#039;s a feature of Nix that lets you create an isolated environment for your shell, where you can make certain packages available without affecting your global environment.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;-p gcc&#039;&#039;&#039; : The -p option specifies the packages you want to include in your temporary environment. In this case, &#039;gcc&#039; is specified, so the GNU Compiler Collection will be available in the temporary environment.&lt;br /&gt;
&lt;br /&gt;
This command doesn&#039;t affect your global environment or other shells. This feature is useful if you want to test a certain package or need to use different versions of packages for different projects. It can also help with scripting, since you can specify exactly which packages a script needs to run.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=445</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=445"/>
		<updated>2023-06-21T12:09:00Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* PayPal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Our Mission&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At CompleteNoobs, we believe in making computer science education open, accessible, and free for everyone. Our goal is to create a comprehensive platform that provides resources, tutorials, and courseware to hobbyists, sysadmins, teachers, students, and anyone interested in the field.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How Your Support Helps&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As a one-person team, working part-time to make ends meet while developing this project, your support means a lot. Your contributions will enable us to dedicate more time and resources to CompleteNoobs, ensuring that we can create a high-quality educational platform that benefits learners worldwide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Direct Bank transfer==&lt;br /&gt;
&lt;br /&gt;
closed for now&lt;br /&gt;
&lt;br /&gt;
==PayPal==&lt;br /&gt;
&lt;br /&gt;
closed for now&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;A Referral link to Vultr&#039;s -  Tell A Friend about Vultr and Earn up to $35 for referring clients!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://www.vultr.com/?ref=9053528-8H&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* Duplicate accounts not eligible. Referred customer must link a valid credit card or Paypal method to be eligible for the $100 credit. Unused portion of $100 credit expires after 14 days.&amp;lt;br&amp;gt;&lt;br /&gt;
Note: you need account to view this page on vultr, sum up below:https://my.vultr.com/referral/special/&amp;lt;br&amp;gt;&lt;br /&gt;
1. $35 earned for every new unique paid user you refer.&amp;lt;br&amp;gt;&lt;br /&gt;
2. The users you refer receive $100 to test out our platform*.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Referred users must be active for 14+ days and use at least $35 in payments to be counted as verified sales.&amp;lt;br&amp;gt;&lt;br /&gt;
4. Payouts are finalized and issued on the business day following the 1st and 15th of each month.&amp;lt;br&amp;gt;&lt;br /&gt;
5. Your referral link below uniquely identifies your account. Use this code when linking to Vultr.com and start earning today!&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=444</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=444"/>
		<updated>2023-06-21T12:08:48Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Direct Bank transfer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Our Mission&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At CompleteNoobs, we believe in making computer science education open, accessible, and free for everyone. Our goal is to create a comprehensive platform that provides resources, tutorials, and courseware to hobbyists, sysadmins, teachers, students, and anyone interested in the field.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How Your Support Helps&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As a one-person team, working part-time to make ends meet while developing this project, your support means a lot. Your contributions will enable us to dedicate more time and resources to CompleteNoobs, ensuring that we can create a high-quality educational platform that benefits learners worldwide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Direct Bank transfer==&lt;br /&gt;
&lt;br /&gt;
closed for now&lt;br /&gt;
&lt;br /&gt;
==PayPal==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;https://paypal.me/completenoobs&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;A Referral link to Vultr&#039;s -  Tell A Friend about Vultr and Earn up to $35 for referring clients!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://www.vultr.com/?ref=9053528-8H&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* Duplicate accounts not eligible. Referred customer must link a valid credit card or Paypal method to be eligible for the $100 credit. Unused portion of $100 credit expires after 14 days.&amp;lt;br&amp;gt;&lt;br /&gt;
Note: you need account to view this page on vultr, sum up below:https://my.vultr.com/referral/special/&amp;lt;br&amp;gt;&lt;br /&gt;
1. $35 earned for every new unique paid user you refer.&amp;lt;br&amp;gt;&lt;br /&gt;
2. The users you refer receive $100 to test out our platform*.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Referred users must be active for 14+ days and use at least $35 in payments to be counted as verified sales.&amp;lt;br&amp;gt;&lt;br /&gt;
4. Payouts are finalized and issued on the business day following the 1st and 15th of each month.&amp;lt;br&amp;gt;&lt;br /&gt;
5. Your referral link below uniquely identifies your account. Use this code when linking to Vultr.com and start earning today!&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=443</id>
		<title>COMPLETENOOBS FUNDING</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=COMPLETENOOBS_FUNDING&amp;diff=443"/>
		<updated>2023-06-13T09:55:05Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* GoFundMe */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Our Mission&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At CompleteNoobs, we believe in making computer science education open, accessible, and free for everyone. Our goal is to create a comprehensive platform that provides resources, tutorials, and courseware to hobbyists, sysadmins, teachers, students, and anyone interested in the field.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How Your Support Helps&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As a one-person team, working part-time to make ends meet while developing this project, your support means a lot. Your contributions will enable us to dedicate more time and resources to CompleteNoobs, ensuring that we can create a high-quality educational platform that benefits learners worldwide.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Direct Bank transfer==&lt;br /&gt;
&lt;br /&gt;
Noblemage LTD &amp;lt;br&amp;gt;&lt;br /&gt;
Account Number: &amp;lt;code&amp;gt;24243132&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Sort Code: &amp;lt;code&amp;gt;60 05 37&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
BIC: &amp;lt;code&amp;gt;NWBKGB2L&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
IBAN: &amp;lt;code&amp;gt;GB44NWBK60053724243132&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==PayPal==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;https://paypal.me/completenoobs&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==VPS services with affiliate link==&lt;br /&gt;
===Vultr.com===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re looking for a reliable VPS service, we&#039;ve been using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; for years and have been very happy with their service. By signing up through our referral link, you can also support CompleteNoobs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;A Referral link to Vultr&#039;s -  Tell A Friend about Vultr and Earn up to $35 for referring clients!&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://www.vultr.com/?ref=9053528-8H&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* Duplicate accounts not eligible. Referred customer must link a valid credit card or Paypal method to be eligible for the $100 credit. Unused portion of $100 credit expires after 14 days.&amp;lt;br&amp;gt;&lt;br /&gt;
Note: you need account to view this page on vultr, sum up below:https://my.vultr.com/referral/special/&amp;lt;br&amp;gt;&lt;br /&gt;
1. $35 earned for every new unique paid user you refer.&amp;lt;br&amp;gt;&lt;br /&gt;
2. The users you refer receive $100 to test out our platform*.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Referred users must be active for 14+ days and use at least $35 in payments to be counted as verified sales.&amp;lt;br&amp;gt;&lt;br /&gt;
4. Payouts are finalized and issued on the business day following the 1st and 15th of each month.&amp;lt;br&amp;gt;&lt;br /&gt;
5. Your referral link below uniquely identifies your account. Use this code when linking to Vultr.com and start earning today!&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Wiki_Basic_Syntax&amp;diff=441</id>
		<title>Wiki Basic Syntax</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Wiki_Basic_Syntax&amp;diff=441"/>
		<updated>2023-05-16T17:10:34Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Line Brake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
==Headings==&lt;br /&gt;
&lt;br /&gt;
Do Not use &amp;lt;code&amp;gt;=Level 1=&amp;lt;/code&amp;gt; Level one is for Page titles&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;==Level 2 heading==&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;===Level 3 heading===&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;====level 4 heading====&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;=====level 5 heading=====&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;======level 6 heading======&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Info boxes==&lt;br /&gt;
===expanding content===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
What you will like in title:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and of course the content when expanded.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;print &amp;quot;hello content&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
What you will like in title:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and of course the content when expanded.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;print &amp;quot;hello content&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Collapsing Content===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot; style=&amp;quot;width:400px; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight:bold;line-height:1.6;&amp;quot;&amp;gt;&lt;br /&gt;
Content title here&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
and here you place the content&lt;br /&gt;
&amp;lt;code&amp;gt;print(&amp;quot;hello world&amp;quot;);&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot; style=&amp;quot;width:400px; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight:bold;line-height:1.6;&amp;quot;&amp;gt;&lt;br /&gt;
Content title here&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
and here you place the content&lt;br /&gt;
&amp;lt;code&amp;gt;print(&amp;quot;hello world&amp;quot;);&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Markup==&lt;br /&gt;
&lt;br /&gt;
===Line Brake===&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Escape markup===&lt;br /&gt;
Escape wiki syntax markup&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;nowiki&amp;gt;escaped markup&amp;lt;/nowiki&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Code markup===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;print &amp;quot;hello world&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;print &amp;quot;hello world&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Customized colour &amp;lt;code&amp;gt;code&amp;lt;/code&amp;gt; text====&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;code style=&amp;quot;color: blue&amp;quot;&amp;gt;is this blue&amp;lt;/code&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code style=&amp;quot;color: blue&amp;quot;&amp;gt;is this blue&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Preforrmated context===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Preformatted content&lt;br /&gt;
10 print &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 goto 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
content&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Customized colour preformatted text====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Preformatted content&lt;br /&gt;
10 print &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 goto 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: red&amp;quot;&amp;gt;&lt;br /&gt;
Preformatted content&lt;br /&gt;
10 print &amp;quot;hello world&amp;quot;&lt;br /&gt;
20 goto 10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===BlockQuotes===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
This is &lt;br /&gt;
a block quote&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
This is &lt;br /&gt;
a block quote&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Many lined &amp;lt;br \&amp;gt;&lt;br /&gt;
block &amp;lt;br \&amp;gt;&lt;br /&gt;
quote &amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
Many lined &amp;lt;br \&amp;gt;&lt;br /&gt;
block &amp;lt;br \&amp;gt;&lt;br /&gt;
quote &amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===underlined===&lt;br /&gt;
&amp;lt;u&amp;gt;underlined&amp;lt;/u&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;u&amp;gt;underlined&amp;lt;/u&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===bold===&lt;br /&gt;
&amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&amp;lt;b&amp;gt;bold&amp;lt;/b&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
also three &amp;lt;code&amp;gt;&#039;&amp;lt;/code&amp;gt; on each side&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&#039;&#039;&#039;bold&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;bold&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Italic===&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&#039;&#039;italic&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&#039;&#039;italic&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===bold and italic===&lt;br /&gt;
Thats 5 &#039; each side&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&#039;&#039;&#039;&#039;&#039;Bold and italic&#039;&#039;&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Bold and italic&#039;&#039;&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&#039;&#039;&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Syntax highlighting===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
def quick_sort(arr):&lt;br /&gt;
	less = []&lt;br /&gt;
	pivot_list = []&lt;br /&gt;
	more = []&lt;br /&gt;
	if len(arr) &amp;lt;= 1:&lt;br /&gt;
		return arr&lt;br /&gt;
	else:&lt;br /&gt;
		pass&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
def quick_sort(arr):&lt;br /&gt;
	less = []&lt;br /&gt;
	pivot_list = []&lt;br /&gt;
	more = []&lt;br /&gt;
	if len(arr) &amp;lt;= 1:&lt;br /&gt;
		return arr&lt;br /&gt;
	else:&lt;br /&gt;
		pass&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Quick copy/paste&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Tables===&lt;br /&gt;
https://www.mediawiki.org/wiki/Help:Tables&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Dns&lt;br /&gt;
|-&lt;br /&gt;
|Type&lt;br /&gt;
|Host&lt;br /&gt;
|Ip address&lt;br /&gt;
|TTL&lt;br /&gt;
|-&lt;br /&gt;
|A record&lt;br /&gt;
|@&lt;br /&gt;
|12.34.56.78&lt;br /&gt;
|auto&lt;br /&gt;
|-&lt;br /&gt;
|A record&lt;br /&gt;
|www&lt;br /&gt;
|12.34.56.78&lt;br /&gt;
|auto&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Dns&lt;br /&gt;
|-&lt;br /&gt;
|Type&lt;br /&gt;
|Host&lt;br /&gt;
|Ip address&lt;br /&gt;
|TTL&lt;br /&gt;
|-&lt;br /&gt;
|A record&lt;br /&gt;
|@&lt;br /&gt;
|12.34.56.78&lt;br /&gt;
|auto&lt;br /&gt;
|-&lt;br /&gt;
|A record&lt;br /&gt;
|www&lt;br /&gt;
|12.34.56.78&lt;br /&gt;
|auto&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Internal Links===&lt;br /&gt;
Link to Page:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[PAGE_NAME]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Link to section:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[SECTION_NAME]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Link to Section on another page:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;nowiki&amp;gt;[[PAGE_NAME#SECTION | NAME_TO_DISPLAY]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Align===&lt;br /&gt;
&amp;lt;div style=&#039;text-align: left;&#039;&amp;gt;left aligned&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;div style=&#039;text-align: left;&#039;&amp;gt;left aligned&amp;lt;/div&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&#039;text-align: center;&#039;&amp;gt;center aligned&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;div style=&#039;text-align: center;&#039;&amp;gt;center aligned&amp;lt;/div&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&#039;text-align: right;&#039;&amp;gt;right aligned&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;div style=&#039;text-align: right;&#039;&amp;gt;right aligned&amp;lt;/div&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Youtube extension - Embed Video==&lt;br /&gt;
&lt;br /&gt;
* On wiki page&lt;br /&gt;
** https://www.youtube.com/watch?v=wB4gvSgYmfY&lt;br /&gt;
** After &#039;&#039;&#039;watch?v=&#039;&#039;&#039;&lt;br /&gt;
** &amp;lt;nowiki&amp;gt;&amp;lt;youtube&amp;gt;wB4gvSgYmfY&amp;lt;/youtube&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&amp;lt;youtube&amp;gt;wB4gvSgYmfY&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Defaults &#039;&#039;&#039;width&#039;&#039;&#039;=640 pixels &#039;&#039;&#039;height&#039;&#039;&#039;=385 pixels&lt;br /&gt;
* Change defaults &amp;lt;nowiki&amp;gt;&amp;lt;youtube width=&amp;quot;800&amp;quot; height=&amp;quot;400&amp;quot;&amp;gt;wB4gvSgYmfY&amp;lt;/youtube&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;youtube width=&amp;quot;800&amp;quot; height=&amp;quot;400&amp;quot;&amp;gt;wB4gvSgYmfY&amp;lt;/youtube&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=440</id>
		<title>Ubuntu 22.04 SSH Guide</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=440"/>
		<updated>2023-05-16T12:14:21Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Key-based Authentication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Understanding SSH==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SSH&#039;&#039;&#039; is a protocol that uses encryption to secure data transmitted between a client and a server. &amp;lt;br&amp;gt;&lt;br /&gt;
It enables users to execute commands, transfer files, and manage remote systems through an encrypted channel. &amp;lt;br&amp;gt;&lt;br /&gt;
SSH is widely used by system administrators for managing servers, network devices, and other remote systems.&lt;br /&gt;
&lt;br /&gt;
==Installing SSH==&lt;br /&gt;
&lt;br /&gt;
To start using SSH, you&#039;ll need to install and configure both the server and client components.&lt;br /&gt;
&lt;br /&gt;
* OpenSSH-Server&lt;br /&gt;
** Is required to allow &#039;&#039;&#039;ssh&#039;&#039;&#039; connections&lt;br /&gt;
* OpenSSH-Client&lt;br /&gt;
** Is used to login/connect to OpenSSH-Server&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Desktop, the &#039;&#039;&#039;openssh client&#039;&#039;&#039; will be preinstalled, allowing you to connect to a server which is running &#039;&#039;&#039;openssh-server&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Server, both the &#039;&#039;&#039;ssh client&#039;&#039;&#039; and &#039;&#039;&#039;openssh server&#039;&#039;&#039; are preinstalled by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing OpenSSH Server===&lt;br /&gt;
On Ubuntu distributions, you can install the OpenSSH server by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install openssh-server&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the SSH server status with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl status ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Installing OpenSSH Client===&lt;br /&gt;
&lt;br /&gt;
The OpenSSH client is usually pre-installed on most Linux and macOS systems. &amp;lt;br&amp;gt;For Windows, you can install the OpenSSH client by following the instructions on the official website:&amp;lt;br&amp;gt; https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse&lt;br /&gt;
&lt;br /&gt;
==Basic SSH Commands and Usage==&lt;br /&gt;
=== Connecting to a remote server===&lt;br /&gt;
Connecting to a remote server using SSH is a fundamental task when managing remote systems. Here&#039;s how to connect to a remote server using the command-line interface.&lt;br /&gt;
&lt;br /&gt;
Install an SSH client: Ensure you have an SSH client installed on your local machine. Most Unix-based systems, including Linux and macOS, have an SSH client pre-installed. For Windows, you can use the built-in OpenSSH client (available in Windows 10 and later) or a third-party client like PuTTY.&lt;br /&gt;
&lt;br /&gt;
====Gather connection information====&lt;br /&gt;
To connect to a remote server, you&#039;ll need the following information:&lt;br /&gt;
* The remote server&#039;s IP address or hostname&lt;br /&gt;
* The SSH port number (default is 22)&lt;br /&gt;
* Your username on the remote server&lt;br /&gt;
* The password for the user on remote server.&lt;br /&gt;
&lt;br /&gt;
====Connect using SSH====&lt;br /&gt;
Open a terminal or command prompt on your local machine and use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;username&#039;&#039;&#039; with your username on the remote server, &#039;&#039;&#039;hostname_or_IP&#039;&#039;&#039; with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
If OpenSSH-Server is running/listening on a port other than the default port &#039;&#039;&#039;22&#039;&#039;&#039; include the port with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag.&lt;br /&gt;
&lt;br /&gt;
For example (If port 2222):&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh john@example.com -p 2222&amp;lt;/code&amp;gt;&lt;br /&gt;
Or&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh -p 2222 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Connecting to a Remote Server =====&lt;br /&gt;
&lt;br /&gt;
In this example, we connect to a remote Ubuntu VPS with the following credentials:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Username: root&lt;br /&gt;
    IP address: 12.34.56.78&lt;br /&gt;
    Password: password2simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password. Type password2simple and press Enter. This demonstrates how simple it can be to log into a remote computer with root access.&lt;br /&gt;
&lt;br /&gt;
* If your Server is hosting SSHD on a port other than default &#039;port 22&#039; include port number with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag&lt;br /&gt;
Example with port 2222:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -p 2222 root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Authenticate====&lt;br /&gt;
When connecting for the first time, you&#039;ll see a prompt asking you to confirm the remote server&#039;s fingerprint. Verify the fingerprint and type &amp;quot;yes&amp;quot; to proceed. Next, you&#039;ll be prompted for your password. Enter your password to complete the authentication process.&lt;br /&gt;
&lt;br /&gt;
Once authenticated, you&#039;ll have access to the remote server&#039;s command line. You can now execute commands and manage the remote server as if you were working on it directly.&lt;br /&gt;
&lt;br /&gt;
Remember that you can use key-based authentication (with a private-public key pair) instead of a password for a more secure and convenient connection method.&lt;br /&gt;
== Using SSH config file==&lt;br /&gt;
&lt;br /&gt;
An SSH config file allows you to define and manage multiple SSH connections, simplifying the process of connecting to remote servers. By creating an SSH config file, you can define custom options, such as port numbers, usernames, and key files, for each connection. The SSH config file is typically located in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory and named config.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to create and use an SSH config file:&lt;br /&gt;
&lt;br /&gt;
:*    Create the SSH config file: If it doesn&#039;t exist, create the config file in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory using a text editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Define a connection: To define a connection, you&#039;ll need to specify a Host entry followed by any options you want to apply to that connection. Here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server1&lt;br /&gt;
  HostName example.com&lt;br /&gt;
  User your_username&lt;br /&gt;
  Port 2222&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this example, we&#039;ve defined a connection called server1 with the following options:&lt;br /&gt;
&lt;br /&gt;
:*    HostName: The hostname or IP address of the remote server (example.com in this case).&lt;br /&gt;
:*    User: The username to use when connecting to the remote server (replace your_username with your actual username).&lt;br /&gt;
:*    Port: The port number to use for the SSH connection (2222 in this example).&lt;br /&gt;
:*    IdentityFile: The path to the private key file to use for authentication (replace ~/.ssh/id_rsa_server1 with the path to your private key file).&lt;br /&gt;
&lt;br /&gt;
You can define multiple connections in the same config file by creating separate Host entries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server2&lt;br /&gt;
  HostName 192.168.1.100&lt;br /&gt;
  User another_username&lt;br /&gt;
  Port 22&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Connect using the SSH config file: To connect to a remote server using the defined connection, simply use the ssh command followed by the Host entry:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, SSH will automatically use the options defined in the config file for server1, such as the hostname, username, port number, and identity file.&lt;br /&gt;
&lt;br /&gt;
By using an SSH config file, you can simplify the process of managing multiple SSH connections and customize the options for each connection.&lt;br /&gt;
&lt;br /&gt;
==Key-based Authentication==&lt;br /&gt;
&lt;br /&gt;
Why use key-based authentication?&lt;br /&gt;
* Server1: 12.34.56.78&lt;br /&gt;
* Server2: 12.34.56.87&lt;br /&gt;
&lt;br /&gt;
You are trying to login to Server1 (Your Server), but by mistake you enter your &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; to Server2 (Foo&#039;s Server), Can Server2 record the &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; you used?&lt;br /&gt;
[[Ubuntu_18.04_OpenSSH-Server_Capture_Failed_Passwords|YES, Yes it can]] &lt;br /&gt;
&lt;br /&gt;
=== Generating SSH key pairs===&lt;br /&gt;
&lt;br /&gt;
SSH key pairs consist of a private key and a public key. They provide a secure, passwordless authentication method for connecting to remote servers. The private key remains on your local machine, while the public key is added to the remote server&#039;s authorized keys. Here&#039;s how to generate an SSH key pair:&lt;br /&gt;
&lt;br /&gt;
Open a terminal: On Unix-based systems (Linux and macOS), open a terminal. On Windows, open PowerShell or the Command Prompt.&lt;br /&gt;
&lt;br /&gt;
Generate the key pair: Use the ssh-keygen command to create a new SSH key pair. The following command generates a 4096-bit RSA key pair:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also generate other types of keys, such as Ed25519, by changing the -t option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t ed25519&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specify the key&#039;s location: When prompted, you can either accept the default location (~/.ssh/id_rsa for RSA keys, ~/.ssh/id_ed25519 for Ed25519 keys) or enter a custom path. It is recommended to use the default location unless you have a specific reason to change it.&lt;br /&gt;
&lt;br /&gt;
Set a passphrase (optional): You can choose to protect your private key with a passphrase. If you do, you&#039;ll need to enter the passphrase every time you use the key. This adds an extra layer of security, but can be less convenient for automation or scripting. To set a passphrase, enter it when prompted; otherwise, leave the field blank&lt;br /&gt;
&lt;br /&gt;
====Selecting file name and path for keys====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option in the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command is used to specify the output file for the generated key pair. In your example, &#039;&#039;&#039;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&#039;&#039;&#039;, the command is generating an RSA key pair with a key length of 4096 bits, and the output files will be saved in the &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory with the base name &#039;&#039;&#039;nuc&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the options used in this command:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-f .ssh/nuc&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039; and the public key in &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Create keys with no passphase====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -N &amp;quot;&amp;quot; -C &amp;quot;MYSERVER&amp;quot; -f ~/.ssh/serverkey&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-N &amp;quot;&amp;quot;&#039;&#039;&#039;: Specifies an empty passphrase for the key pair. This means that the private key will not be encrypted, and no passphrase will be required when using it. This can be less secure, but more convenient for automated processes.&lt;br /&gt;
:*    &#039;&#039;&#039;-C &amp;quot;MYSERVER&amp;quot;&#039;&#039;&#039;: Adds a comment to the generated key pair. In this case, the comment is &amp;quot;MYSERVER&amp;quot;. Comments are useful for identifying keys when you have multiple keys in your ~/.ssh directory or on a remote server.&lt;br /&gt;
:*    &#039;&#039;&#039;-f ~/.ssh/serverkey&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039; and the public key in &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;. The private key will have an empty passphrase and a comment &amp;quot;MYSERVER&amp;quot; for easier identification.&lt;br /&gt;
&lt;br /&gt;
====Remove the passphrase from an existing SSH private key====&lt;br /&gt;
&lt;br /&gt;
To remove the passphrase from an existing SSH private key, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, which is used for changing the passphrase. Follow these steps:&lt;br /&gt;
&lt;br /&gt;
:*    Make a backup of your private key file, just in case something goes wrong during the process. You can do this by running the following command, replacing &#039;&#039;&#039;&amp;lt;your_private_key&amp;gt;&#039;&#039;&#039; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
::**     &#039;&#039;&#039;-p&#039;&#039;&#039;: Indicates that you want to change the passphrase of an existing private key.&lt;br /&gt;
::**    &#039;&#039;&#039;-f &amp;lt;your_private_key&amp;gt;&#039;&#039;&#039;: Specifies the private key file whose passphrase you want to change.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    You will be prompted to enter the old passphrase for the private key. Type it in and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Since you want to remove the passphrase, leave this field empty and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the empty passphrase. Press Enter again to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has its passphrase removed. Keep in mind that this makes the private key less secure, as anyone with access to the file can use it without needing to know the passphrase.&lt;br /&gt;
&lt;br /&gt;
====Add/Change a passphrase to an existing SSH Key====&lt;br /&gt;
&lt;br /&gt;
To add a passphrase to an existing SSH private key that doesn&#039;t have one, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, just like when you change or remove a passphrase. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;Make a backup of your private key file&#039;&#039;&#039;, just in case something goes wrong during the process. You can do this by running the following command, replacing &amp;lt;your_private_key&amp;gt; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the -p option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*   You will be prompted to enter the old passphrase for the private key. Since your private key doesn&#039;t currently have a passphrase, just press Enter to proceed.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Type in the passphrase you want to set for the private key and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the new passphrase. Type it again and press Enter to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has a passphrase added to it. This provides an extra layer of security, as anyone using the key will need to know the passphrase to access it. Keep in mind that you should use a strong passphrase to ensure better security.&lt;br /&gt;
&lt;br /&gt;
=== Copying public keys to the remote server===&lt;br /&gt;
After generating an SSH key pair, you&#039;ll need to copy the public key to the remote server to enable key-based authentication. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
====Using ssh-copy-id====&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;ssh-copy-id&#039;&#039;&#039; command (Linux and macOS): On Unix-based systems, you can use the ssh-copy-id command to copy your public key to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ~/.ssh/id_rsa.pub with the path to your public key file (e.g., ~/.ssh/id_ed25519.pub for Ed25519 keys), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
====Manually copy the public key====&lt;br /&gt;
&lt;br /&gt;
Manually copy the public key (Windows and alternative method): If you don&#039;t have access to the ssh-copy-id command or prefer to do it manually, you can:&lt;br /&gt;
&lt;br /&gt;
:* Open your public key file (e.g., id_rsa.pub or id_ed25519.pub) with a text editor and copy its content.&amp;gt;&lt;br /&gt;
:* Log in to the remote server via SSH.&amp;lt;br&amp;gt;&lt;br /&gt;
:* Create the ~/.ssh directory if it doesn&#039;t exist:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit or create the ~/.ssh/authorized_keys file using a text editor (e.g., nano, vim, or emacs), and paste the content of your public key at the end of the file. Save and close the file.&lt;br /&gt;
&lt;br /&gt;
Set the correct file permissions: To ensure the security of your SSH setup, it&#039;s essential to set the proper file permissions on your local machine and the remote server:&lt;br /&gt;
&lt;br /&gt;
:* On your local machine:&lt;br /&gt;
:**       Private key (id_rsa or id_ed25519): -rw------- (600)&lt;br /&gt;
:**       Public key (id_rsa.pub or id_ed25519.pub): -rw-r--r-- (644)&lt;br /&gt;
&lt;br /&gt;
:*    On the remote server:&lt;br /&gt;
:**        ~/.ssh directory: drwx------ (700)&lt;br /&gt;
:**        ~/.ssh/authorized_keys file: -rw------- (600)&lt;br /&gt;
&lt;br /&gt;
To set the permissions on your local machine, use the chmod command:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
chmod 644 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On the remote server, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 700 ~/.ssh&lt;br /&gt;
chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you&#039;ve copied your public key to the remote server and set the correct file permissions, you should be able to connect using key-based authentication without the need for a password.&lt;br /&gt;
&lt;br /&gt;
=== Disabling password authentication (optional)===&lt;br /&gt;
Disabling password authentication enhances the security of your SSH server by requiring key-based authentication for all connections. You can disable password authentication for specific users or for all users. To do so, follow these steps:&lt;br /&gt;
&lt;br /&gt;
:* Connect to the remote server: Log in to the remote server via SSH using your username and the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:* Edit the SSH configuration file: Open the SSH server configuration file (usually located at /etc/ssh/sshd_config) with a text editor such as nano, vim, or emacs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for all users: Find the line containing &amp;quot;PasswordAuthentication&amp;quot; and set its value to &amp;quot;no&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol.&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for a specific user: To disable password authentication only for a particular user, you can use a &amp;quot;Match User&amp;quot; block at the end of the sshd_config file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User username&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Replace username with the actual username for which you want to disable password authentication.&lt;br /&gt;
&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, password authentication will be disabled for the specified user(s), and only key-based authentication will be allowed. Remember that if you disable password authentication, you must have a working SSH key pair set up to access the server, or you may be locked out.&lt;br /&gt;
&lt;br /&gt;
== Configuring the SSH server==&lt;br /&gt;
&lt;br /&gt;
Edit the SSH server configuration file located at &amp;lt;b&amp;gt;/etc/ssh/sshd_config&amp;lt;/b&amp;gt; to set your desired settings. You can modify options like the listening port, allowing root login, and more.&lt;br /&gt;
&lt;br /&gt;
===Common sshd_config Options===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file is located at &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; on most Linux systems. This file contains various options and settings that determine the behavior of the OpenSSH server. Each option is followed by its value, and lines starting with a &amp;lt;b&amp;gt;#&amp;lt;/b&amp;gt; are considered comments.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an overview of some common options in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
===Port===&lt;br /&gt;
&lt;br /&gt;
Specifies the port number that the SSH server listens on.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Port 22&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AddressFamily===&lt;br /&gt;
&lt;br /&gt;
Determines the IP address family (IPv4, IPv6, or both) used by the SSH server.&lt;br /&gt;
&lt;br /&gt;
* To specify that the SSH server should only listen for incoming IPv4 connections:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Or, if you want the SSH server to only listen for incoming IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;inet6&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to allow both IPv4 and IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;any&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily any&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ListenAddress===&lt;br /&gt;
Specifies the IP address(es) the SSH server listens on. By default, it listens on all available addresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ListenAddress 192.168.1.10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Protocol===&lt;br /&gt;
Defines the SSH protocol version. It&#039;s recommended to use only protocol 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Protocol 2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PermitRootLogin===&lt;br /&gt;
Controls whether root login is allowed. It&#039;s generally advised to disable root login or set it to &amp;quot;without-password&amp;quot; to allow only key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitRootLogin no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===PasswordAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables password-based authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PubkeyAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PubkeyAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AuthorizedKeysFile===&lt;br /&gt;
Specifies the location of the authorized keys file for public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;AuthorizedKeysFile .ssh/authorized_keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LogLevel===&lt;br /&gt;
Sets the logging level for the SSH server.&lt;br /&gt;
&lt;br /&gt;
The LogLevel option in &#039;&#039;&#039;sshd_config&#039;&#039;&#039; controls the amount of information that SSH daemon (sshd) logs.&lt;br /&gt;
&lt;br /&gt;
There are different log levels that can be set with this option, each providing a different level of detail:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;QUIET&#039;&#039;&#039;: Disables all logging.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;FATAL&#039;&#039;&#039;: Only logs fatal errors.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;ERROR&#039;&#039;&#039;: Logs error messages.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;INFO&#039;&#039;&#039;: Logs informational messages such as login attempts.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VERBOSE&#039;&#039;&#039;: Logs more detailed information than INFO, including shell commands executed.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEBUG&#039;&#039;&#039;: Logs detailed debugging information, including raw protocol details.&lt;br /&gt;
&lt;br /&gt;
The default log level is &#039;&#039;&#039;INFO&#039;&#039;&#039;, which is usually sufficient for most purposes. However, if you need to troubleshoot SSH connections or monitor user activity, setting a higher log level may be helpful.&lt;br /&gt;
&lt;br /&gt;
To change the &#039;&#039;&#039;LogLevel&#039;&#039;&#039; in &#039;&#039;&#039;sshd_config&#039;&#039;&#039;, you can edit the file &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; (or the appropriate configuration file for your system), and add or modify the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel &amp;lt;log_level&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;log_level&amp;gt; is one of the log levels listed above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel INFO&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LoginGraceTime===&lt;br /&gt;
&lt;br /&gt;
Defines the time allowed for a user to successfully log in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LoginGraceTime 2m&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MaxAuthTries===&lt;br /&gt;
&lt;br /&gt;
Limits the number of authentication attempts allowed per connection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxAuthTries 6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MaxSessions===&lt;br /&gt;
&lt;br /&gt;
Specifies the maximum number of simultaneous sessions allowed per network connection.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxSessions 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AllowUsers, DenyUsers, AllowGroups, DenyGroups===&lt;br /&gt;
&lt;br /&gt;
These options control which users and groups are allowed or denied access to the SSH server. They provide a way to manage access control based on usernames and group membership.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;: Specifies a list of users allowed to access the SSH server. Other users will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowUsers user1 user2 user3&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;: Specifies a list of users denied access to the SSH server. Other users will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyUsers user4 user5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;: Specifies a list of groups whose members are allowed to access the SSH server. Users not belonging to these groups will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowGroups group1 group2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;: Specifies a list of groups whose members are denied access to the SSH server. Users not belonging to these groups will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyGroups group3 group4&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the order in which these options are applied is &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;, &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;, &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;, and finally &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Banner===&lt;br /&gt;
&lt;br /&gt;
The Banner option allows you to display a message or warning to users before they log in to the SSH server. This is often used to display legal notices, security warnings, or other important information.&lt;br /&gt;
&lt;br /&gt;
To enable the banner, set the Banner option to the path of a text file containing the message you want to display:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Banner /etc/ssh/banner.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create the /etc/ssh/banner.txt file and add your desired message. The content of this file will be displayed to users before they log in.&lt;br /&gt;
&lt;br /&gt;
==Advanced sshd_config Options==&lt;br /&gt;
=== PermitTunnel===&lt;br /&gt;
The PermitTunnel option enables or disables the use of SSH tunneling. Tunnels can be used to forward ports or create VPN-like connections between the client and the server. &lt;br /&gt;
* There are four possible values for this option:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;yes&amp;quot;&#039;&#039;&#039;: Allows all types of tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;point-to-point&amp;quot;&#039;&#039;&#039;: Allows only point-to-point (Layer 3) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;ethernet&amp;quot;&#039;&#039;&#039;: Allows only Ethernet (Layer 2) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;no&amp;quot;&#039;&#039;&#039;: Disables tunneling (default).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable tunneling, set the PermitTunnel option in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitTunnel yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keep in mind that enabling tunnels may expose your server to additional security risks. Only enable this option if you understand the implications and have a specific use case that requires it.&lt;br /&gt;
&lt;br /&gt;
=== ChrootDirectory===&lt;br /&gt;
The ChrootDirectory option allows you to restrict a user or a group to a specific directory (known as a chroot jail) when they log in via SSH. This can enhance security by isolating users and limiting their access to only the necessary parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
To set up a chroot jail, follow these steps:&lt;br /&gt;
&lt;br /&gt;
Create a directory that will serve as the chroot jail. For example, let&#039;s create a directory for user1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the ownership of the directory to the user and their primary group:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown user1:user1 /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ChrootDirectory for user1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ChrootDirectory /home/user1/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, they will be restricted to the /home/user1/chroot directory and won&#039;t be able to access other parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
Note that the chroot jail should be owned by root and not writable by the user. If you need to provide write access to specific directories, create subdirectories inside the chroot jail and set appropriate permissions for those. Also, some features like SFTP may require additional configuration within the chroot jail.&lt;br /&gt;
&lt;br /&gt;
===ForceCommand===&lt;br /&gt;
The ForceCommand option allows you to specify a command that will be executed when a user logs in via SSH, regardless of the command requested by the user. This can be useful for limiting the actions a user can perform or for automatically running specific tasks upon login.&lt;br /&gt;
&lt;br /&gt;
To use the ForceCommand option, follow these steps:&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ForceCommand for a specific user or group. For example, to force user1 to execute the command /usr/bin/my-command upon login:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ForceCommand /usr/bin/my-command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, the /usr/bin/my-command will be executed automatically, and they will not be able to run any other command.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that using ForceCommand may limit the user&#039;s ability to interact with the server or transfer files via SFTP. Make sure to test and verify the functionality for your specific use case.&lt;br /&gt;
&lt;br /&gt;
=== Match Blocks===&lt;br /&gt;
&lt;br /&gt;
Match blocks in the sshd_config file allow you to apply specific configuration options based on certain criteria, such as the user, group, address, or host. This enables you to create custom rules and settings for different users, groups, or connections.&lt;br /&gt;
&lt;br /&gt;
Match block syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match criteria&lt;br /&gt;
  Option value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are some examples of Match blocks and their usage:&lt;br /&gt;
&lt;br /&gt;
Apply settings only for a specific user:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
  AllowTcpForwarding yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication and enables TCP forwarding only for user1.&lt;br /&gt;
&lt;br /&gt;
Apply settings for multiple users:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1,user2&lt;br /&gt;
  ChrootDirectory /home/%u/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration sets the chroot directory for both user1 and user2.&lt;br /&gt;
&lt;br /&gt;
Apply settings for a specific group:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Group group1&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration enables password authentication only for members of group1.&lt;br /&gt;
&lt;br /&gt;
Apply settings based on the client&#039;s IP address:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication for clients connecting from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Combine multiple criteria:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1 Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This configuration enables password authentication only for user1 when they connect from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Remember to restart the SSH server after making changes to the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match blocks offer flexibility in customizing your SSH server&#039;s configuration based on various criteria. Use them wisely to enhance security and optimize your server&#039;s settings.&lt;br /&gt;
&lt;br /&gt;
==Best Practices and Tips &#039;&#039;&#039;sshd_config&#039;&#039;&#039;==&lt;br /&gt;
When configuring your &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file, it&#039;s essential to follow best practices to ensure the security and stability of your SSH server. Here are some recommendations and tips:&lt;br /&gt;
&lt;br /&gt;
:*   Keep the server up-to-date: Always update your SSH server software and the underlying operating system to ensure you have the latest security patches and features.&lt;br /&gt;
&lt;br /&gt;
:*    Use strong authentication: Enable key-based authentication (PubkeyAuthentication) and consider disabling password authentication (PasswordAuthentication) to reduce the risk of brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
:*    Limit root access: Set &amp;quot;PermitRootLogin&amp;quot; to &amp;quot;no&amp;quot; or &amp;quot;without-password&amp;quot; to prevent direct root login or require key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
:*    Use non-standard ports: Change the default SSH port (22) to a non-standard port to reduce the exposure to automated scans and attacks. Keep in mind this is security through obscurity and should be combined with other security measures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Restrict user access&#039;&#039;&#039;: Use &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; and &amp;quot;DenyGroups&amp;quot; options to control which users and groups can access the SSH server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Monitor logs&#039;&#039;&#039;: Regularly check your SSH server logs for any suspicious activity or failed login attempts. Adjust the &amp;quot;LogLevel&amp;quot; setting in sshd_config as needed.&lt;br /&gt;
* Default Log Path Ubuntu 22.04: &#039;&#039;&#039;/var/log/auth.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use chroot jails&#039;&#039;&#039;: Isolate users by creating chroot jails using the &amp;quot;ChrootDirectory&amp;quot; option, especially when providing SFTP access or when users don&#039;t require full access to the server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configure connection settings&#039;&#039;&#039;: Set appropriate values for &amp;quot;LoginGraceTime&amp;quot; and &amp;quot;MaxAuthTries&amp;quot; to limit the time allowed for successful login and the number of authentication attempts per connection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use a strong firewall&#039;&#039;&#039;: Configure your server&#039;s firewall to only allow SSH connections from trusted IP addresses or networks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Regularly review and audit&#039;&#039;&#039;: Periodically review your sshd_config settings and make adjustments as necessary. Keep up-to-date with SSH security best practices and recommendations.&lt;br /&gt;
&lt;br /&gt;
By following these best practices and tips, you can enhance the security and performance of your SSH server, protecting it from unauthorized access and potential attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting sshd_config Issues===&lt;br /&gt;
&lt;br /&gt;
When encountering problems with your SSH server configuration, it&#039;s important to know how to diagnose and resolve issues. Here are some common problems and troubleshooting steps:&lt;br /&gt;
&lt;br /&gt;
Check syntax and configuration errors: If the SSH server is not starting or not functioning as expected, check the sshd_config file for any syntax or configuration errors. Use the following command to test the configuration file for errors:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sshd -t&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are any issues, the command will provide error messages with information on what needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
Review log files: Inspect the SSH server log files for any error messages or relevant information. The location of the log files may vary depending on your system, but common locations are /var/log/auth.log or /var/log/secure. Tail the log file while attempting to connect to get real-time information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo tail -f /var/log/auth.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server&lt;br /&gt;
&lt;br /&gt;
Check firewall settings: Ensure that the server&#039;s firewall is allowing SSH connections on the correct port. If you changed the default SSH port, update your firewall rules accordingly.&lt;br /&gt;
&lt;br /&gt;
Verify user permissions: If a specific user is unable to connect, check the user&#039;s permissions, home directory, and the settings in the sshd_config file, such as &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; or &amp;quot;DenyGroups.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SSH server from a client, use the verbose mode to get more detailed information about the connection process. This can help identify any issues with authentication or configuration. Run the following command to enable verbose mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -v user@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user@example.com&amp;quot; with the appropriate username and server address. You can increase the verbosity level by adding more &amp;quot;v&amp;quot; characters (e.g., -vv or -vvv) if needed.&lt;br /&gt;
&lt;br /&gt;
Check file permissions: Ensure that the file permissions for the user&#039;s home directory, the .ssh directory, and the authorized_keys file are set correctly. The user&#039;s home directory should not be writable by other users, the .ssh directory should have permissions set to 700 (drwx------), and the authorized_keys file should have permissions set to 600 (-rw-------).&lt;br /&gt;
&lt;br /&gt;
Test network connectivity: If you&#039;re unable to connect to the SSH server, verify that you can reach the server on the network. Use tools like ping, traceroute, or telnet to check the connection to the server and the specific SSH port.&lt;br /&gt;
&lt;br /&gt;
By following these troubleshooting steps, you should be able to diagnose and resolve most issues related to the sshd_config file and the SSH server configuration. Remember to carefully review the settings in your sshd_config file and consult the server logs for additional information when encountering problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====After making changes, restart the SSH server:====&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running commands on a remote server==&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve connected to a remote server using SSH, you can execute commands on the remote machine just as you would on your local system. However, you can also run commands on a remote server without establishing an interactive SSH session. &lt;br /&gt;
&lt;br /&gt;
This can be useful for automation, scripting, or quick tasks. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
Use the SSH command: To run a command on a remote server without entering an interactive session, use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP -p port &#039;command&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, port with the SSH port number (if different from the default 22), and command with the command you want to execute.&lt;br /&gt;
&lt;br /&gt;
For example, to list the contents of the remote server&#039;s home directory, you can use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 22 &#039;ls -la&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Handling multiple commands===&lt;br /&gt;
If you need to execute multiple commands, you can chain them together using a &#039;&#039;&#039;semicolon&#039;&#039;&#039; or &#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The semicolon allows you to run multiple commands sequentially, while the &amp;amp;&amp;amp; operator runs the next command only if the previous command was successful.&lt;br /&gt;
&lt;br /&gt;
For example, to update the package list and then upgrade the packages on a remote Ubuntu server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 2222 &#039;sudo apt-get update; sudo apt-get upgrade -y&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Command output:&lt;br /&gt;
The output of the command will be displayed in your local terminal, just as if you were running the command on your local machine. Using key-based authentication&lt;br /&gt;
&lt;br /&gt;
==Transferring files with SCP==&lt;br /&gt;
&lt;br /&gt;
The Secure Copy Protocol (SCP) is a useful tool for transferring files between your local machine and a remote server using SSH. SCP ensures that the data is encrypted during transit, providing a secure and efficient way to transfer files.&lt;br /&gt;
&lt;br /&gt;
===Install an SCP client=== &lt;br /&gt;
&lt;br /&gt;
Most Unix-based systems, including Linux and macOS, have an SCP client pre-installed. For Windows, you can use the built-in SCP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from your local machine to a remote server===&lt;br /&gt;
&lt;br /&gt;
To copy a file from your local machine to a remote server, use the following command:&lt;br /&gt;
* Note the use of the upper case &#039;&#039;&#039;-P&#039;&#039;&#039; for ports with &#039;&#039;&#039;scp&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port local_file_path username@hostname_or_IP:remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), local_file_path with the path to the file on your local machine, username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, and remote_file_path with the desired location on the remote server.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 22 /home/john/documents/report.pdf john@example.com:/home/john/reports/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the local machine to the &amp;quot;reports&amp;quot; directory on the remote server.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from a remote server to your local machine===&lt;br /&gt;
To copy a file from a remote server to your local machine, use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port username@hostname_or_IP:remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, remote_file_path with the path to the file on the remote server, and local_file_path with the desired location on your local machine.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 2222 john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
: Or&lt;br /&gt;
&amp;lt;code&amp;gt;scp john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;-&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the remote server&#039;s &amp;quot;reports&amp;quot; directory to the &amp;quot;documents&amp;quot; directory on your local machine.&lt;br /&gt;
&lt;br /&gt;
===Transferring directories=== &lt;br /&gt;
&lt;br /&gt;
To transfer an entire directory, use the &#039;&#039;&#039;-r&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port local_directory_path username@hostname_or_IP:remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, to copy a directory from the remote server to your local machine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port username@hostname_or_IP:remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using SCP is a convenient and secure way to transfer files between your local machine and a remote server. It leverages the security of the SSH protocol to ensure that your data remains encrypted during transit.&lt;br /&gt;
&lt;br /&gt;
===Transferring from Remote Computer to Remote Computer===&lt;br /&gt;
&lt;br /&gt;
Copy the file &#039;&#039;&#039;stuff.txt&#039;&#039;&#039; from remote host &#039;&#039;&#039;12.34.56.67&#039;&#039;&#039; to host &#039;&#039;&#039;11.22.33.44&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.67:/home/user/Documents/stuff.txt name@11.22.33.44:/home/user/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;&#039;-3&#039;&#039;&#039; flag copies between two remote hosts &amp;quot;12.34.56.67&amp;quot; and &amp;quot;11.22.33.44&amp;quot; are transferred through the local host running the command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -3 name@12.34.56.67:/home/user/Documents/stuff.txt \ name@11.22.33.44:/home/user/Documents/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Transferring multiple files===&lt;br /&gt;
&lt;br /&gt;
Send files foo.txt and bar.txt to remote.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp foo.txt bar.txt user@12.34.56.78:~/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from remote &amp;quot;Documents&amp;quot; directory to local &amp;quot;Documents&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp user@11.22.33.44:/home/user/Documents/\{todo_list.txt,links.txt,stuff.txt\} /home/$USER/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from the remote to local current directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.78:~/\{README.md,.bashrc\} . &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Transferring files with SFTP==&lt;br /&gt;
The SSH File Transfer Protocol (SFTP) is another method for transferring files securely between your local machine and a remote server. Unlike SCP, SFTP provides an interactive interface that allows you to navigate, upload, and download files more easily.&lt;br /&gt;
&lt;br /&gt;
Install an SFTP client: Most Unix-based systems, including Linux and macOS, have an SFTP client pre-installed. For Windows, you can use the built-in SFTP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Connect to a remote server: To start an SFTP session with a remote server, open a terminal or command prompt on your local machine and use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P 22 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Navigate the remote filesystem: Once connected, you can use commands similar to those available in a Unix shell to navigate the remote server&#039;s filesystem. Some common SFTP commands include:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;ls&#039;&#039;&#039;: List files and directories&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;cd&#039;&#039;&#039;: Change the current directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;mkdir&#039;&#039;&#039;: Create a new directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rmdir&#039;&#039;&#039;: Remove an empty directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;get&#039;&#039;&#039;: Download a file from the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;put&#039;&#039;&#039;: Upload a file to the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rm&#039;&#039;&#039;: Remove a file&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rename&#039;&#039;&#039;: Rename a file or directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;exit&#039;&#039;&#039;: Exit the SFTP session&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transfer files: To transfer files, use the put command to upload a file from your local machine to the remote server, and the get command to download a file from the remote server to your local machine. For example:&lt;br /&gt;
&lt;br /&gt;
Upload a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put local_file_path remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_file_path and remote_file_path with the appropriate paths for the files you want to transfer.&lt;br /&gt;
&lt;br /&gt;
Transferring directories: To transfer entire directories, use the -r flag with the put and get commands:&lt;br /&gt;
&lt;br /&gt;
Upload a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put -r local_directory_path remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get -r remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disconnect from the remote server: When you&#039;ve finished transferring files, type exit to close the SFTP session.&lt;br /&gt;
&lt;br /&gt;
SFTP offers a more user-friendly, interactive experience for transferring files compared to SCP. By utilizing the secure and encrypted SSH protocol, SFTP ensures that your data remains safe during transfer.&lt;br /&gt;
&lt;br /&gt;
==Advanced SSH Techniques==&lt;br /&gt;
=== Port forwarding and tunneling===&lt;br /&gt;
&lt;br /&gt;
SSH port forwarding and tunneling allow you to securely forward network traffic between your local machine and a remote server. This can be useful for accessing remote services, bypassing firewalls, or securely transmitting sensitive data.&lt;br /&gt;
&lt;br /&gt;
Local Port Forwarding: Local port forwarding creates a secure tunnel between your local machine and a remote server, allowing you to access remote services as if they were running on your local machine. To set up local port forwarding, use the -L flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -L local_port:remote_host:remote_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_port with an available port on your local machine, remote_host with the hostname or IP address of the remote server hosting the service, remote_port with the port number of the remote service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
Remote Port Forwarding: Remote port forwarding enables you to expose a local service running on your machine to a remote network. To set up remote port forwarding, use the -R flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -R remote_port:local_host:local_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace remote_port with an available port on the remote server, local_host with the hostname or IP address of the local machine hosting the service, local_port with the port number of the local service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:**Forwarding X, Sound, and Video on Ubuntu 22.04 with Ubuntu 22.04 LXC**: To forward X, sound, and video from a remote Ubuntu 22.04 server to your local Ubuntu 22.04 machine, you&#039;ll need to enable X11 forwarding and install the necessary packages.&lt;br /&gt;
&lt;br /&gt;
:*    Install required packages: On both your local machine and the remote server, install the x11-apps and pulseaudio packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt update&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install x11-apps pulseaudio&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Enable X11 forwarding: To enable X11 forwarding, you&#039;ll need to edit the SSH server configuration file (/etc/ssh/sshd_config) on the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line containing &amp;quot;X11Forwarding&amp;quot; and set its value to &amp;quot;yes&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;X11Forwarding yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol. Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Connect with X11 forwarding: From your local machine, use the -X flag to enable X11 forwarding when connecting to the remote server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -X username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Export PULSE_SERVER environment variable: On the remote server, export the PULSE_SERVER environment variable to forward sound:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;export PULSE_SERVER=tcp:localhost&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add this line to the remote user&#039;s ~/.bashrc or ~/.profile file to make the change permanent.&lt;br /&gt;
&lt;br /&gt;
:*    Run applications: Now, you can run graphical applications on the remote server, and they will be displayed on your local machine with sound and video forwarded.&lt;br /&gt;
&lt;br /&gt;
Please note that forwarding X, sound, and video might cause increased latency and reduced performance compared to running the applications locally.&lt;br /&gt;
&lt;br /&gt;
=== SSH agent forwarding===&lt;br /&gt;
SSH agent forwarding is a powerful feature that allows you to use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers. This is particularly useful when you need to access one remote server (Server B) through another remote server (Server A).&lt;br /&gt;
&lt;br /&gt;
====    Start the SSH agent on your local machine ====&lt;br /&gt;
&lt;br /&gt;
Before you enable SSH agent forwarding, you need to start the SSH agent on your local machine. Open a terminal and run the following command:&lt;br /&gt;
&lt;br /&gt;
:* For Linux and macOS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Windows (Git Bash or Cygwin):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval $(ssh-agent)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command starts the SSH agent and sets the required environment variables.&lt;br /&gt;
&lt;br /&gt;
====Add your SSH key to the agent====&lt;br /&gt;
&lt;br /&gt;
Next, add your private key to the SSH agent with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-add ~/.ssh/your_private_key&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_private_key&#039;&#039;&#039; with the filename of your private key. This might be &#039;&#039;&#039;id_rsa&#039;&#039;&#039;, &#039;&#039;&#039;id_ed25519&#039;&#039;&#039;, or another key file depending on your setup.&lt;br /&gt;
&lt;br /&gt;
====Configure SSH agent forwarding on your local machine====&lt;br /&gt;
&lt;br /&gt;
Edit your SSH config file to enable agent forwarding. The config file is usually located at &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;. If the file doesn&#039;t exist, create it.&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the config file: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server_a_alias&lt;br /&gt;
  HostName server_a_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_a&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host server_b_alias&lt;br /&gt;
  HostName server_b_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_b&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &lt;br /&gt;
:* &#039;&#039;&#039;server_a_alias&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039; server_a_ip_or_hostname&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_a&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;server_b_alias&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;server_b_ip_or_hostname&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_b&#039;&#039;&#039; &lt;br /&gt;
with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Make sure your public key is added to the remote servers====&lt;br /&gt;
&lt;br /&gt;
Before you can use SSH agent forwarding, you need to add your public key to the &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; file on both Server A and Server B. If you haven&#039;t done this already, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/your_public_key user@server_ip_or_hostname&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_public_key&#039;&#039;&#039;, &#039;&#039;&#039;user&#039;&#039;&#039;, and &#039;&#039;&#039;server_ip_or_hostname&#039;&#039;&#039; with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Test SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
First, SSH into Server A:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_a_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from Server A, SSH into Server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_b_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything is set up correctly, you should be able to access Server B without being prompted for a password.&lt;br /&gt;
&lt;br /&gt;
====Verify SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
To make sure that SSH agent forwarding is working, you can check the value of the &#039;&#039;&#039;SSH_AUTH_SOCK&#039;&#039;&#039; environment variable on Server B.&lt;br /&gt;
&lt;br /&gt;
From Server B, run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;echo $SSH_AUTH_SOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If SSH agent forwarding is working, this command should return a non-empty value.&lt;br /&gt;
&lt;br /&gt;
That&#039;s it! You&#039;ve successfully set up and tested SSH agent forwarding. Now you can use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Command Restriction===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file can be used to restrict the commands that a specific SSH key can execute. This is especially useful for security purposes, to limit the potential damage that could be done if a key is compromised.&lt;br /&gt;
&lt;br /&gt;
By including a &#039;&#039;&#039;command=&#039;&#039;&#039; directive in the &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file, you can specify the exact command that will be run when a client connects using the associated key. Any command provided by the client will be ignored, and the command specified in the authorized_keys file will be used instead.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is set up to always execute the &#039;&#039;&#039;scp&#039;&#039;&#039; command (used for secure copy of files over SSH) to the specified directory, no matter what command was originally issued by the client. This is a good way to create a &amp;quot;write-only&amp;quot; drop box, for instance.&lt;br /&gt;
&lt;br /&gt;
However, the keyholder could potentially still execute arbitrary commands by carefully crafting the file names they upload, so additional precautions should be taken, such as using command= along with other directives like &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039;, &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039;, and &#039;&#039;&#039;no-pty&#039;&#039;&#039; to further limit what can be done with the key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;,no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This entry does the following:&lt;br /&gt;
&lt;br /&gt;
:*    The &#039;&#039;&#039;command=&#039;&#039;&#039; directive runs the specified command when a client connects using this key. In this case, the command is scp, which securely copies files to the /home/rscp/media/ directory.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039; directive prevents the client from using SSH&#039;s port forwarding features, which could potentially be used to create a secure tunnel for other network traffic.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039; directive prevents the client from forwarding X11 graphical sessions, which could be used to run graphical applications over the SSH connection.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-pty&#039;&#039;&#039; directive prevents the allocation of a pseudo-terminal, which means the client can&#039;t interact with a shell or run interactive commands.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039; part is the public key of the client. Replace this with the actual key.&lt;br /&gt;
&lt;br /&gt;
This configuration significantly limits the operations that can be performed with this key, providing an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
====SCP Only====&lt;br /&gt;
&lt;br /&gt;
Use Case Example: Have a Server hosting XML Dumps, and want to automate sending a file or directory from Server1 to Server2 using a script and ssh-key so i don&#039;t need to enter password. &lt;br /&gt;
&lt;br /&gt;
=====Create Account on Server=====&lt;br /&gt;
Create user account you are going to use:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;adduser rscp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure user has a &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory to send public key to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make a Directory to transfer files to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If you see error &amp;lt;code&amp;gt;scp: /home/rscp/media/test.txt: Permission denied&amp;lt;/code&amp;gt; If you created directory &#039;&#039;&#039;media&#039;&#039;&#039; when logged in as &#039;&#039;&#039;root&#039;&#039;&#039; then check directory permissions and if need [[Linux_Users_and_Groups#File_Ownership_and_Permissions|assign ownership to &#039;&#039;&#039;user&#039;&#039;&#039; account.]]&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;code&amp;gt;chown rscp:rscp /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Ubuntu_22.04_SSH_Guide#Copying_public_keys_to_the_remote_server|Send your public key to server]]&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If from remote server you are sending a Directory include the &#039;&#039;&#039;-r&#039;&#039;&#039; flag in command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t -r /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This entry in the authorized_keys file uses the command option to restrict the SSH command that can be run with the associated SSH key. The command option specifies that the scp command should be used to transfer files to the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory on the server.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the entry:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;command=&amp;quot;/usr/bin/scp -t /home/rscp/&amp;quot;&#039;&#039;&#039;: This specifies that the scp command should be used as the SSH command for this key, with the &#039;&#039;&#039;-t&#039;&#039;&#039; option to specify that the remote end is a file (in this case, a directory), and the destination directory on the server is /home/rscp/. This means that the user can only use the SSH key to transfer files to the /home/rscp/ directory on the server.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039;: This is the public key associated with the private key that is used for authentication.&lt;br /&gt;
&lt;br /&gt;
By using the command option in this way, you can restrict the actions that the user can perform with the SSH key, which can help to improve security. In this case, the user can only transfer files to the specified directory on the server using the scp command.&lt;br /&gt;
&lt;br /&gt;
======Tip - transfer file to a path your USER does not have permissions for======&lt;br /&gt;
&lt;br /&gt;
You can write a shell script to check the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory every minute using a while loop and the sleep command. If any files are found in the directory, the script can move them to the &#039;&#039;&#039;/var/www/media&#039;&#039;&#039; directory using the mv command. Here&#039;s an example script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
  if [ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]; then&lt;br /&gt;
    mv /home/rscp/media/* /var/www/media/&lt;br /&gt;
  fi&lt;br /&gt;
  sleep 60&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this script, the while loop runs indefinitely (&#039;&#039;&#039;while true&#039;&#039;&#039;) and sleeps for 60 seconds at the end of each iteration (&#039;&#039;&#039;sleep 60&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;if&#039;&#039;&#039; statement checks if the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory is not empty (&#039;&#039;&#039;[ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]&#039;&#039;&#039;). If it is not empty, the &#039;&#039;&#039;mv&#039;&#039;&#039; command is used to move all files and directories from the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory to the &#039;&#039;&#039;/var/www/media/&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Save this script to a file (e.g. &#039;&#039;&#039;move-files.sh&#039;&#039;&#039;) and make it executable using the &#039;&#039;&#039;chmod +x move-files.sh&#039;&#039;&#039; command. You can then run the script using &#039;&#039;&#039;./move-files.sh &amp;amp;&#039;&#039;&#039; to start it in the background and allow it to run indefinitely. The &amp;amp; symbol is used to run the script in the background so that you can continue using the terminal.&lt;br /&gt;
&lt;br /&gt;
Note that running this script indefinitely can consume system resources, so you may want to consider setting up a scheduled task (e.g. using &#039;&#039;&#039;[[Cron_ubuntu_22.04|cron]]&#039;&#039;&#039;) to run the script at a specific interval instead of running it indefinitely.&lt;br /&gt;
&lt;br /&gt;
==Tilde &#039;&#039;&#039;~&#039;&#039;&#039; the escape character==&lt;br /&gt;
&lt;br /&gt;
The tilde (~) character has a special meaning in the context of SSH. When using SSH, you can use the tilde character followed by a control sequence to perform certain actions. These are called &amp;quot;tilde escape sequences&amp;quot; or &amp;quot;tilde commands.&amp;quot; They are useful for managing your SSH connections.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to use tilde escape sequences when connected to a remote server via SSH:&lt;br /&gt;
&lt;br /&gt;
:*    Make sure you are at the beginning of a new line in your terminal. Press &#039;&#039;&#039;Enter&#039;&#039;&#039; if you are not.&lt;br /&gt;
&lt;br /&gt;
:*    Type the tilde (~) character, followed by the appropriate control sequence. Note that you should not press &#039;&#039;&#039;Enter&#039;&#039;&#039; after typing the tilde character, but rather type the control sequence directly after it.&lt;br /&gt;
&lt;br /&gt;
Here are some common tilde escape sequences:&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;~.&#039;&#039;&#039; : Close the SSH connection. This can be helpful if the connection is frozen or unresponsive.&lt;br /&gt;
:    &#039;&#039;&#039;~^Z&#039;&#039;&#039; : Suspend the SSH connection and return to your local shell. You can later resume the connection using the fg command.&lt;br /&gt;
:    &#039;&#039;&#039;~#&#039;&#039;&#039; : List all forwarded connections (both local and remote) that are active in the current SSH session.&lt;br /&gt;
:    &#039;&#039;&#039;~&amp;amp;&#039;&#039;&#039; : Run the SSH session in the background. This is useful if you want to perform other tasks on your local machine without closing the SSH connection.&lt;br /&gt;
:    &#039;&#039;&#039;~~&#039;&#039;&#039; : Send a literal tilde character to the remote system. This is useful if you need to type a tilde character in the remote system without triggering an escape sequence.&lt;br /&gt;
&lt;br /&gt;
Remember that these escape sequences only work if they are entered at the beginning of a new line in your terminal. If you&#039;re typing them in the middle of a command or text, they won&#039;t be recognized as special control sequences.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting and Best Practices==&lt;br /&gt;
&lt;br /&gt;
In this section, we&#039;ll cover some common issues and best practices related to SSH connections, including managing a large number of SSH keys.&lt;br /&gt;
&lt;br /&gt;
===Too many authentication attempts===&lt;br /&gt;
&lt;br /&gt;
When connecting to an SSH server, you might encounter the &amp;quot;Too many authentication attempts&amp;quot; error. This is often caused by having too many private keys in your ~/.ssh directory. By default, SSH tries each key until it finds the correct one, but many servers limit the number of authentication attempts.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;: To resolve this issue, you can create a separate directory for your keys and configure the SSH config file to use the appropriate key for each connection.&lt;br /&gt;
&lt;br /&gt;
:*    Create a new directory for your keys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir ~/.ssh/keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Move your private key files to the new directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv ~/.ssh/id_rsa_* ~/.ssh/keys/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update your SSH config file to specify the correct key for each connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Host server1&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server1&lt;br /&gt;
&lt;br /&gt;
    Host server2&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permission issues=== &lt;br /&gt;
&lt;br /&gt;
SSH is very strict about file and directory permissions. Ensure that your ~/.ssh directory and its contents have the correct permissions:&lt;br /&gt;
&lt;br /&gt;
:*    The ~/.ssh directory should have permissions set to 700:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 700 ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private key files should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/id_rsa&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ~/.ssh/config file should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &amp;lt;b&amp;gt;Best practices&amp;lt;/b&amp;gt;: Follow these best practices to maintain secure and efficient SSH connections:&lt;br /&gt;
&lt;br /&gt;
:*    Use SSH key pairs instead of passwords for authentication, as they provide better security.&lt;br /&gt;
:*    Regularly update your SSH keys to maintain their security.&lt;br /&gt;
:*    Use strong, unique passphrases to protect your private keys.&lt;br /&gt;
:*    Disable password authentication and root login on your SSH server to reduce the risk of brute-force attacks.&lt;br /&gt;
:*    Regularly update your SSH server software to ensure you&#039;re running the latest security patches.&lt;br /&gt;
:*    Use non-standard port numbers for your SSH server to make it less likely to be targeted by automated attacks.&lt;br /&gt;
:*    Implement multi-factor authentication (MFA) for your SSH connections, if possible.&lt;br /&gt;
:*    Regularly review and remove any unnecessary authorized keys from the ~/.ssh/authorized_keys file on your servers.&lt;br /&gt;
:*    Use the Match directive in the sshd_config file to apply custom rules and settings for different users, groups, or connections.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Host_Your_Own_Mediawiki_Online_-_LXC_Ubuntu_Container&amp;diff=439</id>
		<title>Ubuntu 22.04 Host Your Own Mediawiki Online - LXC Ubuntu Container</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Host_Your_Own_Mediawiki_Online_-_LXC_Ubuntu_Container&amp;diff=439"/>
		<updated>2023-05-16T12:11:08Z</updated>

		<summary type="html">&lt;p&gt;Noob: Noob moved page Host Your Own Mediawiki Online - Ubuntu to Ubuntu 22.04 Host Your Own Mediawiki Online - LXC Ubuntu Container without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Installing MediaWiki on a container and exporting to the cloud.&lt;br /&gt;
Local OS used Ubuntu-Mate 20.04&lt;br /&gt;
Tested with ethernet.&lt;br /&gt;
Untested with wifi.&lt;br /&gt;
&lt;br /&gt;
TODO&#039;s&lt;br /&gt;
* Remove &#039;index.php&#039; from URL&lt;br /&gt;
* Find out more about &#039;DocBookExport&#039; and test how it works&lt;br /&gt;
* Move MediaWiki Server to FreeBSD&lt;br /&gt;
&lt;br /&gt;
Currently trying to solve the spambot problem, they got round the need to request to open an account somehow, will update once solved.&lt;br /&gt;
&lt;br /&gt;
$EDITOR is used as a place holder for an editor of your choice.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Installing LXD==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo snap install lxd&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxd init&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Selecting all defaults, apart from &amp;quot;Size in GB of the new loop device (1GB minimum) [default=6GB]:&amp;quot; increasing to 30GB:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxd init&amp;lt;/code&amp;gt; selected options:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Would you like to use LXD clustering? (yes/no) [default=no]:&lt;br /&gt;
Do you want to configure a new storage pool? (yes/no) [default=yes]:&lt;br /&gt;
Name of the new storage pool [default=default]:&lt;br /&gt;
Name of the storage backend to use (btrfs, dir, lvm, zfs, ceph) [default=zfs]:&lt;br /&gt;
Create a new ZFS pool? (yes/no) [default=yes]:&lt;br /&gt;
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]:&lt;br /&gt;
Size in GB of the new loop device (1GB minimum) [default=6GB]:30GB&lt;br /&gt;
Would you like to connect to a MAAS server? (yes/no) [default=no]:&lt;br /&gt;
Would you like to create a new local network bridge? (yes/no) [default=yes]:&lt;br /&gt;
What should the new bridge be called? [default=lxdbr0]:&lt;br /&gt;
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]:&lt;br /&gt;
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: &lt;br /&gt;
Would you like the LXD server to be available over the network? (yes/no) [default=no]: &lt;br /&gt;
Would you like stale cached images to be updated automatically? (yes/no) [default=yes] &lt;br /&gt;
Would you like a YAML &amp;quot;lxd init&amp;quot; preseed to be printed? (yes/no) [default=no]:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Create Ubuntu:22.04 Container for MediaWiki==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc launch ubuntu:22.04 mediawiki&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc list&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
+-----------+---------+--------------------+------+-----------+-----------+&lt;br /&gt;
|   NAME    |  STATE  |        IPV4        | IPV6 |   TYPE    | SNAPSHOTS |&lt;br /&gt;
+-----------+---------+--------------------+------+-----------+-----------+&lt;br /&gt;
| mediawiki | RUNNING | 10.194.171.251(eth0) |      | CONTAINER | 0         |&lt;br /&gt;
+-----------+---------+--------------------+------+-----------+-----------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Login to Container===&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec mediawiki bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basic Firewall UFW for Container===&lt;br /&gt;
&lt;br /&gt;
NOTE:Add Link to a UFW page for more info&lt;br /&gt;
&lt;br /&gt;
Blocking IPv6&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/default/ufw&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the line&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;IPV6=yes&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
To&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;IPV6=no&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Save and Exit&lt;br /&gt;
&lt;br /&gt;
Allow port 80&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 80/tcp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Allow port 443&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 443/tcp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Start/Enable UFW firewall&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw enable&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Check UFW status&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw status&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
If you Entered wrong port number and would like to change/delete rule:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
delete a UFW rule you made by mistake.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw delete allow 433/tcp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Or you can use a numbered rule list.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw status numbered&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Will list rules by number.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw delete &amp;lt;RULE_NUMBER&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw delete 2&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now re-enter rule to allow correct port number and protocol.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Update system===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ssmtp setup===&lt;br /&gt;
NOTE: need link to ssmtp page - showing how to use other email providers that allow smtp&lt;br /&gt;
Link to ssmtp wiki page&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
You can use a number of email providers for sending emails from server using ssmtp.&amp;lt;br \&amp;gt;&lt;br /&gt;
I am going to use &amp;lt;b&amp;gt;smtp2go.com&amp;lt;/b&amp;gt; they do provide a free service if you wish to try.&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
smtp2go details:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
https://www.smtp2go.com/&amp;lt;br \&amp;gt;&lt;br /&gt;
Has a Free Plan&lt;br /&gt;
# 1000 emails per month&lt;br /&gt;
# 5 days of email reporting&lt;br /&gt;
# Ticket support only&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
Do not use you username and password you used to sign up!&amp;lt;br \&amp;gt;&lt;br /&gt;
Go to https://app.smtp2go.com/sending/smtp_users/ &amp;lt;br \&amp;gt;&lt;br /&gt;
Or &#039;Sending&#039; &amp;gt; &#039;SMTP Users&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
And create/add a SMTP User account.&amp;lt;br \&amp;gt;&lt;br /&gt;
The User created will be given a good password by default.&amp;lt;br \&amp;gt;&lt;br /&gt;
Use this username and password for ssmtp.&amp;lt;br \&amp;gt; &lt;br /&gt;
In this example i have the username &amp;quot;&amp;lt;b&amp;gt;noobwiki&amp;lt;/b&amp;gt;&amp;quot; and the password &amp;quot;&amp;lt;b&amp;gt;N0tTelinu&amp;lt;/b&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====ssmtp====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ssmtp -y&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/ssmtp/ssmtp.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mailhub=mail.smtp2go.com:587&lt;br /&gt;
AuthUser=noobwiki&lt;br /&gt;
AuthPass=N0tTelinu&lt;br /&gt;
UseSTARTTLS=YES&lt;br /&gt;
FromLineOverride=YES&lt;br /&gt;
hostname=completenoobs.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Why use &amp;lt;code&amp;gt;hostname=completenoobs.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;quot;hostname&amp;quot; needed for ubuntu unattended upgrades to send email.&amp;lt;br \&amp;gt;&lt;br /&gt;
If missing: will get &amp;quot;(550 unable to verify sender address.)&amp;quot; &amp;lt;br \&amp;gt;&lt;br /&gt;
If using &amp;lt;code&amp;gt;hostname=localhost&amp;lt;/code&amp;gt; &amp;quot;(550 &amp;quot;Localhost&amp;quot; unnaceptable, you must use a public domain-name.)&amp;quot;&amp;lt;br \&amp;gt;&lt;br /&gt;
If using &amp;lt;code&amp;gt;hostname=admin@completenoobs.com&amp;lt;/code&amp;gt; &amp;quot;501 &amp;lt;root@admin@completenoobs.com&amp;gt;: malformed address: @completenoobs.com&amp;gt; may not follow &amp;lt;root@admin&amp;quot; &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
Do not use user@smtp2go.com as the sender address! you need an email address that has an MX record(mail exchanger record) at its domain name.&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/ssmtp/revaliases&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root:admin@completenoobs.com:mail.smtp2go.com:587&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====usermod====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
usermod can be used to change the email senders name/address.&amp;lt;br \&amp;gt;&lt;br /&gt;
Instead of your mail coming from &#039;root&#039; or &#039;ubuntu&#039; or any other user account.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;usermod -c &amp;quot;emailSenderName&amp;quot; &amp;lt;account_sending&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;usermod -c &amp;quot;completenoobslxc&amp;quot; root&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Send Test eMail&amp;lt;br \&amp;gt;&lt;br /&gt;
Create a file and add subject header and some content.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR test-mail.txt&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Subject:test email&lt;br /&gt;
&lt;br /&gt;
Hello You.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Save and Exit&amp;lt;br \&amp;gt;&lt;br /&gt;
Now send the email:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sendmail email@address2receive.mail &amp;lt; test-mail.txt&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Don&#039;t forget to check your spam folder if you don&#039;t see email&amp;lt;br \&amp;gt;&lt;br /&gt;
Once tested and email sent, you can delete &amp;lt;b&amp;gt;test-mail.txt&amp;lt;/b&amp;gt;.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;rm test-mail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====sendmail notes====&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
If the sendmail command locks your terminal and CTRL+c does not work&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;CTRL+z&amp;lt;/code&amp;gt; which will send a SIGTSTP signal which will put the process to sleep.&amp;lt;br \&amp;gt;&lt;br /&gt;
use jobs to see the sleeping process.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;jobs&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
and kill %&amp;lt;JOBNUMBER&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;kill %1&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
you can also use &amp;lt;code&amp;gt;ps ax&amp;lt;/code&amp;gt; to list processes running on your computer and &amp;lt;code&amp;gt;kill -9 &amp;lt;PROCESS-NUMBER&amp;gt;&amp;lt;/code&amp;gt; to kill process.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
sendmail in verbose mode for more details:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
More info can be found in the man page &amp;lt;code&amp;gt;man sendmail&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Use the verbose flag &amp;lt;b&amp;gt;-v&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sendmail -v email@address2receive.mail &amp;lt; test-mail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Check mail logs for errors:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
send mail error log can be found in&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/var/log/mail.err&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
and sendmail log can be found:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/var/log/mail.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===auto update container config===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apt/apt.conf.d/50unattended-upgrades&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Uncomment&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;//	&amp;quot;${distro_id}:${distro_codename}-updates&amp;quot;;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;quot;${distro_id}:${distro_codename}-updates&amp;quot;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dont need auto reboot on container - no kernel - kernel shared with host.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====email on update====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apt/apt.conf.d/50unattended-upgrades&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Add email address to send email to:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Unattended-Upgrade::Mail &amp;quot;&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;Unattended-Upgrade::Mail &amp;quot;email@tosendto.com&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
We are going to test are send mail, so for now change MailReport to &amp;quot;always&amp;quot;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Unattended-Upgrade::MailReport &amp;quot;on-change&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;Unattended-Upgrade::MailReport &amp;quot;always&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Once i needed &#039;apticron&#039; to get emails working with unattended upgrades:&amp;lt;br \&amp;gt;&lt;br /&gt;
Notes here just incase&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Install apticron&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install apticron -y&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create apticron.conf file containing email to send email to:&amp;lt;br \&amp;gt;&lt;br /&gt;
If you dont then &#039;apticron&#039; will by default sent to root@localhost.&amp;lt;br &amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;echo &#039;EMAIL=&amp;quot;email@tosendto.com&amp;quot;&#039; &amp;gt; /etc/apticron/apticron.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test with debug flag -d&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;unattended-upgrade -d&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once email alerts from auto updates has been tested and working, change MailReport back from &#039;always&#039; to &#039;on-change&#039;, unless you want to be emailed at every update.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Install MediaWiki===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-intl -y&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.2.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -xvf mediawiki-1.39.2.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv mediawiki-1.39.2 /var/www/html/mediawiki&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create Database====&lt;br /&gt;
&lt;br /&gt;
Will be prompted to set a root password!&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mysql -u root -p&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;!-- create drop down - add root password option --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;green&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;THISpasswordSHOULDbeCHANGED&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE DATABASE mywiki_database;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;use mywiki_database;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON mywiki_database.* TO &#039;green&#039;@&#039;localhost&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Make note of your: database name, username, userpassword&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;green&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;THISpasswordSHOULDbeCHANGED&#039;;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Database Username:&amp;lt;b&amp;gt;green&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Database host/location:&amp;lt;b&amp;gt;localhost&amp;lt;/b&amp;gt;&lt;br /&gt;
Database User Password:&amp;lt;b&amp;gt;THISpasswordSHOULDbeCHANGED&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE DATABASE mywiki_database;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Database Name:&amp;lt;b&amp;gt;mywiki_database&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create self-signed https certs====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;openssl req -x509 -newkey rsa:4096 -keyout key.pem -nodes -out cert.pem -days 365&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: can leave blank; just press enter.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mv cert.pem /etc/ssl/certs/cn-selfsigned.crt&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mv key.pem /etc/ssl/private/cn-selfsigned.key&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create ssl-params.conf====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apache2/conf-available/ssl-params.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember to turn stapling on after letsencrypt cert&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH&lt;br /&gt;
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1&lt;br /&gt;
SSLHonorCipherOrder On&lt;br /&gt;
# Disable preloading HSTS for now.  You can use the commented out header line that includes&lt;br /&gt;
# the &amp;quot;preload&amp;quot; directive if you understand the implications.&lt;br /&gt;
# Header always set Strict-Transport-Security &amp;quot;max-age=63072000; includeSubDomains; preload&amp;quot;&lt;br /&gt;
Header always set X-Frame-Options DENY&lt;br /&gt;
Header always set X-Content-Type-Options nosniff&lt;br /&gt;
# Requires Apache &amp;gt;= 2.4&lt;br /&gt;
SSLCompression off&lt;br /&gt;
# May want to turn stapling off when using self-signed to avoid receiving errors in log&lt;br /&gt;
SSLUseStapling off&lt;br /&gt;
SSLStaplingCache &amp;quot;shmcb:logs/stapling-cache(150000)&amp;quot;&lt;br /&gt;
# Requires Apache &amp;gt;= 2.4.11&lt;br /&gt;
SSLSessionTickets Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create Apache2 config====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cd /etc/apache2/sites-available/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rm 000-default.conf default-ssl.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apache2/sites-available/completenoobs.com.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Important Redirect note&amp;lt;/b&amp;gt;:&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    # Redirect Requests to SSL&lt;br /&gt;
    Redirect permanent &amp;quot;/&amp;quot; &amp;quot;https://IPADDRESS&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Change to your Container IP!&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Redirect permanent &amp;quot;/&amp;quot; &amp;quot;https://10.194.171.251&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    ServerName completenoobs.com&lt;br /&gt;
    ServerAdmin admin@&lt;br /&gt;
&lt;br /&gt;
    # Redirect Requests to SSL&lt;br /&gt;
    Redirect permanent &amp;quot;/&amp;quot; &amp;quot;https://IPADDRESS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    ErrorLog ${APACHE_LOG_DIR}/completenoobs.com.error.log&lt;br /&gt;
    CustomLog ${APACHE_LOG_DIR}/completenoobs.com.access.log combined&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;IfModule mod_ssl.c&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;VirtualHost _default_:443&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            ServerName completenoobs.com&lt;br /&gt;
            ServerAdmin admin@completenoobs.com&lt;br /&gt;
            DocumentRoot /var/www/html/mediawiki&lt;br /&gt;
            # According MWiki Manual:Security&lt;br /&gt;
            php_flag register_globals off&lt;br /&gt;
&lt;br /&gt;
            ErrorLog ${APACHE_LOG_DIR}/completenoobs.com.error.log&lt;br /&gt;
            CustomLog ${APACHE_LOG_DIR}/completenoobs.com.access.log combined&lt;br /&gt;
&lt;br /&gt;
            SSLEngine on&lt;br /&gt;
            SSLCertificateFile /etc/ssl/certs/cn-selfsigned.crt&lt;br /&gt;
            SSLCertificateKeyFile  /etc/ssl/private/cn-selfsigned.key&lt;br /&gt;
            # need to find out what SSLCertificateChainFile is? explain is in the default-ssl.conf file.&lt;br /&gt;
            #SSLCertificateChainFile /etc/ssl/certs/example.com.root-bundle.crt&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;FilesMatch &amp;quot;\.(cgi|shtml|phtml|php)$&amp;quot;&amp;gt;&lt;br /&gt;
                    SSLOptions +StdEnvVars&lt;br /&gt;
            &amp;lt;/FilesMatch&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;Directory /usr/lib/cgi-bin&amp;gt;&lt;br /&gt;
                    SSLOptions +StdEnvVars&lt;br /&gt;
            &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;Directory /var/www/html/wikimedia&amp;gt;&lt;br /&gt;
                    Options None FollowSymLinks&lt;br /&gt;
                    #Allow .htaccess&lt;br /&gt;
                    AllowOverride All&lt;br /&gt;
                    Require all granted&lt;br /&gt;
                    &amp;lt;IfModule security2_module&amp;gt;&lt;br /&gt;
                            SecRuleEngine Off&lt;br /&gt;
                            # or disable only problematic rules&lt;br /&gt;
                    &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
            &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            # According to MWiki Manual:Security&lt;br /&gt;
            &amp;lt;Directory /var/www/html/wikimedia/images&amp;gt;&lt;br /&gt;
                    # Ignore .htaccess files&lt;br /&gt;
                    AllowOverride None&lt;br /&gt;
                    # Serve HTML as plaintext, don&#039;t execute SHTML&lt;br /&gt;
                    AddType text/plain .html .htm .shtml .php .phtml .php5&lt;br /&gt;
                    # Don&#039;t run arbitrary PHP code.&lt;br /&gt;
                    php_admin_flag engine off&lt;br /&gt;
                    # If you&#039;ve other scripting languages, disable them too.&lt;br /&gt;
            &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            #According to MWiki Manual:Security&lt;br /&gt;
            &amp;lt;Directory /var/www/html/wikimedia/images/deleted&amp;gt;&lt;br /&gt;
                    Deny from all&lt;br /&gt;
                    AllowOverride AuthConfig Limit&lt;br /&gt;
                    Require local&lt;br /&gt;
            &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Reload Apache2====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;a2enmod ssl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;a2enmod headers&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;a2ensite completenoobs.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;a2enconf ssl-params&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apache2ctl configtest&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart apache2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MediaWiki Basic Setup===&lt;br /&gt;
====Landing page====&lt;br /&gt;
&lt;br /&gt;
Open a web browser and go to your containers private ip address (you can get ip address by running &amp;lt;code&amp;gt;lxc list&amp;lt;/code&amp;gt; on host).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;https://10.194.171.251&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Are certs are self-signed and you may/will get warning &amp;quot;your connection is not private&amp;quot;&amp;lt;br \&amp;gt;&lt;br /&gt;
Click &amp;quot;Advance&amp;quot; and &amp;quot;Proceed to 10.194.171.251 (unsafe)&amp;quot;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will now find yourself on the mediawiki setup landing page.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
MediaWiki 1.35.0&amp;lt;br \&amp;gt;&lt;br /&gt;
LocalSettings.php not found.&amp;lt;br \&amp;gt;&lt;br /&gt;
Please &amp;lt;u&amp;gt;set up the wiki&amp;lt;/u&amp;gt; first.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Click &amp;lt;b&amp;gt;set up the wiki&amp;lt;/b&amp;gt; to be taken to the &amp;quot;mw-config/index.php&amp;quot; page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====Basic Configure MediaWiki=====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Language Page&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Just pick a language mate&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Welcome to MediaWiki!&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
read and click Continue&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Connect to database - going to need the details from when you created the database.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Database host:localhost&amp;lt;br \&amp;gt;&lt;br /&gt;
Database name:mywiki_database&amp;lt;br \&amp;gt;&lt;br /&gt;
Database table prefix (no hyphens): &amp;lt;b&amp;gt;LEAVE BLANK&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Database username:green&amp;lt;br \&amp;gt;&lt;br /&gt;
Database password:THISpasswordSHOULDbeCHANGED&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Database Settings&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Database account for web access&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]Use the same account as for installation&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Leave ticked&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Name&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Name of wiki:&amp;lt;/b&amp;gt;CompleteNoobs&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Project namespace:&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]Same as the wiki name:&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Project&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Other (specify)&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Administrator account&amp;lt;/b&amp;gt;&lt;br /&gt;
Will be the admin account on the wiki.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Options&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;User rights profile:&amp;lt;/b&amp;gt; &amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Open wiki &amp;lt;br \&amp;gt;&lt;br /&gt;
[x] Account creation required&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Authorised editors only &amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Private wiki&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Copyright and licence:&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Creative Commons Attribution&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Creative Commons Attribution-ShareAlike&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Creative Commons Attribution-NonCommercial-ShareAlike&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Creative Commons Zero (Public Domain)&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] GNU Free Documentation Licence 1.3 or later&amp;lt;br \&amp;gt;&lt;br /&gt;
[x] No licence footer&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Select a custom Creative Commons licence&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Email settings&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Enable outbound email&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Return email address:&amp;lt;/b&amp;gt;apache@🌻.invalid&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Enable user-to-user email&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Enable user talk page notification&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Enable watchlist notification&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Enable email authentication&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Skins&amp;lt;/b&amp;gt; Pick a skin&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Extensions&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Special pages&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]CiteThisPage&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Interwiki&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Nuke&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Renameuser&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]ReplaceText&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Editors&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]CodeEditor&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]VisualEditor&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]WikiEditor&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Parser hooks&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]CategoryTree&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Cite&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]ImageMap&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]InputBox&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]ParserFunctions&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Poem&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Scribunto&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]SyntaxHighlight_GeSHi&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]TemplateData&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Media handlers&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]PdfHandler&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Spam prevention&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[x]ConfirmEdit&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]SpamBlacklist&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]TitleBlacklist&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;API&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]PageImages&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;lt;u&amp;gt;Other&amp;lt;/u&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Gadgets&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]LocalisationUpdate&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]MultimediaViewer&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]OATHAuth&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]SecureLinkFixer&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]TextExtracts&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Images and file uploads&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Enable file uploads&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Logo URL:&amp;lt;/b&amp;gt;$wgResourceBasePath/resources/assets/wiki.png&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ]Enable Instant Commons&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Advanced configuration&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Settings for object caching:&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
[x] No caching (no functionality is removed, but speed may be impacted on larger wiki sites)&amp;lt;br \&amp;gt;&lt;br /&gt;
[ ] Use Memcached (requires additional setup and configuration)&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====LocalSettings.php Launch Wiki====&lt;br /&gt;
&lt;br /&gt;
When the Basic configuration of mediawiki is done on the webpage.&amp;lt;br \&amp;gt;&lt;br /&gt;
You will have a &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt; which will be downloaded from your browser.&amp;lt;br \&amp;gt;&lt;br /&gt;
You need to place the &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt; file into your containers &amp;lt;b&amp;gt;/var/www/html/mediawiki/&amp;lt;/b&amp;gt; directory.&amp;lt;br \&amp;gt;&lt;br /&gt;
You can do this from host using the &amp;lt;b&amp;gt;lxc file push&amp;lt;/b&amp;gt; command.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc file push /home/$USER/Downloads/LocalSettings.php mediawiki/var/www/html/mediawiki/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Do not refresh browser it will download the LocalSettings.php again! go to the IP address of your container or just trim the &amp;lt;code&amp;gt;mw-config/index.php?page=Complete&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now on your browser visit the page again https://10.194.171.251&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And welcome to your wiki.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Change Logo===&lt;br /&gt;
&lt;br /&gt;
You need a 135px by 135px image, in this example its named &#039;completenoobs-logo.png&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc file push completenoobs-logo.png mediawiki/var/www/html/mediawiki/resources/assets/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Back in container edit the &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt; file&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
## The URL paths to the logo.  Make sure you change this from the default,&lt;br /&gt;
## or else you&#039;ll overwrite your logo when you upgrade!&lt;br /&gt;
$wgLogos = [&lt;br /&gt;
        &#039;1x&#039; =&amp;gt; &amp;quot;$wgResourceBasePath/resources/assets/change-your-logo.svg&amp;quot;,&lt;br /&gt;
        &#039;icon&#039; =&amp;gt; &amp;quot;$wgResourceBasePath/resources/assets/change-your-logo.svg&amp;quot;,&lt;br /&gt;
];&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change to your new logo:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$wgLogos = [&lt;br /&gt;
        &#039;1x&#039; =&amp;gt; &amp;quot;$wgResourceBasePath/resources/assets/completenoobs-logo.png&amp;quot;,&lt;br /&gt;
        &#039;icon&#039; =&amp;gt; &amp;quot;$wgResourceBasePath/resources/assets/completenoobs-logo.png&amp;quot;,&lt;br /&gt;
];&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Email Config===&lt;br /&gt;
&lt;br /&gt;
Warning i did get loads of spam bots, using this to send naughty emails everywhere!&amp;lt;br&amp;gt;&lt;br /&gt;
Changed setting to block signups, requests only,and changed &amp;lt;b&amp;gt;$wgEnableUserEmail&amp;lt;/b&amp;gt; to false and still the bots managed to send spam using my smtp account.&amp;lt;br&amp;gt;&lt;br /&gt;
How they done this? Is beyond my understanding and i removed email from the wiki till i have more info on how to stop the spamming.&amp;lt;br&amp;gt;&lt;br /&gt;
Was using mediawiki-1.35.0&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /var/www/html/mediawiki/LocalSettings.php&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure &amp;lt;b&amp;gt;$wgEnableEmail&amp;lt;/b&amp;gt; is set to true.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgEnableEmail = true;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.mediawiki.org/wiki/Manual:$wgEnableEmail&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$wgEmergencyContact = &amp;quot;&amp;quot;;&lt;br /&gt;
$wgPasswordSender = &amp;quot;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$wgEmergencyContact = &amp;quot;admin@completenoobs.com&amp;quot;;&lt;br /&gt;
$wgPasswordSender = &amp;quot;admin@completenoobs.com&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$wgSMTP = [&lt;br /&gt;
    &#039;host&#039; =&amp;gt; &#039;ssl://mail.smtp2go.com&#039;, // outbox server of the email account&lt;br /&gt;
    &#039;IDHost&#039; =&amp;gt; &#039;completenoobs.com&#039;,&lt;br /&gt;
    &#039;port&#039; =&amp;gt; 465,&lt;br /&gt;
    &#039;username&#039; =&amp;gt; &#039;noobwiki&#039;, // user of the email account&lt;br /&gt;
    &#039;password&#039; =&amp;gt; &#039;N0tTelinu&#039;, // app password of the email account&lt;br /&gt;
    &#039;auth&#039; =&amp;gt; true&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Request Account and Confirm Email to edit===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In LocalSettings change $wgEmailAuthentication = false; to true&lt;br /&gt;
&lt;br /&gt;
https://www.mediawiki.org/wiki/Manual:$wgEmailAuthentication&amp;lt;br&amp;gt;&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:ConfirmAccount&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://extdist.wmflabs.org/dist/extensions/ConfirmAccount-REL1_39-2b96e90.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar xzf ConfirmAccount-REL1_39-2b96e90.tar.gz -C /var/www/html/mediawiki/extensions/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
In &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
set &amp;lt;b&amp;gt;$wgEmailAuthentication&amp;lt;/b&amp;gt; to true.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wfLoadExtension( &#039;ConfirmAccount&#039; );  &lt;br /&gt;
$wgConfirmAccountContact = &#039;admin@completenoobs.com&#039;; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run maintenance update&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/update.php &amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
use &amp;lt;b&amp;gt;Special:ConfirmAccounts&amp;lt;/b&amp;gt; to see if anyone requested a account.&amp;lt;br&amp;gt;&lt;br /&gt;
And yep, your gonna get spammed! Bots love a wiki.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===CookieWarning Extension===&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:CookieWarning&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://extdist.wmflabs.org/dist/extensions/CookieWarning-REL1_39-778fe72.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar -xzf CookieWarning-REL1_39-778fe72.tar.gz -C /var/www/html/mediawiki/extensions/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt; add:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wfLoadExtension( &#039;CookieWarning&#039; );&lt;br /&gt;
$wgCookieWarningEnabled = &#039;true&#039;;&lt;br /&gt;
# $wgCookieWarningMoreUrl allows to to select a link for your moreinfo button&lt;br /&gt;
$wgCookieWarningMoreUrl = &#039;https://www.completenoobs.com/link&#039;;&lt;br /&gt;
$wgCookieWarningEnabled = &#039;true&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To change message sign in with admin account and visit these pages of your wiki and edit.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;MediaWiki:Cookiewarning-info&amp;lt;/b&amp;gt; Edit the display message.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://10.194.171.251/index.php/MediaWiki:Cookiewarning-info&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;MediaWiki:Cookiewarning-moreinfo-label&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt; &lt;br /&gt;
Edit and change display of the moreinfo button: link can be made/changed at LocalSettings with:&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;code&amp;gt;$wgCookieWarningMoreUrl = &#039;https://www.completenoobs.com/link&#039;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://10.194.171.251/index.php/MediaWiki:Cookiewarning-moreinfo-label&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;MediaWiki:Cookiewarning-ok-label&amp;lt;/b&amp;gt; Edit and change the text on the OK button.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://10.194.171.251/index.php/MediaWiki:Cookiewarning-ok-label&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Contribution Scores Extension===&lt;br /&gt;
&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:Contribution_Scores&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://extdist.wmflabs.org/dist/extensions/ContributionScores-REL1_39-0e7e99d.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar -xzf ContributionScores-REL1_39-0e7e99d.tar.gz -C /var/www/html/mediawiki/extensions&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt; add:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wfLoadExtension( &#039;ContributionScores&#039; );&lt;br /&gt;
// Exclude Bots from the reporting - Can be omitted.&lt;br /&gt;
$wgContribScoreIgnoreBots = true; &lt;br /&gt;
// Exclude Blocked Users from the reporting - Can be omitted.&lt;br /&gt;
$wgContribScoreIgnoreBlockedUsers = true;&lt;br /&gt;
// Use real user names when available - Can be omitted. Only for MediaWiki 1.19 and later.&lt;br /&gt;
$wgContribScoresUseRealName = true;&lt;br /&gt;
// Set to true to disable cache for parser function and inclusion of table.&lt;br /&gt;
$wgContribScoreDisableCache = false;       &lt;br /&gt;
// Each array defines a report - 7,50 is &amp;quot;past 7 days&amp;quot; and &amp;quot;LIMIT 50&amp;quot; - Can be omitted.&lt;br /&gt;
$wgContribScoreReports = [&lt;br /&gt;
    [ 7, 50 ],&lt;br /&gt;
    [ 30, 50 ],&lt;br /&gt;
    [ 0, 50 ]&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Add to Main Landing Page:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;{{Special:ContributionScores/10/5}}&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Place Notice at top of every new page created===&lt;br /&gt;
&lt;br /&gt;
Using the &amp;lt;b&amp;gt;PageNotice&amp;lt;/b&amp;gt; Extension.&lt;br /&gt;
&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:PageNotice#Configuration&lt;br /&gt;
&lt;br /&gt;
Download PageNotice and extract to extensions directory.&lt;br /&gt;
&lt;br /&gt;
in LocalSettings.php add the lines:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wfLoadExtension( &#039;PageNotice&#039; );&lt;br /&gt;
$wgPageNoticeDisablePerPageNotices = &#039;true&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To have message in every name space go to your wiki&#039;s page&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;index.php/mediawiki:top-notice-ns-0&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Only admin account can edit this page:&amp;lt;br \&amp;gt;&lt;br /&gt;
What you place in this page will be displayed at the top of every page created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Privacy Policy===&lt;br /&gt;
Holly $#$#$ this is a lot of work, looking into it&amp;lt;br \&amp;gt;&lt;br /&gt;
https://www.mediawiki.org/wiki/GDPR_(General_Data_Protection_Regulation)_and_MediaWiki_software&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====NewSignupPage====&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:NewSignupPage&amp;lt;br \&amp;gt;&lt;br /&gt;
Big thanks to Shoutwiki.com or this would of been a very big pain.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check for Latest link from the Download page https://www.mediawiki.org/wiki/Special:ExtensionDistributor/NewSignupPage&amp;lt;br \&amp;gt;&lt;br /&gt;
In mediawiki container:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://extdist.wmflabs.org/dist/extensions/NewSignupPage-REL1_35-ecf00aa.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar xvf NewSignupPage-REL1_35-ecf00aa.tar.gz -C /var/www/html/mediawiki/extensions/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /var/www/html/mediawiki/LocalSettings.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Add the Line:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wfLoadExtension( &#039;NewSignupPage&#039; );&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Change the Info given at signup at:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;index.php/MediaWiki:Newsignuppage-loginform-tos&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Default page will be:&amp;lt;pre&amp;gt;&lt;br /&gt;
I am over 13 years of age and I have read, understood and agree to be bound by the Terms of Service and Privacy Policy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;quot;Terms of Service&amp;quot; and &amp;quot;Privacy Policy&amp;quot; are linked to there pages, so we need to create a few pages.&lt;br /&gt;
&lt;br /&gt;
======Need &amp;lt;b&amp;gt;Privacy Policy&amp;lt;/b&amp;gt; Page======&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create a &#039;Privacy_Policy&#039; page and link on &amp;quot;MediaWiki:Newsignuppage-loginform-tos&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;[[CompleteNoobs:Privacy_policy | Privacy Policy]]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Need &amp;lt;b&amp;gt;Terms Of Service&amp;lt;/b&amp;gt; page=====&lt;br /&gt;
&lt;br /&gt;
https://www.completenoobs.com/index.php/Terms_of_Service&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
once done change link on &amp;quot;MediaWiki:Newsignuppage-loginform-tos&amp;quot;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Content Policy Page=====&lt;br /&gt;
https://10.194.171.251/index.php/Content_Policy&amp;lt;br \&amp;gt;&lt;br /&gt;
Contains link to https://www.completenoobs.com/index.php/CompleteNoobs_Staff_Admins&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Staff and Admin Page=====&lt;br /&gt;
&lt;br /&gt;
https://10.194.171.251/index.php/CompleteNoobs_Staff_Admins&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Linked from Content Policy Page! a place to contact by email staff, admins&lt;br /&gt;
&lt;br /&gt;
=====General Disclaimer page=====&lt;br /&gt;
https://10.194.171.251/index.php/CompleteNoobs:General_disclaimer&amp;lt;br \&amp;gt;&lt;br /&gt;
This page shows/linked at bottom of wiki&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Copyright Policy=====&lt;br /&gt;
https://10.194.171.251/index.php/CompleteNoobs:Copyrights&amp;lt;br \&amp;gt;&lt;br /&gt;
Copyrights page that shows in info box when making a post.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Fail2Ban==&lt;br /&gt;
&lt;br /&gt;
This Will Ban an IP who incorrectly enters wrong login details, a (you can select) amount of times for a (you can select) amount of time.&lt;br /&gt;
 &lt;br /&gt;
===Fail2Log Extension===&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:Fail2Log&amp;lt;br&amp;gt;&lt;br /&gt;
====Create Log file====&lt;br /&gt;
&lt;br /&gt;
Could not get PHP to create and set permissions for log file:&lt;br /&gt;
So for now doing manually!&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;touch /var/log/Fail2Log.log&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;chown www-data:www-data /var/log/Fail2Log.log&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 0755 /var/log/Fail2Log.log&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Failed login&#039;s with wrong user name and/or password should now be logged in:&amp;lt;b&amp;gt;/var/log/Fail2Log.log&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
Log Format:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;Failed:&amp;lt;IP_ADDRESS&amp;gt; &amp;lt;DATE&amp;gt; &amp;lt;TIME&amp;gt; &amp;lt;USERNAME&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Download and install extension====&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://github.com/greenhatmonkey/Fail2Log/blob/main/Fail2Log.tar.gz?raw=true&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar xzvf Fail2Log.tar.gz?raw=true -C /var/www/html/mediawiki/extensions/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Add to your &amp;lt;b&amp;gt;LocalSettings.php&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wfLoadExtension( &#039;Fail2Log&#039; );&lt;br /&gt;
$wgFail2LogFile = &#039;/var/log/Fail2Log.log&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Install and Setup Fail2Ban====&lt;br /&gt;
&lt;br /&gt;
Fail2Ban works in a container. If using fail2ban on Host for container:&amp;lt;br/&amp;gt;&lt;br /&gt;
Just include log path: &amp;lt;code&amp;gt;/var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/default/containers/&amp;amp;lt;CONTAINER_NAME&amp;gt;/rootfs/var/log/Fail2Log.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt install fail2ban&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Fail2ban will use file.local over file.conf if file.local exists: &lt;br /&gt;
* file.conf can be written over if file2ban gets updated.&lt;br /&gt;
* Make a file.local of the file you are working on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/fail2ban/jail.local&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- unmodified jail.conf file --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Default &amp;lt;code&amp;gt;/etc/fail2ban/jail.conf&amp;lt;/code&amp;gt; file: Expand to view&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# WARNING: heavily refactored in 0.9.0 release.  Please review and&lt;br /&gt;
#          customize settings for your setup.&lt;br /&gt;
#&lt;br /&gt;
# Changes:  in most of the cases you should not modify this&lt;br /&gt;
#           file, but provide customizations in jail.local file,&lt;br /&gt;
#           or separate .conf files under jail.d/ directory, e.g.:&lt;br /&gt;
#&lt;br /&gt;
# HOW TO ACTIVATE JAILS:&lt;br /&gt;
#&lt;br /&gt;
# YOU SHOULD NOT MODIFY THIS FILE.&lt;br /&gt;
#&lt;br /&gt;
# It will probably be overwritten or improved in a distribution update.&lt;br /&gt;
#&lt;br /&gt;
# Provide customizations in a jail.local file or a jail.d/customisation.local.&lt;br /&gt;
# For example to change the default bantime for all jails and to enable the&lt;br /&gt;
# ssh-iptables jail the following (uncommented) would appear in the .local file.&lt;br /&gt;
# See man 5 jail.conf for details.&lt;br /&gt;
#&lt;br /&gt;
# [DEFAULT]&lt;br /&gt;
# bantime = 1h&lt;br /&gt;
#&lt;br /&gt;
# [sshd]&lt;br /&gt;
# enabled = true&lt;br /&gt;
#&lt;br /&gt;
# See jail.conf(5) man page for more information&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Comments: use &#039;#&#039; for comment lines and &#039;;&#039; (following a space) for inline comments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[INCLUDES]&lt;br /&gt;
&lt;br /&gt;
#before = paths-distro.conf&lt;br /&gt;
before = paths-debian.conf&lt;br /&gt;
&lt;br /&gt;
# The DEFAULT allows a global definition of the options. They can be overridden&lt;br /&gt;
# in each jail afterwards.&lt;br /&gt;
&lt;br /&gt;
[DEFAULT]&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# MISCELLANEOUS OPTIONS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.increment&amp;quot; allows to use database for searching of previously banned ip&#039;s to increase a &lt;br /&gt;
# default ban time using special formula, default it is banTime * 1, 2, 4, 8, 16, 32...&lt;br /&gt;
#bantime.increment = true&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.rndtime&amp;quot; is the max number of seconds using for mixing with random time &lt;br /&gt;
# to prevent &amp;quot;clever&amp;quot; botnets calculate exact time IP can be unbanned again:&lt;br /&gt;
#bantime.rndtime = &lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.maxtime&amp;quot; is the max number of seconds using the ban time can reach (don&#039;t grows further)&lt;br /&gt;
#bantime.maxtime = &lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.factor&amp;quot; is a coefficient to calculate exponent growing of the formula or common multiplier,&lt;br /&gt;
# default value of factor is 1 and with default value of formula, the ban time &lt;br /&gt;
# grows by 1, 2, 4, 8, 16 ...&lt;br /&gt;
#bantime.factor = 1&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.formula&amp;quot; used by default to calculate next value of ban time, default value bellow,&lt;br /&gt;
# the same ban time growing will be reached by multipliers 1, 2, 4, 8, 16, 32...&lt;br /&gt;
#bantime.formula = ban.Time * (1&amp;lt;&amp;lt;(ban.Count if ban.Count&amp;lt;20 else 20)) * banFactor&lt;br /&gt;
#&lt;br /&gt;
# more aggressive example of formula has the same values only for factor &amp;quot;2.0 / 2.885385&amp;quot; :&lt;br /&gt;
#bantime.formula = ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.multipliers&amp;quot; used to calculate next value of ban time instead of formula, coresponding &lt;br /&gt;
# previously ban count and given &amp;quot;bantime.factor&amp;quot; (for multipliers default is 1);&lt;br /&gt;
# following example grows ban time by 1, 2, 4, 8, 16 ... and if last ban count greater as multipliers count, &lt;br /&gt;
# always used last multiplier (64 in example), for factor &#039;1&#039; and original ban time 600 - 10.6 hours&lt;br /&gt;
#bantime.multipliers = 1 2 4 8 16 32 64&lt;br /&gt;
# following example can be used for small initial ban time (bantime=60) - it grows more aggressive at begin,&lt;br /&gt;
# for bantime=60 the multipliers are minutes and equal: 1 min, 5 min, 30 min, 1 hour, 5 hour, 12 hour, 1 day, 2 day&lt;br /&gt;
#bantime.multipliers = 1 5 30 60 300 720 1440 2880&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime.overalljails&amp;quot; (if true) specifies the search of IP in the database will be executed &lt;br /&gt;
# cross over all jails, if false (dafault), only current jail of the ban IP will be searched&lt;br /&gt;
#bantime.overalljails = false&lt;br /&gt;
&lt;br /&gt;
# --------------------&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;ignoreself&amp;quot; specifies whether the local resp. own IP addresses should be ignored&lt;br /&gt;
# (default is true). Fail2ban will not ban a host which matches such addresses.&lt;br /&gt;
#ignoreself = true&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;ignoreip&amp;quot; can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban&lt;br /&gt;
# will not ban a host which matches an address in this list. Several addresses&lt;br /&gt;
# can be defined using space (and/or comma) separator.&lt;br /&gt;
#ignoreip = 127.0.0.1/8 ::1&lt;br /&gt;
&lt;br /&gt;
# External command that will take an tagged arguments to ignore, e.g. &amp;lt;ip&amp;gt;,&lt;br /&gt;
# and return true if the IP is to be ignored. False otherwise.&lt;br /&gt;
#&lt;br /&gt;
# ignorecommand = /path/to/command &amp;lt;ip&amp;gt;&lt;br /&gt;
ignorecommand =&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;bantime&amp;quot; is the number of seconds that a host is banned.&lt;br /&gt;
bantime  = 10m&lt;br /&gt;
&lt;br /&gt;
# A host is banned if it has generated &amp;quot;maxretry&amp;quot; during the last &amp;quot;findtime&amp;quot;&lt;br /&gt;
# seconds.&lt;br /&gt;
findtime  = 10m&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;maxretry&amp;quot; is the number of failures before a host get banned.&lt;br /&gt;
maxretry = 5&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;maxmatches&amp;quot; is the number of matches stored in ticket (resolvable via tag &amp;lt;matches&amp;gt; in actions).&lt;br /&gt;
maxmatches = %(maxretry)s&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;backend&amp;quot; specifies the backend used to get files modification.&lt;br /&gt;
# Available options are &amp;quot;pyinotify&amp;quot;, &amp;quot;gamin&amp;quot;, &amp;quot;polling&amp;quot;, &amp;quot;systemd&amp;quot; and &amp;quot;auto&amp;quot;.&lt;br /&gt;
# This option can be overridden in each jail as well.&lt;br /&gt;
#&lt;br /&gt;
# pyinotify: requires pyinotify (a file alteration monitor) to be installed.&lt;br /&gt;
#              If pyinotify is not installed, Fail2ban will use auto.&lt;br /&gt;
# gamin:     requires Gamin (a file alteration monitor) to be installed.&lt;br /&gt;
#              If Gamin is not installed, Fail2ban will use auto.&lt;br /&gt;
# polling:   uses a polling algorithm which does not require external libraries.&lt;br /&gt;
# systemd:   uses systemd python library to access the systemd journal.&lt;br /&gt;
#              Specifying &amp;quot;logpath&amp;quot; is not valid for this backend.&lt;br /&gt;
#              See &amp;quot;journalmatch&amp;quot; in the jails associated filter config&lt;br /&gt;
# auto:      will try to use the following backends, in order:&lt;br /&gt;
#              pyinotify, gamin, polling.&lt;br /&gt;
#&lt;br /&gt;
# Note: if systemd backend is chosen as the default but you enable a jail&lt;br /&gt;
#       for which logs are present only in its own log files, specify some other&lt;br /&gt;
#       backend for that jail (e.g. polling) and provide empty value for&lt;br /&gt;
#       journalmatch. See https://github.com/fail2ban/fail2ban/issues/959#issuecomment-74901200&lt;br /&gt;
backend = auto&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;usedns&amp;quot; specifies if jails should trust hostnames in logs,&lt;br /&gt;
#   warn when DNS lookups are performed, or ignore all hostnames in logs&lt;br /&gt;
#&lt;br /&gt;
# yes:   if a hostname is encountered, a DNS lookup will be performed.&lt;br /&gt;
# warn:  if a hostname is encountered, a DNS lookup will be performed,&lt;br /&gt;
#        but it will be logged as a warning.&lt;br /&gt;
# no:    if a hostname is encountered, will not be used for banning,&lt;br /&gt;
#        but it will be logged as info.&lt;br /&gt;
# raw:   use raw value (no hostname), allow use it for no-host filters/actions (example user)&lt;br /&gt;
usedns = warn&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;logencoding&amp;quot; specifies the encoding of the log files handled by the jail&lt;br /&gt;
#   This is used to decode the lines from the log file.&lt;br /&gt;
#   Typical examples:  &amp;quot;ascii&amp;quot;, &amp;quot;utf-8&amp;quot;&lt;br /&gt;
#&lt;br /&gt;
#   auto:   will use the system locale setting&lt;br /&gt;
logencoding = auto&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;enabled&amp;quot; enables the jails.&lt;br /&gt;
#  By default all jails are disabled, and it should stay this way.&lt;br /&gt;
#  Enable only relevant to your setup jails in your .local or jail.d/*.conf&lt;br /&gt;
#&lt;br /&gt;
# true:  jail will be enabled and log files will get monitored for changes&lt;br /&gt;
# false: jail is not enabled&lt;br /&gt;
enabled = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;mode&amp;quot; defines the mode of the filter (see corresponding filter implementation for more info).&lt;br /&gt;
mode = normal&lt;br /&gt;
&lt;br /&gt;
# &amp;quot;filter&amp;quot; defines the filter to use by the jail.&lt;br /&gt;
#  By default jails have names matching their filter name&lt;br /&gt;
#&lt;br /&gt;
filter = %(__name__)s[mode=%(mode)s]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# ACTIONS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# Some options used for actions&lt;br /&gt;
&lt;br /&gt;
# Destination email address used solely for the interpolations in&lt;br /&gt;
# jail.{conf,local,d/*} configuration files.&lt;br /&gt;
destemail = root@localhost&lt;br /&gt;
&lt;br /&gt;
# Sender email address used solely for some actions&lt;br /&gt;
sender = root@&amp;lt;fq-hostname&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# E-mail action. Since 0.8.1 Fail2Ban uses sendmail MTA for the&lt;br /&gt;
# mailing. Change mta configuration parameter to mail if you want to&lt;br /&gt;
# revert to conventional &#039;mail&#039;.&lt;br /&gt;
mta = sendmail&lt;br /&gt;
&lt;br /&gt;
# Default protocol&lt;br /&gt;
protocol = tcp&lt;br /&gt;
&lt;br /&gt;
# Specify chain where jumps would need to be added in ban-actions expecting parameter chain&lt;br /&gt;
chain = &amp;lt;known/chain&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Ports to be banned&lt;br /&gt;
# Usually should be overridden in a particular jail&lt;br /&gt;
port = 0:65535&lt;br /&gt;
&lt;br /&gt;
# Format of user-agent https://tools.ietf.org/html/rfc7231#section-5.5.3&lt;br /&gt;
fail2ban_agent = Fail2Ban/%(fail2ban_version)s&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Action shortcuts. To be used to define action parameter&lt;br /&gt;
&lt;br /&gt;
# Default banning action (e.g. iptables, iptables-new,&lt;br /&gt;
# iptables-multiport, shorewall, etc) It is used to define&lt;br /&gt;
# action_* variables. Can be overridden globally or per&lt;br /&gt;
# section within jail.local file&lt;br /&gt;
banaction = iptables-multiport&lt;br /&gt;
banaction_allports = iptables-allports&lt;br /&gt;
&lt;br /&gt;
# The simplest action to take: ban only&lt;br /&gt;
action_ = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# ban &amp;amp; send an e-mail with whois report to the destemail.&lt;br /&gt;
action_mw = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
            %(mta)s-whois[name=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, dest=&amp;quot;%(destemail)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# ban &amp;amp; send an e-mail with whois report and relevant log lines&lt;br /&gt;
# to the destemail.&lt;br /&gt;
action_mwl = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
             %(mta)s-whois-lines[name=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, dest=&amp;quot;%(destemail)s&amp;quot;, logpath=&amp;quot;%(logpath)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# See the IMPORTANT note in action.d/xarf-login-attack for when to use this action&lt;br /&gt;
#&lt;br /&gt;
# ban &amp;amp; send a xarf e-mail to abuse contact of IP address and include relevant log lines&lt;br /&gt;
# to the destemail.&lt;br /&gt;
action_xarf = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
             xarf-login-attack[service=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, logpath=&amp;quot;%(logpath)s&amp;quot;, port=&amp;quot;%(port)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# ban IP on CloudFlare &amp;amp; send an e-mail with whois report and relevant log lines&lt;br /&gt;
# to the destemail.&lt;br /&gt;
action_cf_mwl = cloudflare[cfuser=&amp;quot;%(cfemail)s&amp;quot;, cftoken=&amp;quot;%(cfapikey)s&amp;quot;]&lt;br /&gt;
                %(mta)s-whois-lines[name=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, dest=&amp;quot;%(destemail)s&amp;quot;, logpath=&amp;quot;%(logpath)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# Report block via blocklist.de fail2ban reporting service API&lt;br /&gt;
# &lt;br /&gt;
# See the IMPORTANT note in action.d/blocklist_de.conf for when to use this action.&lt;br /&gt;
# Specify expected parameters in file action.d/blocklist_de.local or if the interpolation&lt;br /&gt;
# `action_blocklist_de` used for the action, set value of `blocklist_de_apikey`&lt;br /&gt;
# in your `jail.local` globally (section [DEFAULT]) or per specific jail section (resp. in &lt;br /&gt;
# corresponding jail.d/my-jail.local file).&lt;br /&gt;
#&lt;br /&gt;
action_blocklist_de  = blocklist_de[email=&amp;quot;%(sender)s&amp;quot;, service=%(filter)s, apikey=&amp;quot;%(blocklist_de_apikey)s&amp;quot;, agent=&amp;quot;%(fail2ban_agent)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# Report ban via badips.com, and use as blacklist&lt;br /&gt;
#&lt;br /&gt;
# See BadIPsAction docstring in config/action.d/badips.py for&lt;br /&gt;
# documentation for this action.&lt;br /&gt;
#&lt;br /&gt;
# NOTE: This action relies on banaction being present on start and therefore&lt;br /&gt;
# should be last action defined for a jail.&lt;br /&gt;
#&lt;br /&gt;
action_badips = badips.py[category=&amp;quot;%(__name__)s&amp;quot;, banaction=&amp;quot;%(banaction)s&amp;quot;, agent=&amp;quot;%(fail2ban_agent)s&amp;quot;]&lt;br /&gt;
#&lt;br /&gt;
# Report ban via badips.com (uses action.d/badips.conf for reporting only)&lt;br /&gt;
#&lt;br /&gt;
action_badips_report = badips[category=&amp;quot;%(__name__)s&amp;quot;, agent=&amp;quot;%(fail2ban_agent)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
# Report ban via abuseipdb.com.&lt;br /&gt;
#&lt;br /&gt;
# See action.d/abuseipdb.conf for usage example and details.&lt;br /&gt;
#&lt;br /&gt;
action_abuseipdb = abuseipdb&lt;br /&gt;
&lt;br /&gt;
# Choose default action.  To change, just override value of &#039;action&#039; with the&lt;br /&gt;
# interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc) in jail.local&lt;br /&gt;
# globally (section [DEFAULT]) or per specific section&lt;br /&gt;
action = %(action_)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# JAILS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# SSH servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[sshd]&lt;br /&gt;
&lt;br /&gt;
# To use more aggressive sshd modes set filter parameter &amp;quot;mode&amp;quot; in jail.local:&lt;br /&gt;
# normal (default), ddos, extra or aggressive (combines all).&lt;br /&gt;
# See &amp;quot;tests/files/logs/sshd&amp;quot; or &amp;quot;filter.d/sshd.conf&amp;quot; for usage example and details.&lt;br /&gt;
#mode   = normal&lt;br /&gt;
port    = ssh&lt;br /&gt;
logpath = %(sshd_log)s&lt;br /&gt;
backend = %(sshd_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[dropbear]&lt;br /&gt;
&lt;br /&gt;
port     = ssh&lt;br /&gt;
logpath  = %(dropbear_log)s&lt;br /&gt;
backend  = %(dropbear_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[selinux-ssh]&lt;br /&gt;
&lt;br /&gt;
port     = ssh&lt;br /&gt;
logpath  = %(auditd_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# HTTP servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[apache-auth]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_error_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-badbots]&lt;br /&gt;
# Ban hosts which agent identifies spammer robots crawling the web&lt;br /&gt;
# for email addresses. The mail outputs are buffered.&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_access_log)s&lt;br /&gt;
bantime  = 48h&lt;br /&gt;
maxretry = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-noscript]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_error_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-overflows]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_error_log)s&lt;br /&gt;
maxretry = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-nohome]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_error_log)s&lt;br /&gt;
maxretry = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-botsearch]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_error_log)s&lt;br /&gt;
maxretry = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-fakegooglebot]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_access_log)s&lt;br /&gt;
maxretry = 1&lt;br /&gt;
ignorecommand = %(ignorecommands_dir)s/apache-fakegooglebot &amp;lt;ip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-modsecurity]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(apache_error_log)s&lt;br /&gt;
maxretry = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[apache-shellshock]&lt;br /&gt;
&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(apache_error_log)s&lt;br /&gt;
maxretry = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[openhab-auth]&lt;br /&gt;
&lt;br /&gt;
filter = openhab&lt;br /&gt;
action = iptables-allports[name=NoAuthFailures]&lt;br /&gt;
logpath = /opt/openhab/logs/request.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[nginx-http-auth]&lt;br /&gt;
&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(nginx_error_log)s&lt;br /&gt;
&lt;br /&gt;
# To use &#039;nginx-limit-req&#039; jail you should have `ngx_http_limit_req_module` &lt;br /&gt;
# and define `limit_req` and `limit_req_zone` as described in nginx documentation&lt;br /&gt;
# http://nginx.org/en/docs/http/ngx_http_limit_req_module.html&lt;br /&gt;
# or for example see in &#039;config/filter.d/nginx-limit-req.conf&#039;&lt;br /&gt;
[nginx-limit-req]&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(nginx_error_log)s&lt;br /&gt;
&lt;br /&gt;
[nginx-botsearch]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(nginx_error_log)s&lt;br /&gt;
maxretry = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Ban attackers that try to use PHP&#039;s URL-fopen() functionality&lt;br /&gt;
# through GET/POST variables. - Experimental, with more than a year&lt;br /&gt;
# of usage in production environments.&lt;br /&gt;
&lt;br /&gt;
[php-url-fopen]&lt;br /&gt;
&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(nginx_access_log)s&lt;br /&gt;
          %(apache_access_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[suhosin]&lt;br /&gt;
&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(suhosin_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[lighttpd-auth]&lt;br /&gt;
# Same as above for Apache&#039;s mod_auth&lt;br /&gt;
# It catches wrong authentifications&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(lighttpd_error_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Webmail and groupware servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[roundcube-auth]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(roundcube_errors_log)s&lt;br /&gt;
# Use following line in your jail.local if roundcube logs to journal.&lt;br /&gt;
#backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[openwebmail]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = /var/log/openwebmail.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[horde]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = /var/log/horde/horde.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[groupoffice]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = /home/groupoffice/log/info.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[sogo-auth]&lt;br /&gt;
# Monitor SOGo groupware server&lt;br /&gt;
# without proxy this would be:&lt;br /&gt;
# port    = 20000&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = /var/log/sogo/sogo.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[tine20]&lt;br /&gt;
&lt;br /&gt;
logpath  = /var/log/tine20/tine20.log&lt;br /&gt;
port     = http,https&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Web Applications&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[drupal-auth]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = %(syslog_daemon)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
[guacamole]&lt;br /&gt;
&lt;br /&gt;
port     = http,https&lt;br /&gt;
logpath  = /var/log/tomcat*/catalina.out&lt;br /&gt;
&lt;br /&gt;
[monit]&lt;br /&gt;
#Ban clients brute-forcing the monit gui login&lt;br /&gt;
port = 2812&lt;br /&gt;
logpath  = /var/log/monit&lt;br /&gt;
           /var/log/monit.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[webmin-auth]&lt;br /&gt;
&lt;br /&gt;
port    = 10000&lt;br /&gt;
logpath = %(syslog_authpriv)s&lt;br /&gt;
backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[froxlor-auth]&lt;br /&gt;
&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath  = %(syslog_authpriv)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# HTTP Proxy servers&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[squid]&lt;br /&gt;
&lt;br /&gt;
port     =  80,443,3128,8080&lt;br /&gt;
logpath = /var/log/squid/access.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[3proxy]&lt;br /&gt;
&lt;br /&gt;
port    = 3128&lt;br /&gt;
logpath = /var/log/3proxy.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# FTP servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[proftpd]&lt;br /&gt;
&lt;br /&gt;
port     = ftp,ftp-data,ftps,ftps-data&lt;br /&gt;
logpath  = %(proftpd_log)s&lt;br /&gt;
backend  = %(proftpd_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[pure-ftpd]&lt;br /&gt;
&lt;br /&gt;
port     = ftp,ftp-data,ftps,ftps-data&lt;br /&gt;
logpath  = %(pureftpd_log)s&lt;br /&gt;
backend  = %(pureftpd_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[gssftpd]&lt;br /&gt;
&lt;br /&gt;
port     = ftp,ftp-data,ftps,ftps-data&lt;br /&gt;
logpath  = %(syslog_daemon)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[wuftpd]&lt;br /&gt;
&lt;br /&gt;
port     = ftp,ftp-data,ftps,ftps-data&lt;br /&gt;
logpath  = %(wuftpd_log)s&lt;br /&gt;
backend  = %(wuftpd_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[vsftpd]&lt;br /&gt;
# or overwrite it in jails.local to be&lt;br /&gt;
# logpath = %(syslog_authpriv)s&lt;br /&gt;
# if you want to rely on PAM failed login attempts&lt;br /&gt;
# vsftpd&#039;s failregex should match both of those formats&lt;br /&gt;
port     = ftp,ftp-data,ftps,ftps-data&lt;br /&gt;
logpath  = %(vsftpd_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Mail servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# ASSP SMTP Proxy Jail&lt;br /&gt;
[assp]&lt;br /&gt;
&lt;br /&gt;
port     = smtp,465,submission&lt;br /&gt;
logpath  = /root/path/to/assp/logs/maillog.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[courier-smtp]&lt;br /&gt;
&lt;br /&gt;
port     = smtp,465,submission&lt;br /&gt;
logpath  = %(syslog_mail)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[postfix]&lt;br /&gt;
# To use another modes set filter parameter &amp;quot;mode&amp;quot; in jail.local:&lt;br /&gt;
mode    = more&lt;br /&gt;
port    = smtp,465,submission&lt;br /&gt;
logpath = %(postfix_log)s&lt;br /&gt;
backend = %(postfix_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[postfix-rbl]&lt;br /&gt;
&lt;br /&gt;
filter   = postfix[mode=rbl]&lt;br /&gt;
port     = smtp,465,submission&lt;br /&gt;
logpath  = %(postfix_log)s&lt;br /&gt;
backend  = %(postfix_backend)s&lt;br /&gt;
maxretry = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[sendmail-auth]&lt;br /&gt;
&lt;br /&gt;
port    = submission,465,smtp&lt;br /&gt;
logpath = %(syslog_mail)s&lt;br /&gt;
backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[sendmail-reject]&lt;br /&gt;
# To use more aggressive modes set filter parameter &amp;quot;mode&amp;quot; in jail.local:&lt;br /&gt;
# normal (default), extra or aggressive&lt;br /&gt;
# See &amp;quot;tests/files/logs/sendmail-reject&amp;quot; or &amp;quot;filter.d/sendmail-reject.conf&amp;quot; for usage example and details.&lt;br /&gt;
#mode    = normal&lt;br /&gt;
port     = smtp,465,submission&lt;br /&gt;
logpath  = %(syslog_mail)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[qmail-rbl]&lt;br /&gt;
&lt;br /&gt;
filter  = qmail&lt;br /&gt;
port    = smtp,465,submission&lt;br /&gt;
logpath = /service/qmail/log/main/current&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# dovecot defaults to logging to the mail syslog facility&lt;br /&gt;
# but can be set by syslog_facility in the dovecot configuration.&lt;br /&gt;
[dovecot]&lt;br /&gt;
&lt;br /&gt;
port    = pop3,pop3s,imap,imaps,submission,465,sieve&lt;br /&gt;
logpath = %(dovecot_log)s&lt;br /&gt;
backend = %(dovecot_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[sieve]&lt;br /&gt;
&lt;br /&gt;
port   = smtp,465,submission&lt;br /&gt;
logpath = %(dovecot_log)s&lt;br /&gt;
backend = %(dovecot_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[solid-pop3d]&lt;br /&gt;
&lt;br /&gt;
port    = pop3,pop3s&lt;br /&gt;
logpath = %(solidpop3d_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[exim]&lt;br /&gt;
# see filter.d/exim.conf for further modes supported from filter:&lt;br /&gt;
#mode = normal&lt;br /&gt;
port   = smtp,465,submission&lt;br /&gt;
logpath = %(exim_main_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[exim-spam]&lt;br /&gt;
&lt;br /&gt;
port   = smtp,465,submission&lt;br /&gt;
logpath = %(exim_main_log)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[kerio]&lt;br /&gt;
&lt;br /&gt;
port    = imap,smtp,imaps,465&lt;br /&gt;
logpath = /opt/kerio/mailserver/store/logs/security.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Mail servers authenticators: might be used for smtp,ftp,imap servers, so&lt;br /&gt;
# all relevant ports get banned&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[courier-auth]&lt;br /&gt;
&lt;br /&gt;
port     = smtp,465,submission,imap,imaps,pop3,pop3s&lt;br /&gt;
logpath  = %(syslog_mail)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[postfix-sasl]&lt;br /&gt;
&lt;br /&gt;
filter   = postfix[mode=auth]&lt;br /&gt;
port     = smtp,465,submission,imap,imaps,pop3,pop3s&lt;br /&gt;
# You might consider monitoring /var/log/mail.warn instead if you are&lt;br /&gt;
# running postfix since it would provide the same log lines at the&lt;br /&gt;
# &amp;quot;warn&amp;quot; level but overall at the smaller filesize.&lt;br /&gt;
logpath  = %(postfix_log)s&lt;br /&gt;
backend  = %(postfix_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[perdition]&lt;br /&gt;
&lt;br /&gt;
port   = imap,imaps,pop3,pop3s&lt;br /&gt;
logpath = %(syslog_mail)s&lt;br /&gt;
backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[squirrelmail]&lt;br /&gt;
&lt;br /&gt;
port = smtp,465,submission,imap,imap2,imaps,pop3,pop3s,http,https,socks&lt;br /&gt;
logpath = /var/lib/squirrelmail/prefs/squirrelmail_access_log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[cyrus-imap]&lt;br /&gt;
&lt;br /&gt;
port   = imap,imaps&lt;br /&gt;
logpath = %(syslog_mail)s&lt;br /&gt;
backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[uwimap-auth]&lt;br /&gt;
&lt;br /&gt;
port   = imap,imaps&lt;br /&gt;
logpath = %(syslog_mail)s&lt;br /&gt;
backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
# DNS servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# !!! WARNING !!!&lt;br /&gt;
#   Since UDP is connection-less protocol, spoofing of IP and imitation&lt;br /&gt;
#   of illegal actions is way too simple.  Thus enabling of this filter&lt;br /&gt;
#   might provide an easy way for implementing a DoS against a chosen&lt;br /&gt;
#   victim. See&lt;br /&gt;
#    http://nion.modprobe.de/blog/archives/690-fail2ban-+-dns-fail.html&lt;br /&gt;
#   Please DO NOT USE this jail unless you know what you are doing.&lt;br /&gt;
#&lt;br /&gt;
# IMPORTANT: see filter.d/named-refused for instructions to enable logging&lt;br /&gt;
# This jail blocks UDP traffic for DNS requests.&lt;br /&gt;
# [named-refused-udp]&lt;br /&gt;
#&lt;br /&gt;
# filter   = named-refused&lt;br /&gt;
# port     = domain,953&lt;br /&gt;
# protocol = udp&lt;br /&gt;
# logpath  = /var/log/named/security.log&lt;br /&gt;
&lt;br /&gt;
# IMPORTANT: see filter.d/named-refused for instructions to enable logging&lt;br /&gt;
# This jail blocks TCP traffic for DNS requests.&lt;br /&gt;
&lt;br /&gt;
[named-refused]&lt;br /&gt;
&lt;br /&gt;
port     = domain,953&lt;br /&gt;
logpath  = /var/log/named/security.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[nsd]&lt;br /&gt;
&lt;br /&gt;
port     = 53&lt;br /&gt;
action   = %(banaction)s[name=%(__name__)s-tcp, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;tcp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
           %(banaction)s[name=%(__name__)s-udp, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;udp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
logpath = /var/log/nsd.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# Miscellaneous&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[asterisk]&lt;br /&gt;
&lt;br /&gt;
port     = 5060,5061&lt;br /&gt;
action   = %(banaction)s[name=%(__name__)s-tcp, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;tcp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
           %(banaction)s[name=%(__name__)s-udp, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;udp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
           %(mta)s-whois[name=%(__name__)s, dest=&amp;quot;%(destemail)s&amp;quot;]&lt;br /&gt;
logpath  = /var/log/asterisk/messages&lt;br /&gt;
maxretry = 10&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[freeswitch]&lt;br /&gt;
&lt;br /&gt;
port     = 5060,5061&lt;br /&gt;
action   = %(banaction)s[name=%(__name__)s-tcp, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;tcp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
           %(banaction)s[name=%(__name__)s-udp, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;udp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
           %(mta)s-whois[name=%(__name__)s, dest=&amp;quot;%(destemail)s&amp;quot;]&lt;br /&gt;
logpath  = /var/log/freeswitch.log&lt;br /&gt;
maxretry = 10&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# enable adminlog; it will log to a file inside znc&#039;s directory by default.&lt;br /&gt;
[znc-adminlog]&lt;br /&gt;
&lt;br /&gt;
port     = 6667&lt;br /&gt;
logpath  = /var/lib/znc/moddata/adminlog/znc.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# To log wrong MySQL access attempts add to /etc/my.cnf in [mysqld] or&lt;br /&gt;
# equivalent section:&lt;br /&gt;
# log-warnings = 2&lt;br /&gt;
#&lt;br /&gt;
# for syslog (daemon facility)&lt;br /&gt;
# [mysqld_safe]&lt;br /&gt;
# syslog&lt;br /&gt;
#&lt;br /&gt;
# for own logfile&lt;br /&gt;
# [mysqld]&lt;br /&gt;
# log-error=/var/log/mysqld.log&lt;br /&gt;
[mysqld-auth]&lt;br /&gt;
&lt;br /&gt;
port     = 3306&lt;br /&gt;
logpath  = %(mysql_log)s&lt;br /&gt;
backend  = %(mysql_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Log wrong MongoDB auth (for details see filter &#039;filter.d/mongodb-auth.conf&#039;)&lt;br /&gt;
[mongodb-auth]&lt;br /&gt;
# change port when running with &amp;quot;--shardsvr&amp;quot; or &amp;quot;--configsvr&amp;quot; runtime operation&lt;br /&gt;
port     = 27017&lt;br /&gt;
logpath  = /var/log/mongodb/mongodb.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Jail for more extended banning of persistent abusers&lt;br /&gt;
# !!! WARNINGS !!!&lt;br /&gt;
# 1. Make sure that your loglevel specified in fail2ban.conf/.local&lt;br /&gt;
#    is not at DEBUG level -- which might then cause fail2ban to fall into&lt;br /&gt;
#    an infinite loop constantly feeding itself with non-informative lines&lt;br /&gt;
# 2. Increase dbpurgeage defined in fail2ban.conf to e.g. 648000 (7.5 days)&lt;br /&gt;
#    to maintain entries for failed logins for sufficient amount of time&lt;br /&gt;
[recidive]&lt;br /&gt;
&lt;br /&gt;
logpath  = /var/log/fail2ban.log&lt;br /&gt;
banaction = %(banaction_allports)s&lt;br /&gt;
bantime  = 1w&lt;br /&gt;
findtime = 1d&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Generic filter for PAM. Has to be used with action which bans all&lt;br /&gt;
# ports such as iptables-allports, shorewall&lt;br /&gt;
&lt;br /&gt;
[pam-generic]&lt;br /&gt;
# pam-generic filter can be customized to monitor specific subset of &#039;tty&#039;s&lt;br /&gt;
banaction = %(banaction_allports)s&lt;br /&gt;
logpath  = %(syslog_authpriv)s&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[xinetd-fail]&lt;br /&gt;
&lt;br /&gt;
banaction = iptables-multiport-log&lt;br /&gt;
logpath   = %(syslog_daemon)s&lt;br /&gt;
backend   = %(syslog_backend)s&lt;br /&gt;
maxretry  = 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# stunnel - need to set port for this&lt;br /&gt;
[stunnel]&lt;br /&gt;
&lt;br /&gt;
logpath = /var/log/stunnel4/stunnel.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[ejabberd-auth]&lt;br /&gt;
&lt;br /&gt;
port    = 5222&lt;br /&gt;
logpath = /var/log/ejabberd/ejabberd.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[counter-strike]&lt;br /&gt;
&lt;br /&gt;
logpath = /opt/cstrike/logs/L[0-9]*.log&lt;br /&gt;
# Firewall: http://www.cstrike-planet.com/faq/6&lt;br /&gt;
tcpport = 27030,27031,27032,27033,27034,27035,27036,27037,27038,27039&lt;br /&gt;
udpport = 1200,27000,27001,27002,27003,27004,27005,27006,27007,27008,27009,27010,27011,27012,27013,27014,27015&lt;br /&gt;
action  = %(banaction)s[name=%(__name__)s-tcp, port=&amp;quot;%(tcpport)s&amp;quot;, protocol=&amp;quot;tcp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
           %(banaction)s[name=%(__name__)s-udp, port=&amp;quot;%(udpport)s&amp;quot;, protocol=&amp;quot;udp&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
&lt;br /&gt;
[bitwarden]&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = /home/*/bwdata/logs/identity/Identity/log.txt&lt;br /&gt;
&lt;br /&gt;
[centreon]&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = /var/log/centreon/login.log&lt;br /&gt;
&lt;br /&gt;
# consider low maxretry and a long bantime&lt;br /&gt;
# nobody except your own Nagios server should ever probe nrpe&lt;br /&gt;
[nagios]&lt;br /&gt;
&lt;br /&gt;
logpath  = %(syslog_daemon)s     ; nrpe.cfg may define a different log_facility&lt;br /&gt;
backend  = %(syslog_backend)s&lt;br /&gt;
maxretry = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[oracleims]&lt;br /&gt;
# see &amp;quot;oracleims&amp;quot; filter file for configuration requirement for Oracle IMS v6 and above&lt;br /&gt;
logpath = /opt/sun/comms/messaging64/log/mail.log_current&lt;br /&gt;
banaction = %(banaction_allports)s&lt;br /&gt;
&lt;br /&gt;
[directadmin]&lt;br /&gt;
logpath = /var/log/directadmin/login.log&lt;br /&gt;
port = 2222&lt;br /&gt;
&lt;br /&gt;
[portsentry]&lt;br /&gt;
logpath  = /var/lib/portsentry/portsentry.history&lt;br /&gt;
maxretry = 1&lt;br /&gt;
&lt;br /&gt;
[pass2allow-ftp]&lt;br /&gt;
# this pass2allow example allows FTP traffic after successful HTTP authentication&lt;br /&gt;
port         = ftp,ftp-data,ftps,ftps-data&lt;br /&gt;
# knocking_url variable must be overridden to some secret value in jail.local&lt;br /&gt;
knocking_url = /knocking/&lt;br /&gt;
filter       = apache-pass[knocking_url=&amp;quot;%(knocking_url)s&amp;quot;]&lt;br /&gt;
# access log of the website with HTTP auth&lt;br /&gt;
logpath      = %(apache_access_log)s&lt;br /&gt;
blocktype    = RETURN&lt;br /&gt;
returntype   = DROP&lt;br /&gt;
action       = %(action_)s[blocktype=%(blocktype)s, returntype=%(returntype)s,&lt;br /&gt;
                        actionstart_on_demand=false, actionrepair_on_unban=true]&lt;br /&gt;
bantime      = 1h&lt;br /&gt;
maxretry     = 1&lt;br /&gt;
findtime     = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[murmur]&lt;br /&gt;
# AKA mumble-server&lt;br /&gt;
port     = 64738&lt;br /&gt;
action   = %(banaction)s[name=%(__name__)s-tcp, port=&amp;quot;%(port)s&amp;quot;, protocol=tcp, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
           %(banaction)s[name=%(__name__)s-udp, port=&amp;quot;%(port)s&amp;quot;, protocol=udp, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
logpath  = /var/log/mumble-server/mumble-server.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[screensharingd]&lt;br /&gt;
# For Mac OS Screen Sharing Service (VNC)&lt;br /&gt;
logpath  = /var/log/system.log&lt;br /&gt;
logencoding = utf-8&lt;br /&gt;
&lt;br /&gt;
[haproxy-http-auth]&lt;br /&gt;
# HAProxy by default doesn&#039;t log to file you&#039;ll need to set it up to forward&lt;br /&gt;
# logs to a syslog server which would then write them to disk.&lt;br /&gt;
# See &amp;quot;haproxy-http-auth&amp;quot; filter for a brief cautionary note when setting&lt;br /&gt;
# maxretry and findtime.&lt;br /&gt;
logpath  = /var/log/haproxy.log&lt;br /&gt;
&lt;br /&gt;
[slapd]&lt;br /&gt;
port    = ldap,ldaps&lt;br /&gt;
logpath = /var/log/slapd.log&lt;br /&gt;
&lt;br /&gt;
[domino-smtp]&lt;br /&gt;
port    = smtp,ssmtp&lt;br /&gt;
logpath = /home/domino01/data/IBM_TECHNICAL_SUPPORT/console.log&lt;br /&gt;
&lt;br /&gt;
[phpmyadmin-syslog]&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(syslog_authpriv)s&lt;br /&gt;
backend = %(syslog_backend)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[zoneminder]&lt;br /&gt;
# Zoneminder HTTP/HTTPS web interface auth&lt;br /&gt;
# Logs auth failures to apache2 error log&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = %(apache_error_log)s&lt;br /&gt;
&lt;br /&gt;
[traefik-auth]&lt;br /&gt;
# to use &#039;traefik-auth&#039; filter you have to configure your Traefik instance,&lt;br /&gt;
# see `filter.d/traefik-auth.conf` for details and service example.&lt;br /&gt;
port    = http,https&lt;br /&gt;
logpath = /var/log/traefik/access.log&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Default &amp;lt;code&amp;gt;/etc/fail2ban/jail.local&amp;lt;/code&amp;gt; file with (almost all) comments removed:&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible&amp;quot; style=&amp;quot;width:400px; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight:bold;line-height:1.6;&amp;quot;&amp;gt;Default &amp;lt;code&amp;gt;/etc/fail2ban/jail.local&amp;lt;/code&amp;gt; with (almost) comments removed:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[INCLUDES]&lt;br /&gt;
&lt;br /&gt;
before = paths-debian.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[DEFAULT]&lt;br /&gt;
&lt;br /&gt;
ignorecommand =&lt;br /&gt;
&lt;br /&gt;
bantime  = 10m&lt;br /&gt;
&lt;br /&gt;
findtime  = 10m&lt;br /&gt;
&lt;br /&gt;
maxretry = 5&lt;br /&gt;
&lt;br /&gt;
maxmatches = %(maxretry)s&lt;br /&gt;
&lt;br /&gt;
backend = auto&lt;br /&gt;
&lt;br /&gt;
usedns = warn&lt;br /&gt;
&lt;br /&gt;
logencoding = auto&lt;br /&gt;
&lt;br /&gt;
enabled = false&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
mode = normal&lt;br /&gt;
&lt;br /&gt;
filter = %(__name__)s[mode=%(mode)s]&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# ACTIONS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
destemail = root@localhost&lt;br /&gt;
&lt;br /&gt;
sender = root@&amp;lt;fq-hostname&amp;gt;&lt;br /&gt;
&lt;br /&gt;
mta = sendmail&lt;br /&gt;
&lt;br /&gt;
protocol = tcp&lt;br /&gt;
&lt;br /&gt;
chain = &amp;lt;known/chain&amp;gt;&lt;br /&gt;
&lt;br /&gt;
port = 0:65535&lt;br /&gt;
&lt;br /&gt;
fail2ban_agent = Fail2Ban/%(fail2ban_version)s&lt;br /&gt;
&lt;br /&gt;
banaction = iptables-multiport&lt;br /&gt;
banaction_allports = iptables-allports&lt;br /&gt;
&lt;br /&gt;
action_ = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_mw = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
            %(mta)s-whois[name=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, dest=&amp;quot;%(destemail)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_mwl = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
             %(mta)s-whois-lines[name=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, dest=&amp;quot;%(destemail)s&amp;quot;, logpath=&amp;quot;%(logpath)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_xarf = %(banaction)s[name=%(__name__)s, port=&amp;quot;%(port)s&amp;quot;, protocol=&amp;quot;%(protocol)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
             xarf-login-attack[service=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, logpath=&amp;quot;%(logpath)s&amp;quot;, port=&amp;quot;%(port)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_cf_mwl = cloudflare[cfuser=&amp;quot;%(cfemail)s&amp;quot;, cftoken=&amp;quot;%(cfapikey)s&amp;quot;]&lt;br /&gt;
                %(mta)s-whois-lines[name=%(__name__)s, sender=&amp;quot;%(sender)s&amp;quot;, dest=&amp;quot;%(destemail)s&amp;quot;, logpath=&amp;quot;%(logpath)s&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_blocklist_de  = blocklist_de[email=&amp;quot;%(sender)s&amp;quot;, service=%(filter)s, apikey=&amp;quot;%(blocklist_de_apikey)s&amp;quot;, agent=&amp;quot;%(fail2ban_agent)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_badips = badips.py[category=&amp;quot;%(__name__)s&amp;quot;, banaction=&amp;quot;%(banaction)s&amp;quot;, agent=&amp;quot;%(fail2ban_agent)s&amp;quot;]&lt;br /&gt;
action_badips_report = badips[category=&amp;quot;%(__name__)s&amp;quot;, agent=&amp;quot;%(fail2ban_agent)s&amp;quot;]&lt;br /&gt;
&lt;br /&gt;
action_abuseipdb = abuseipdb&lt;br /&gt;
&lt;br /&gt;
action = %(action_)s&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# JAILS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# SSH servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
[sshd]&lt;br /&gt;
&lt;br /&gt;
port    = ssh&lt;br /&gt;
logpath = %(sshd_log)s&lt;br /&gt;
backend = %(sshd_backend)s&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Disconnect/kick and ban an ip from list====&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
Just below we are going to append these lines to &amp;lt;b&amp;gt;/etc/fail2ban/jail.local&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Reject/Disconnect Connections that failed username password&lt;br /&gt;
_action_tcp_udp = %(banaction)s[name=%(__name__)s-tcp, protocol=&amp;quot;tcp&amp;quot;, port=&amp;quot;%(port)s&amp;quot;, blocktype=&amp;quot;REJECT --reject-with tcp-reset&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
    %(banaction)s[name=%(__name__)s-udp, protocol=&amp;quot;udp&amp;quot;, port=&amp;quot;%(port)s&amp;quot;, blocktype=&amp;quot;REJECT --reject-with icmp-port-unreachable&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
actionx = %(_action_tcp_udp)s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Before Changes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Choose default action.  To change, just override value of &#039;action&#039; with the&lt;br /&gt;
# interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc) in jail.local&lt;br /&gt;
# globally (section [DEFAULT]) or per specific section&lt;br /&gt;
action = %(action_)s&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# JAILS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# SSH servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
After Changes:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Choose default action.  To change, just override value of &#039;action&#039; with the&lt;br /&gt;
# interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc) in jail.local&lt;br /&gt;
# globally (section [DEFAULT]) or per specific section&lt;br /&gt;
action = %(action_)s&lt;br /&gt;
&lt;br /&gt;
# Reject/Disconnect Connections that failed username password&lt;br /&gt;
_action_tcp_udp = %(banaction)s[name=%(__name__)s-tcp, protocol=&amp;quot;tcp&amp;quot;, port=&amp;quot;%(port)s&amp;quot;, blocktype=&amp;quot;REJECT --reject-with tcp-reset&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
    %(banaction)s[name=%(__name__)s-udp, protocol=&amp;quot;udp&amp;quot;, port=&amp;quot;%(port)s&amp;quot;, blocktype=&amp;quot;REJECT --reject-with icmp-port-unreachable&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
actionx = %(_action_tcp_udp)s&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# JAILS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# SSH servers&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Jail for MediaWiki - /etc/fail2ban/jail.local====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mediawiki]&lt;br /&gt;
&lt;br /&gt;
enabled = true&lt;br /&gt;
filter = mediawiki&lt;br /&gt;
action = iptables-allports&lt;br /&gt;
bantime = 1m&lt;br /&gt;
maxretry = 2&lt;br /&gt;
logpath = /var/log/Fail2Log.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Before:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# JAILS&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
# SSH servers&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
After:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
# JAILS&lt;br /&gt;
#&lt;br /&gt;
[mediawiki]&lt;br /&gt;
&lt;br /&gt;
enabled = true&lt;br /&gt;
filter = mediawiki&lt;br /&gt;
action = iptables-allports&lt;br /&gt;
bantime = 1h&lt;br /&gt;
maxretry = 20&lt;br /&gt;
logpath = /var/log/Fail2Log.log&lt;br /&gt;
#&lt;br /&gt;
# SSH servers&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Filter for mediawiki====&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Regex quick up and running tutorial: External Link:(youtube)&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
This Is a link to a video made by &amp;quot;Corey Schafer&amp;quot;.&amp;lt;br \&amp;gt;&lt;br /&gt;
The best no nonsense up and running regex tut there is.&amp;lt;br \&amp;gt;&lt;br /&gt;
https://www.youtube.com/watch?v=sa-TUpSx1JA&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/fail2ban/filter.d/mediawiki.conf&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Definition]&lt;br /&gt;
&lt;br /&gt;
failregex = ^Failed:&amp;lt;HOST&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ignoreregex =&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Try out regex on log file=====&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-regex --print-all-matched /var/log/Fail2Log.log /etc/fail2ban/filter.d/mediawiki.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Restart Fail2Ban====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart fail2ban&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client status&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client status mediawiki&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Now test by trying to login to your wiki with wrong password three times.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====fail2ban regex and error checking=====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Check regex:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Syntax: &amp;lt;code&amp;gt;fail2ban-regex &amp;lt;logfile&amp;gt; &amp;lt;failregex&amp;gt; &amp;lt;ignoreregex&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
** Example: &amp;lt;code&amp;gt;fail2ban-regex /var/log/nginx/error.log /etc/fail2ban/filter.d/nginx-correct-up.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you want to test &amp;lt;code&amp;gt;ignoreregex&amp;lt;/code&amp;gt; enter filter file twice:&lt;br /&gt;
** Example: &amp;lt;code&amp;gt;fail2ban-regex /var/log/nginx/error.log /etc/fail2ban/filter.d/nginx-correct-up.conf /etc/fail2ban/filter.d/nginx-correct-up.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* Read &amp;lt;code&amp;gt;man fail2ban-regex&amp;lt;/code&amp;gt; for some more opitions:&lt;br /&gt;
* Examples: &lt;br /&gt;
** &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt;&lt;br /&gt;
*** Be verbose in output&lt;br /&gt;
** &amp;lt;code&amp;gt;--print-all-missed&amp;lt;/code&amp;gt;&lt;br /&gt;
*** Print all missed lines&lt;br /&gt;
**  &amp;lt;code&amp;gt;--print-all-ignored&amp;lt;/code&amp;gt;&lt;br /&gt;
*** Print all ignored lines&lt;br /&gt;
** &amp;lt;code&amp;gt;--print-all-matched&amp;lt;/code&amp;gt;&lt;br /&gt;
*** Print all matched lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Debug Fail2Ban:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; dump configuration. For debugging.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client -d&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;--dp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--dump-pretty&amp;lt;/code&amp;gt; dump the configuration using more human readable representation.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client --dp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
* will print the systemd log for Fail2Ban.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;journalctl -u fail2ban&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Change ban time After testing====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/fail2ban/jail.local&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[mediawiki]&lt;br /&gt;
&lt;br /&gt;
enabled = true&lt;br /&gt;
filter = mediawiki&lt;br /&gt;
action = iptables-allports&lt;br /&gt;
bantime = 1h&lt;br /&gt;
maxretry = 20&lt;br /&gt;
logpath = /var/log/Fail2Log.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Unban IP&#039;s===&lt;br /&gt;
Get list of Jails:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client status&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See banned ips by that jail:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client status &amp;lt;jailname&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unban IP from jail:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client set &amp;lt;jailname&amp;gt; unbanip &amp;lt;ip_address&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
Log File:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/var/log/Fail2Log.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Moving To VPS==&lt;br /&gt;
&lt;br /&gt;
===Create ssh key pair on local host===&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -C &amp;quot;MYSERVER&amp;quot; -f ~/.ssh/serverkey&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
You will be prompted to Enter a passphase, you can just press &amp;lt;b&amp;gt;Enter&amp;lt;/b&amp;gt; for no passphase.&amp;lt;br \&amp;gt;&lt;br /&gt;
You will now have a file called &amp;lt;b&amp;gt;serverkey&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;serverkey.pub&amp;lt;/b&amp;gt; in your &amp;lt;b&amp;gt;/home/$USER/.ssh&amp;lt;/b&amp;gt; directory.&amp;lt;br \&amp;gt;&lt;br /&gt;
Now lets setup are server and move public key to server.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;BACKUP YOUR PRIVATE KEY TO USB STICK OR SOMETHING!&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;serverkey.pub&amp;lt;/code&amp;gt;&amp;lt;b&amp;gt;PUBLIC KEY&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;serverkey&amp;lt;/code&amp;gt;&amp;lt;b&amp;gt;PRIVATE KEY&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Login to Server - ssh ===&lt;br /&gt;
Using &amp;lt;b&amp;gt;Vultr&amp;lt;/b&amp;gt; i am going to deploy a &amp;lt;b&amp;gt;Ubuntu 20.04&amp;lt;/b&amp;gt; Server.&amp;lt;br \&amp;gt;&lt;br /&gt;
$10, 1 cpu, 2048MB ram, 55GB ssd, 2000GB Bandwidth.&amp;lt;br \&amp;gt;&lt;br /&gt;
I have been given the IP:&amp;lt;b&amp;gt;192.248.145.129&amp;lt;/b&amp;gt; and the Password:&amp;lt;b&amp;gt;1R?o.gPasdaLz1w&amp;lt;/b&amp;gt; and with Vultr the default login/user is &amp;lt;b&amp;gt;root&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Lets move over the public key so we don&#039;t need a password to login:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/serverkey root@192.248.145.129&amp;lt;/code&amp;gt;&amp;lt;/br \&amp;gt;&lt;br /&gt;
Will be promted for server password, enter password: 1R?o.gPasdaLz1w&amp;lt;br \&amp;gt;&lt;br /&gt;
Now lets login with are private key.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -i .ssh/serverkey root@192.248.145.129&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Update Server===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
The Server may need a restart, you will see this after updates if it does&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;*** System restart required ***&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
restart server and log back in after a minute.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Change default ssh port and disable plain text passwords===&lt;br /&gt;
Log back into server&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -i .ssh/serverkey root@192.248.145.129&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#Port 22&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;Port 7788&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
disable clear text passwords&lt;br /&gt;
&amp;lt;pre&amp;gt;#PasswordAuthentication yes&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;PasswordAuthentication no&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
restart sshd&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart sshd&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Exit server and re-login&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log back in with new port&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -p 7788 -i .ssh/serverkey root@192.248.145.129&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Create ssh login shortcut:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
To be done on host:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;touch ~/.ssh/config&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/config&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR ~/.ssh/config&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host mediawikiserver&lt;br /&gt;
    HostName 192.248.145.129&lt;br /&gt;
    User root&lt;br /&gt;
    Port 7788&lt;br /&gt;
    IdentityFile /home/$USER/.ssh/severkey&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now login to server from host with:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh mediawikiserver&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Syntax of config file:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Syntax&lt;br /&gt;
#&lt;br /&gt;
#Host &amp;lt;ALIAS_NAME&amp;gt;&lt;br /&gt;
#    HostName &amp;lt;ADDRESS_IP_OR_DOMAIN&amp;gt;&lt;br /&gt;
#    User &amp;lt;USERNAME_LOGIN&amp;gt;&lt;br /&gt;
#    Port &amp;lt;PORT_NUMBER_IF_NOT_DEFAULT&amp;gt;&lt;br /&gt;
#    IdentityFile &amp;lt;/PATH/TO/PRIVATE_KEY&amp;gt;&lt;br /&gt;
## Can now login with &amp;lt;code&amp;gt;ssh &amp;lt;ALIAS_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enable Basic FireWall===&lt;br /&gt;
Block IPv6&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/default/ufw&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Change the line&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;IPV6=yes&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
To&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;IPV6=no&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Save and Exit&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 7788/tcp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw enable&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create Swap space on server===&lt;br /&gt;
&lt;br /&gt;
====First check if you already have a swap space====&lt;br /&gt;
First check if you already have a swap space&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;free -m&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Returns:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              total        used        free      shared  buff/cache   available&lt;br /&gt;
Mem:           1987         103        1655           2         228        1732&lt;br /&gt;
Swap:             0           0           0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Other methods to check swap space&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cat /proc/swaps&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;swapon -s -v&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create SwapSpace====&lt;br /&gt;
preallocate a 2 gigabyte space to be used for swap.&amp;lt;br \&amp;gt;&lt;br /&gt;
Note: you can name swapfile to anything you want.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fallocate -l 2G /swapfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Initialize the /swapfile file with zeros - see &amp;quot;Working out the count size&amp;quot; to see how to work out the count size.&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Working out the count size:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
Working out count size to scale the swapsize.&lt;br /&gt;
&lt;br /&gt;
1 kilobyte = 1024 bytes&lt;br /&gt;
&lt;br /&gt;
1 megabyte = 1024 kilobyte&lt;br /&gt;
&lt;br /&gt;
1 gigabyte = 1024 megabytes&lt;br /&gt;
&lt;br /&gt;
bs=1024 = 1 megabyte&lt;br /&gt;
&lt;br /&gt;
1 gigabyte = 1024 megabyte&lt;br /&gt;
&lt;br /&gt;
to get count of 1 gigabyte 1024 * 1024 &lt;br /&gt;
&lt;br /&gt;
2 gigabyte (1024 * 2048 ) or 1048576 * 2 = 2,097,152&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;dd if=/dev/zero of=/swapfile bs=1024 count=2097152&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 /swapfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkswap /swapfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;swapon /swapfile&amp;lt;/code&amp;gt; &amp;lt;b&amp;gt;Or&amp;lt;/b&amp;gt; &amp;lt;code&amp;gt;swapon -a&amp;lt;/code&amp;gt; &amp;lt;b&amp;gt;Or&amp;lt;/b&amp;gt; &amp;lt;code&amp;gt;mount -a&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
append to &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; so its mounted after reboot.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/fstab&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
And enter this in a new line at the bottom:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/swapfile swap swap defaults 0 0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and thats it, you can check swap with(or same other methods as above):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;free -m&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Returns:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
              total        used        free      shared  buff/cache   available&lt;br /&gt;
Mem:           1987         103          75           2        1808        1712&lt;br /&gt;
Swap:          2047           0        2047&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===ssmtp for email alerts===&lt;br /&gt;
&amp;lt;code&amp;gt;apt install ssmtp -y&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/ssmtp/ssmtp.conf&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mailhub=mail.smtp2go.com:587&lt;br /&gt;
AuthUser=noobwiki&lt;br /&gt;
AuthPass=N0tTelinu&lt;br /&gt;
UseSTARTTLS=YES&lt;br /&gt;
FromLineOverride=YES&lt;br /&gt;
hostname=completenoobs.com&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/ssmtp/revaliases&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root:admin@completenoobs.com:mail.smtp2go.com:587&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;usermod -c &amp;quot;CNWikiVPS&amp;quot; root&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Send Test eMail&amp;lt;br \&amp;gt;&lt;br /&gt;
Create a file and add subject header and some content.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR test-mail.txt&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Subject:test email&lt;br /&gt;
&lt;br /&gt;
Hello You.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Save and Exit&amp;lt;br \&amp;gt;&lt;br /&gt;
Now send the email:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sendmail email@address2receive.mail &amp;lt; test-mail.txt&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Don&#039;t forget to check your spam folder if you don&#039;t see email&amp;lt;br \&amp;gt;&lt;br /&gt;
Once tested and email sent, you can delete &amp;lt;b&amp;gt;test-mail.txt&amp;lt;/b&amp;gt;.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;rm test-mail.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===auto update server===&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apt/apt.conf.d/50unattended-upgrades&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Uncomment (by removing &amp;lt;b&amp;gt;//&amp;lt;/b&amp;gt; at start of line)and amend the lines we want:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;//      &amp;quot;${distro_id}:${distro_codename}-updates&amp;quot;;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
to&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;        &amp;quot;${distro_id}:${distro_codename}-updates&amp;quot;;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Add email address to send email to:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Unattended-Upgrade::Mail &amp;quot;&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;Unattended-Upgrade::Mail &amp;quot;email@tosendto.com&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
We are going to test are send mail, so for now change MailReport to &amp;quot;always&amp;quot;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Unattended-Upgrade::MailReport &amp;quot;on-change&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;Unattended-Upgrade::MailReport &amp;quot;always&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Remove unused automatically installed kernel-related packages&lt;br /&gt;
// (kernel images, kernel headers and kernel version locked tools).&lt;br /&gt;
//Unattended-Upgrade::Remove-Unused-Kernel-Packages &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Do automatic removal of newly unused dependencies after the upgrade&lt;br /&gt;
//Unattended-Upgrade::Remove-New-Unused-Dependencies &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Do automatic removal of unused packages after the upgrade&lt;br /&gt;
// (equivalent to apt-get autoremove)&lt;br /&gt;
//Unattended-Upgrade::Remove-Unused-Dependencies &amp;quot;false&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Automatically reboot *WITHOUT CONFIRMATION* if&lt;br /&gt;
//  the file /var/run/reboot-required is found after the upgrade&lt;br /&gt;
//Unattended-Upgrade::Automatic-Reboot &amp;quot;false&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Automatically reboot even if there are users currently logged in&lt;br /&gt;
// when Unattended-Upgrade::Automatic-Reboot is set to true&lt;br /&gt;
//Unattended-Upgrade::Automatic-Reboot-WithUsers &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// If automatic reboot is enabled and needed, reboot at the specific&lt;br /&gt;
// time instead of immediately&lt;br /&gt;
//  Default: &amp;quot;now&amp;quot;&lt;br /&gt;
//Unattended-Upgrade::Automatic-Reboot-Time &amp;quot;02:00&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Use apt bandwidth limit feature, this example limits the download&lt;br /&gt;
// speed to 70kb/sec&lt;br /&gt;
//Acquire::http::Dl-Limit &amp;quot;70&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Changed to&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Remove unused automatically installed kernel-related packages&lt;br /&gt;
// (kernel images, kernel headers and kernel version locked tools).&lt;br /&gt;
Unattended-Upgrade::Remove-Unused-Kernel-Packages &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Do automatic removal of newly unused dependencies after the upgrade&lt;br /&gt;
Unattended-Upgrade::Remove-New-Unused-Dependencies &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Do automatic removal of unused packages after the upgrade&lt;br /&gt;
// (equivalent to apt-get autoremove)&lt;br /&gt;
Unattended-Upgrade::Remove-Unused-Dependencies &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Automatically reboot *WITHOUT CONFIRMATION* if&lt;br /&gt;
//  the file /var/run/reboot-required is found after the upgrade&lt;br /&gt;
Unattended-Upgrade::Automatic-Reboot &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Automatically reboot even if there are users currently logged in&lt;br /&gt;
// when Unattended-Upgrade::Automatic-Reboot is set to true&lt;br /&gt;
Unattended-Upgrade::Automatic-Reboot-WithUsers &amp;quot;true&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// If automatic reboot is enabled and needed, reboot at the specific&lt;br /&gt;
// time instead of immediately&lt;br /&gt;
//  Default: &amp;quot;now&amp;quot;&lt;br /&gt;
Unattended-Upgrade::Automatic-Reboot-Time &amp;quot;04:00&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Use apt bandwidth limit feature, this example limits the download&lt;br /&gt;
// speed to 70kb/sec&lt;br /&gt;
Acquire::http::Dl-Limit &amp;quot;500&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test with debug flag -d&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;unattended-upgrade -d&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once email alerts from auto updates has been tested and working, change MailReport back from &#039;always&#039; to &#039;on-change&#039;, unless you want to be emailed at every update.&lt;br /&gt;
&lt;br /&gt;
===Send Container to server===&lt;br /&gt;
&lt;br /&gt;
From host&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;scp -i ~/.ssh/serverkey -P 7788 mediawiki.lxc root@192.248.145.129:/root/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
If you created a ssh shortcut in &amp;lt;b&amp;gt;.ssh/config&amp;lt;/b&amp;gt; you can use:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;scp mediawiki.lxc mediawikiserver:/root/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Once container transferred to server checksum to confirm&amp;lt;br&amp;gt;&lt;br /&gt;
Do on Local and Server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sha256sum mediawiki.lxc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The checksum should be the same on both!&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LXD setup on server===&lt;br /&gt;
&lt;br /&gt;
Check if &amp;lt;b&amp;gt;lxd&amp;lt;/b&amp;gt; already installed.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxd --version&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;snap install lxd&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Initialize LXD&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxd init&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
all defaults&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Would you like to use LXD clustering? (yes/no) [default=no]: &lt;br /&gt;
Do you want to configure a new storage pool? (yes/no) [default=yes]: &lt;br /&gt;
Name of the new storage pool [default=default]: &lt;br /&gt;
Name of the storage backend to use (lvm, zfs, ceph, btrfs, dir) [default=zfs]: &lt;br /&gt;
Create a new ZFS pool? (yes/no) [default=yes]: &lt;br /&gt;
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: &lt;br /&gt;
Size in GB of the new loop device (1GB minimum) [default=10GB]: &lt;br /&gt;
Would you like to connect to a MAAS server? (yes/no) [default=no]: &lt;br /&gt;
Would you like to create a new local network bridge? (yes/no) [default=yes]: &lt;br /&gt;
What should the new bridge be called? [default=lxdbr0]: &lt;br /&gt;
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: &lt;br /&gt;
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: &lt;br /&gt;
Would you like the LXD server to be available over the network? (yes/no) [default=no]: &lt;br /&gt;
Would you like stale cached images to be updated automatically? (yes/no) [default=yes] &lt;br /&gt;
Would you like a YAML &amp;quot;lxd init&amp;quot; preseed to be printed? (yes/no) [default=no]: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Import Container===&lt;br /&gt;
Note: If version of LXD on server is older than the one you are exporting from, you may see error &amp;lt;code&amp;gt;Error: Failed importing backup: Failed creating instance record: Unknown configuration key: volatile.last_state.ready&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
To Fix this update your LXD&amp;lt;br&amp;gt; &lt;br /&gt;
&amp;lt;code&amp;gt;snap remove lxd&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;snap install lxd&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxd --version&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxd init&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Import mediawiki container&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc import mediawiki.lxc mediawiki&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc list&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc start mediawiki&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc list&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Returns:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
+-----------+---------+-----------------------+------+-----------+-----------+&lt;br /&gt;
|   NAME    |  STATE  |         IPV4          | IPV6 |   TYPE    | SNAPSHOTS |&lt;br /&gt;
+-----------+---------+-----------------------+------+-----------+-----------+&lt;br /&gt;
| mediawiki | RUNNING | 10.207.119.233 (eth0) |      | CONTAINER | 0         |&lt;br /&gt;
+-----------+---------+-----------------------+------+-----------+-----------+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Note the Change of IP&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Are Containers IP is now:&amp;lt;b&amp;gt;10.207.119.233&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now for some reason changing the IP on &amp;lt;b&amp;gt;/var/www/html/mediawiki/LocalSettings.php&amp;lt;/b&amp;gt; and the &amp;lt;b&amp;gt;/etc/apache2/sites-available/completenoobs.com.conf&amp;lt;/b&amp;gt; does not really work on a VPS (Forgot how i fixed this last time, pretty sure i got it workin a few years back).&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need a DNS name:&lt;br /&gt;
&lt;br /&gt;
===DNS===&lt;br /&gt;
&lt;br /&gt;
Domain Name System: An index that connects an ip address with a more human readable name(website name):&amp;lt;br \&amp;gt;&lt;br /&gt;
Like a phone book would index a persons name with a phone number.&amp;lt;br \&amp;gt;&lt;br /&gt;
If you have a domain name for your wiki, point it to your server&#039;s ip address.&amp;lt;br \&amp;gt;&lt;br /&gt;
This will be required for a letsencrypt cert also.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I am using &amp;lt;b&amp;gt;namecheap.com&amp;lt;/b&amp;gt; and on the &amp;lt;b&amp;gt;Advanced DNS&amp;lt;/b&amp;gt; Page&amp;lt;br \&amp;gt;&lt;br /&gt;
Add two Type &amp;lt;b&amp;gt;A Records&amp;lt;/b&amp;gt;:&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Dns&lt;br /&gt;
|-&lt;br /&gt;
|Type&lt;br /&gt;
|Host&lt;br /&gt;
|Ip address&lt;br /&gt;
|TTL&lt;br /&gt;
|-&lt;br /&gt;
|A record&lt;br /&gt;
|@&lt;br /&gt;
|192.248.145.129&lt;br /&gt;
|auto&lt;br /&gt;
|-&lt;br /&gt;
|A record&lt;br /&gt;
|www&lt;br /&gt;
|192.248.145.129&lt;br /&gt;
|auto&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Change IP on config files===&lt;br /&gt;
&lt;br /&gt;
Login to conatiner and change IP&#039;s to Domain Name&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec mediawiki bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apache2/sites-available/completenoobs.com.conf&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;    Redirect permanent &amp;quot;/&amp;quot; &amp;quot;https://10.3.45.233&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;    Redirect permanent &amp;quot;/&amp;quot; &amp;quot;https://www.completenoobs.com&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /var/www/html/mediawiki/LocalSettings.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;$wgServer = &amp;quot;https://10.3.45.233&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;$wgServer = &amp;quot;https://www.completenoobs.com&amp;quot;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart apache2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Use IPTables to forward traffic to container===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
iptable syntax&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
*CONTAINER_IP = place holder for your containers ip&lt;br /&gt;
*GLOBAL_IP = place holder for your servers public ip address&lt;br /&gt;
*ETH = network interface: enp1s0&lt;br /&gt;
** to be done/found on host VPS and NOT Container&lt;br /&gt;
** Find network interface:&amp;lt;code&amp;gt;ip route show default&amp;lt;/code&amp;gt; or use &amp;lt;code&amp;gt;ip route show default | awk &#039;{print $5}&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;iptables -t nat -I PREROUTING -i ETH -p TCP -d GLOBAL_IP --dport 80 -j DNAT --to-destination CONTAINER_IP:80 -m comment --comment &amp;quot;forward real ip to container&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
iptables -t nat -I PREROUTING -i ETH -p TCP -d GLOBAL_IP --dport 443 -j DNAT --to-destination CONTAINER_IP:443 -m comment --comment &amp;quot;forward real ip to container&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;These commands to be done on host VPS and NOT in container!&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Get out of container &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Network interface=&amp;lt;b&amp;gt;enp1s0&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Find you network interface name:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
To be run on VPS host and Not in Container:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ip route show default | awk &#039;{print $5}&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
VPS Global IP=&amp;lt;b&amp;gt;192.248.145.129&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Container IP=&amp;lt;b&amp;gt;10.207.119.233&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -t nat -I PREROUTING -i enp1s0 -p TCP -d 192.248.145.129 --dport 443 -j DNAT --to-destination 10.207.119.233:443 -m comment --comment &amp;quot;forward real ip to container&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;iptables -t nat -I PREROUTING -i enp1s0 -p TCP -d 192.248.145.129 --dport 80 -j DNAT --to-destination 10.207.119.233:80 -m comment --comment &amp;quot;forward real ip to container&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The new rules for your iptable will not persistent after a reboot.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create systemd service to load firewall rules at startup:&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /usr/local/bin/lxc-mediawiki-rules&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
iptables -t nat -I PREROUTING -i enp1s0 -p TCP -d 192.248.145.129 --dport 443 -j DNAT --to-destination 10.207.119.233:443 -m comment --comment &amp;quot;forward real ip to container&amp;quot;&lt;br /&gt;
iptables -t nat -I PREROUTING -i enp1s0 -p TCP -d 192.248.145.129 --dport 80 -j DNAT --to-destination 10.207.119.233:80 -m comment --comment &amp;quot;forward real ip to container&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod +x /usr/local/bin/lxc-mediawiki-rules&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/systemd/system/lxcip.service&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description = apply ip rules at startup&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=oneshot&lt;br /&gt;
ExecStart=/usr/local/bin/lxc-mediawiki-rules&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl enable lxcip&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
LXC proxy method:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;DO NOT USE This method!&amp;lt;/b&amp;gt; placed here as a note:&amp;lt;br \&amp;gt;&lt;br /&gt;
LXC also has a way to forward proxy traffic, but it will show all visits to website, as coming from &amp;lt;b&amp;gt;127.0.0.1&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
When we install fail2ban, this would be very bad!&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc config device add CONTAINER_NAME myport80 proxy listen=tcp:0.0.0.0:80 connect=tcp:127.0.0.1:80&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc config device add CONTAINER_NAME myport443 proxy listen=tcp:0.0.0.0:443 connect=tcp:127.0.0.1:443&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
To remove proxy:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc config device remove CONTAINER_NAME myport80&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc config device remove CONTAINER_NAME myport443&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Visit webpage and check all working===&lt;br /&gt;
&lt;br /&gt;
Visit the domain you selected&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;www.completenoobs.com&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Should be up and running.&amp;lt;br \&amp;gt;&lt;br /&gt;
NOTE: We did not need to allow port 443 or 80 on VPS host.&amp;lt;br \&amp;gt;&lt;br /&gt;
Check Iptables persist for restart, by rebooting server!&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Give it a minute or 2 and check website again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===LetsEncrypt===&lt;br /&gt;
&lt;br /&gt;
Log back into server&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh mediawikiserver&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Log into container&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec mediawiki bash&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Install certbot&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;snap install certbot --classic&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Backup Apache2 config file&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cp /etc/apache2/sites-available/completenoobs.com.conf /etc/apache2/sites-available/completenoobs.com.conf.bk&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Create Cert&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;certbot --apache -d www.completenoobs.com -d completenoobs.com&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
And Certbot broke are apache2 configs, and thats why we back up!&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ls /etc/letsencrypt/live/www.completenoobs.com/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cp /etc/letsencrypt/live/www.completenoobs.com/fullchain.pem /etc/ssl/certs/cn-selfsigned.crt&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cp /etc/letsencrypt/live/www.completenoobs.com/privkey.pem /etc/ssl/private/cn-selfsigned.key&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;rm /etc/apache2/sites-available/completenoobs.com-le-ssl.conf /etc/apache2/sites-available/completenoobs.com.conf&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cp /etc/apache2/sites-available/completenoobs.com.conf.bk /etc/apache2/sites-available/completenoobs.com.conf&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
Turn &amp;lt;b&amp;gt;SSLUseStapling&amp;lt;/b&amp;gt; on&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apache2/conf-available/ssl-params.conf&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;SSLUseStapling off&amp;lt;/pre&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Change to:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;SSLUseStapling on&amp;lt;/pre&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Restart apache&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart apache2&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Now check your site on browser.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Useful Notes - tips==&lt;br /&gt;
&lt;br /&gt;
===Forgot your Admin Password===&lt;br /&gt;
Can use for any user:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/changePassword.php --user=admin --password=newpassword&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Make Wiki Read Only===&lt;br /&gt;
Add to LocalSettings.php:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgReadOnly = &#039;Read Only&#039;;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Restrict account creation on wiki===&lt;br /&gt;
Add to LocalSettings.php:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgGroupPermissions[&#039;*&#039;][&#039;createaccount&#039;] = false;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Only Admin accounts can edit===&lt;br /&gt;
Add to LocalSettings.php:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$wgGroupPermissions[&#039;*&#039;][&#039;edit&#039;] = false;&lt;br /&gt;
$wgGroupPermissions[&#039;user&#039;][&#039;edit&#039;] = false;&lt;br /&gt;
$wgGroupPermissions[&#039;sysop&#039;][&#039;edit&#039;] = true;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Protect a page so only admin can edit===&lt;br /&gt;
&lt;br /&gt;
At the top of the page when logged in with admin account, click &amp;lt;b&amp;gt;More&amp;lt;/b&amp;gt;.&amp;lt;br \&amp;gt;&lt;br /&gt;
A drop down of three opitions: Delete, Move, Protect.&amp;lt;br \&amp;gt;&lt;br /&gt;
Clicking &amp;lt;b&amp;gt;Protect&amp;lt;/b&amp;gt; will not allow any non admin from editing the page.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ When logged in as admin&lt;br /&gt;
|-&lt;br /&gt;
|Read&lt;br /&gt;
|Edit&lt;br /&gt;
|View history&lt;br /&gt;
|(STAR)&lt;br /&gt;
|&amp;lt;b&amp;gt;More&amp;lt;/b&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Make User an Admin===&lt;br /&gt;
go to special pages&lt;br /&gt;
&lt;br /&gt;
With Admin Account go to:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;index.php/Special:SpecialPages&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
List of users can be found here:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;index.php/Special:ListUsers&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Go to:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;index.php/Special:UserRights&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
And enter username:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Groups you can change&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
And rest is self explanatory.&lt;br /&gt;
&lt;br /&gt;
====Remove admin rights====&lt;br /&gt;
Same thing, just untick admin rights!&lt;br /&gt;
&lt;br /&gt;
==Upgrading MediaWiki==&lt;br /&gt;
&amp;lt;b&amp;gt;BACK SURE YOU  BACKUP FIRST!!!&amp;lt;/b&amp;gt; just in case.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example update 1.35 to 1.36 from 1.36 onwards php-intl is required.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download the wiki you are going to upgrade to.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://releases.wikimedia.org/mediawiki/1.36/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cd /root&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://releases.wikimedia.org/mediawiki/1.36/mediawiki-1.36.1.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In LocalSettings.php put in readonly mode&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /var/www/html/mediawiki/LocalSettings.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgReadOnly = &amp;quot;Upgrading&amp;quot;;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar xvzf mediawiki-1.36.1.tar.gz -C /var/www/html/mediawiki --strip-components=1&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/update.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Returns:&amp;lt;pre&amp;gt;&lt;br /&gt;
Error: Missing one or more required components of PHP.&lt;br /&gt;
You are missing a required extension to PHP that MediaWiki needs.&lt;br /&gt;
Please install:&lt;br /&gt;
 * intl &amp;lt;https://www.php.net/intl&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install php-intl&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/update.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
And thats it. &lt;br /&gt;
If you do get an error:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
MediaWiki 1.36 internal error&lt;br /&gt;
Installing some PHP extensions is required.&lt;br /&gt;
&lt;br /&gt;
Required components&lt;br /&gt;
You are missing a required extension to PHP that MediaWiki requires to run. Please install:&lt;br /&gt;
&lt;br /&gt;
intl (more information)&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
Then &amp;lt;b&amp;gt;reboot&amp;lt;/b&amp;gt; the container and its all fine after.&lt;br /&gt;
&lt;br /&gt;
==Backup your Wiki==&lt;br /&gt;
&lt;br /&gt;
===LXC Snapshots===&lt;br /&gt;
Easy way, backup the container using &amp;lt;b&amp;gt;snapshot&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc snapshot mediawiki beforeupgrade_11_12_2020&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
To see snapshots&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc info mediawiki&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
To restore container to snapshot&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc restore mediawiki beforeupgrade_11_12_2020&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
To delete a snapshot&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc delete mediawiki/beforeupgrade_11_12_2020&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Export a Snapshot====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc snapshot mediawiki testsnap&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc publish mediawiki/testsnap --alias mediawiki-backup-20-07-2021&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc image export mediawiki-backup-20-07-2021&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
you end up with a file named after the sha256sum&lt;br /&gt;
&amp;lt;code&amp;gt;a23ee82572e5f14aabd4b59d6c7bc7923fe88f30f83b776401871e237b554ceb.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE:You can change name from &amp;lt;code&amp;gt;a23ee82572e5f14aabd4b59d6c7bc7923fe88f30f83b776401871e237b554ceb.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
to something like &amp;lt;code&amp;gt;mediawiki-backup-20-07-2021.tar.gz&amp;lt;/code&amp;gt; and restore will still work fine.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
can now delete image&lt;br /&gt;
&amp;lt;code&amp;gt;lxc image delete mediawiki-backup-20-07-2021&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Import Snapshot====&lt;br /&gt;
Move to another computer and install init lxd&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc image import a23ee82572e5f14aabd4b59d6c7bc7923fe88f30f83b776401871e237b554ceb.tar.gz --alias testrestore&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc launch testrestore mediarestore&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc list&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec mediarestore bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change IP in LocalSettings and apache config and restart apache.&amp;lt;br \&amp;gt;&lt;br /&gt;
And your up and running.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
you can also delete image on new restore computer:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc image delete testrestore&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Dump mediawiki database - xml===&lt;br /&gt;
Log into container root dir&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec NAME bash&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
In container of wiki:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/dumpBackup.php --full &amp;gt; /root/dump_mediawiki.xml&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Exit container&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
Pull file to host&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc file pull NAME/root/dump_mediawiki.xml wiki-dump.xml&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====automate xml dumps to server====&lt;br /&gt;
TIP: [[Scp_only|Create an &#039;&#039;&#039;scp only&#039;&#039;&#039; account on server first]]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /usr/local/bin/auto-export.sh&amp;lt;/code&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -x&lt;br /&gt;
&lt;br /&gt;
time_stamp=$(date &#039;+%d_%m_%y&#039;)&lt;br /&gt;
dumps_dir=&amp;quot;/var/www/dumps&amp;quot;&lt;br /&gt;
noobs_dir=&amp;quot;/var/www/html/noobs&amp;quot;&lt;br /&gt;
local_settings=&amp;quot;$noobs_dir/LocalSettings.php&amp;quot;&lt;br /&gt;
wiki_dump_dir=&amp;quot;$dumps_dir/$time_stamp.Noobs&amp;quot;&lt;br /&gt;
xmlkey=&amp;quot;/root/.ssh/xmlkey&amp;quot;&lt;br /&gt;
remote_host=&amp;quot;rscp@xml.completenoobs.com&amp;quot;&lt;br /&gt;
remote_path=&amp;quot;/home/rscp/media/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function ensure_read_only_line_exists {&lt;br /&gt;
    if ! grep -q &amp;quot;wgReadOnly&amp;quot; &amp;quot;$local_settings&amp;quot;; then&lt;br /&gt;
        cat &amp;lt;&amp;lt;EOF &amp;gt;&amp;gt; &amp;quot;$local_settings&amp;quot;&lt;br /&gt;
\$wgReadOnly = &#039;Dumping Database, Access will be restored shortly&#039;;&lt;br /&gt;
EOF&lt;br /&gt;
    fi&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function set_wiki_read_only {&lt;br /&gt;
    sed -i &#039;s/^#*\(\$wgReadOnly\)/\1/&#039; &amp;quot;$local_settings&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function unset_wiki_read_only {&lt;br /&gt;
    sed -i &#039;s/^\(\$wgReadOnly\)/#\1/&#039; &amp;quot;$local_settings&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function create_directories {&lt;br /&gt;
    mkdir -p &amp;quot;$dumps_dir&amp;quot;&lt;br /&gt;
    mkdir -p &amp;quot;$wiki_dump_dir&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function dump_wiki {&lt;br /&gt;
    php &amp;quot;$noobs_dir/maintenance/dumpBackup.php&amp;quot; --full &amp;gt; &amp;quot;$wiki_dump_dir/$time_stamp.Noobs.xml&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function generate_checksums {&lt;br /&gt;
    md5sum &amp;quot;$wiki_dump_dir/$time_stamp.Noobs.xml&amp;quot; &amp;gt; &amp;quot;$wiki_dump_dir/$time_stamp.md5sum.txt&amp;quot;&lt;br /&gt;
    sha256sum &amp;quot;$wiki_dump_dir/$time_stamp.Noobs.xml&amp;quot; &amp;gt; &amp;quot;$wiki_dump_dir/$time_stamp.sha256sum.txt&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function push_to_remote {&lt;br /&gt;
    scp -i /root/.ssh/xmlkey -r /var/www/dumps/$time_stamp.Noobs rscp@xml.completenoobs.com:/home/rscp/media/&lt;br /&gt;
    #rsync -avz -e &amp;quot;ssh -i $xmlkey&amp;quot; &amp;quot;$wiki_dump_dir&amp;quot; &amp;quot;$remote_host:$remote_path&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Main script&lt;br /&gt;
ensure_read_only_line_exists&lt;br /&gt;
create_directories&lt;br /&gt;
set_wiki_read_only&lt;br /&gt;
dump_wiki&lt;br /&gt;
generate_checksums&lt;br /&gt;
unset_wiki_read_only&lt;br /&gt;
push_to_remote&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;chmod +x /usr/local/bin/auto-export.sh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====add to cron to export every 5 days=====&lt;br /&gt;
&amp;lt;code&amp;gt;crontab -e&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
30 3 */5 * * /usr/local/bin/auto-export.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Will export at 3:30 am every 5 days, check [[Cron_ubuntu_22.04|Ubuntu Cron Quick start for more info]]&lt;br /&gt;
&lt;br /&gt;
===Import Dump===&lt;br /&gt;
&lt;br /&gt;
====Create Quick local wiki====&lt;br /&gt;
[[Ubuntu_Local_Wiki_Import|localwiki]]&lt;br /&gt;
&lt;br /&gt;
====Import dump====&lt;br /&gt;
&amp;lt;code&amp;gt;lxc file push wiki-dump.xml localwiki/root/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc exec localwiki bash&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Restore dump=====&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/importDump.php --conf /var/www/html/mediawiki/LocalSettings.php /root/wiki-dump.xml&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/rebuildrecentchanges.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/initSiteStats.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/rebuildall.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything apart from &amp;lt;b&amp;gt;index.php/Main_Page&amp;lt;/b&amp;gt; restored.&lt;br /&gt;
&lt;br /&gt;
===Full Wiki Dump and Restore===&lt;br /&gt;
&lt;br /&gt;
====Backing up====&lt;br /&gt;
&lt;br /&gt;
====Making your wiki READ ONLY - will lock database====&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR LocalSettings.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgReadOnly = &#039;Dumping Database, Access will be restored shortly&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Dump and gzip database for transport====&lt;br /&gt;
&lt;br /&gt;
will be prompted for password:&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mysqldump -h localhost --default-character-set=binary --no-tablespaces -u green -p mywiki_database | gzip &amp;gt; /root/greenwiki.sql.gz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
ALt method for dump(password in cmd):&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mysqldump -h localhost --default-character-set=binary --no-tablespaces -u green --password=THISpasswordSHOULDbeCHANGED -p mywiki_database | gzip &amp;gt; /root/greenwiki.sql.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/dumpBackup.php --full &amp;gt; /root/dump_mediawiki.xml&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back mediawiki Root Directory.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar cvzhf /root/mediawiki-rootDir.tgz /var/www/html/mediawiki&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All into one file for easy transport.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cd /root/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar cvzhf mediawiki-transfer.tgz mediawiki-rootDir.tgz greenwiki.sql.gz dump_mediawiki.xml&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All file in &amp;lt;b&amp;gt;mediawiki-transfer.tgz&amp;lt;/b&amp;gt; for transfer to new server&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
exit Container&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc file pull mediawiki/root/mediawiki-transfer.tgz mediawiki.bk.tgz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Restore wiki====&lt;br /&gt;
&lt;br /&gt;
create container (backupwiki) and push file&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;lxc file push mediawiki.bk.tgz backupwiki/root/&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
login to container&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring php-intl -y&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar xvf mediawiki.bk.tgz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar xvf mediawiki-rootDir.tgz -C /&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create basebase:&amp;lt;br \&amp;gt;&lt;br /&gt;
NOTE: If you use diff username, passwd, database_name, append/correct details on LocalSettings.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mysql -u root&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE USER &#039;green&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;THISpasswordSHOULDbeCHANGED&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CREATE DATABASE mywiki_database;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;use mywiki_database;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;GRANT ALL ON mywiki_database.* TO &#039;green&#039;@&#039;localhost&#039;;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;quit;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;gunzip -d greenwiki.sql.gz&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mysql -u green -p mywiki_database &amp;lt; greenwiki.sql&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/importDump.php --conf /var/www/html/mediawiki/LocalSettings.php /root/dump_mediawiki.xml&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/rebuildrecentchanges.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/initSiteStats.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;php /var/www/html/mediawiki/maintenance/rebuildall.php&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Config Apache2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/apache2/sites-available/000-default.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        DocumentRoot /var/www/html/mediawiki&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reload Apache2&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
systemctl restart apache2 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==EmbedVideo==&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:EmbedVideo&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install unzip&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://gitlab.com/hydrawiki/extensions/EmbedVideo/-/archive/v2.9.0/EmbedVideo-v2.9.0.zip&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;unzip EmbedVideo-v2.9.0.zip -d /var/www/html/mediawiki/extensions/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mv /var/www/html/mediawiki/extensions/EmbedVideo-v2.9.0 /var/www/html/mediawiki/extensions/EmbedVideo&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /var/www/html/mediawiki/LocalSettings.php&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Embed Video&lt;br /&gt;
wfLoadExtension( &#039;EmbedVideo&#039; );&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Remove &amp;lt;b&amp;gt;Index.php&amp;lt;/b&amp;gt; From URL==&lt;br /&gt;
[[Mediawiki_Remove_index.php|How to remove the Index.php from URL]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==SpamBot Wars==&lt;br /&gt;
&lt;br /&gt;
Bit busy now, notes to look into later:&lt;br /&gt;
&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:Nuke&amp;lt;br \&amp;gt;&lt;br /&gt;
https://www.mediawiki.org/wiki/Manual:Preventing_access&amp;lt;br \&amp;gt;&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:ConfirmAccount&amp;lt;br \&amp;gt;&lt;br /&gt;
https://www.mediawiki.org/wiki/Extension:InviteSignup&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Well the bots won for now - Disable eMail function for all related options in LocalSettings.php&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgEnableEmail = false;&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
Or just stop users sending email with:&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$wgEnableUserEmail = false;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
==Syntax highlighting not working==&lt;br /&gt;
Install &amp;lt;b&amp;gt;pygments&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install python3-pygments&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add to LocalSettings:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wfLoadExtension( &#039;SyntaxHighlight_GeSHi&#039; );&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=438</id>
		<title>Ubuntu 22.04 SSH Guide</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=438"/>
		<updated>2023-05-16T12:06:30Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Key-based Authentication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Understanding SSH==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SSH&#039;&#039;&#039; is a protocol that uses encryption to secure data transmitted between a client and a server. &amp;lt;br&amp;gt;&lt;br /&gt;
It enables users to execute commands, transfer files, and manage remote systems through an encrypted channel. &amp;lt;br&amp;gt;&lt;br /&gt;
SSH is widely used by system administrators for managing servers, network devices, and other remote systems.&lt;br /&gt;
&lt;br /&gt;
==Installing SSH==&lt;br /&gt;
&lt;br /&gt;
To start using SSH, you&#039;ll need to install and configure both the server and client components.&lt;br /&gt;
&lt;br /&gt;
* OpenSSH-Server&lt;br /&gt;
** Is required to allow &#039;&#039;&#039;ssh&#039;&#039;&#039; connections&lt;br /&gt;
* OpenSSH-Client&lt;br /&gt;
** Is used to login/connect to OpenSSH-Server&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Desktop, the &#039;&#039;&#039;openssh client&#039;&#039;&#039; will be preinstalled, allowing you to connect to a server which is running &#039;&#039;&#039;openssh-server&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Server, both the &#039;&#039;&#039;ssh client&#039;&#039;&#039; and &#039;&#039;&#039;openssh server&#039;&#039;&#039; are preinstalled by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing OpenSSH Server===&lt;br /&gt;
On Ubuntu distributions, you can install the OpenSSH server by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install openssh-server&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the SSH server status with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl status ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Installing OpenSSH Client===&lt;br /&gt;
&lt;br /&gt;
The OpenSSH client is usually pre-installed on most Linux and macOS systems. &amp;lt;br&amp;gt;For Windows, you can install the OpenSSH client by following the instructions on the official website:&amp;lt;br&amp;gt; https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse&lt;br /&gt;
&lt;br /&gt;
==Basic SSH Commands and Usage==&lt;br /&gt;
=== Connecting to a remote server===&lt;br /&gt;
Connecting to a remote server using SSH is a fundamental task when managing remote systems. Here&#039;s how to connect to a remote server using the command-line interface.&lt;br /&gt;
&lt;br /&gt;
Install an SSH client: Ensure you have an SSH client installed on your local machine. Most Unix-based systems, including Linux and macOS, have an SSH client pre-installed. For Windows, you can use the built-in OpenSSH client (available in Windows 10 and later) or a third-party client like PuTTY.&lt;br /&gt;
&lt;br /&gt;
====Gather connection information====&lt;br /&gt;
To connect to a remote server, you&#039;ll need the following information:&lt;br /&gt;
* The remote server&#039;s IP address or hostname&lt;br /&gt;
* The SSH port number (default is 22)&lt;br /&gt;
* Your username on the remote server&lt;br /&gt;
* The password for the user on remote server.&lt;br /&gt;
&lt;br /&gt;
====Connect using SSH====&lt;br /&gt;
Open a terminal or command prompt on your local machine and use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;username&#039;&#039;&#039; with your username on the remote server, &#039;&#039;&#039;hostname_or_IP&#039;&#039;&#039; with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
If OpenSSH-Server is running/listening on a port other than the default port &#039;&#039;&#039;22&#039;&#039;&#039; include the port with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag.&lt;br /&gt;
&lt;br /&gt;
For example (If port 2222):&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh john@example.com -p 2222&amp;lt;/code&amp;gt;&lt;br /&gt;
Or&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh -p 2222 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Connecting to a Remote Server =====&lt;br /&gt;
&lt;br /&gt;
In this example, we connect to a remote Ubuntu VPS with the following credentials:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Username: root&lt;br /&gt;
    IP address: 12.34.56.78&lt;br /&gt;
    Password: password2simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password. Type password2simple and press Enter. This demonstrates how simple it can be to log into a remote computer with root access.&lt;br /&gt;
&lt;br /&gt;
* If your Server is hosting SSHD on a port other than default &#039;port 22&#039; include port number with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag&lt;br /&gt;
Example with port 2222:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -p 2222 root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Authenticate====&lt;br /&gt;
When connecting for the first time, you&#039;ll see a prompt asking you to confirm the remote server&#039;s fingerprint. Verify the fingerprint and type &amp;quot;yes&amp;quot; to proceed. Next, you&#039;ll be prompted for your password. Enter your password to complete the authentication process.&lt;br /&gt;
&lt;br /&gt;
Once authenticated, you&#039;ll have access to the remote server&#039;s command line. You can now execute commands and manage the remote server as if you were working on it directly.&lt;br /&gt;
&lt;br /&gt;
Remember that you can use key-based authentication (with a private-public key pair) instead of a password for a more secure and convenient connection method.&lt;br /&gt;
== Using SSH config file==&lt;br /&gt;
&lt;br /&gt;
An SSH config file allows you to define and manage multiple SSH connections, simplifying the process of connecting to remote servers. By creating an SSH config file, you can define custom options, such as port numbers, usernames, and key files, for each connection. The SSH config file is typically located in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory and named config.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to create and use an SSH config file:&lt;br /&gt;
&lt;br /&gt;
:*    Create the SSH config file: If it doesn&#039;t exist, create the config file in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory using a text editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Define a connection: To define a connection, you&#039;ll need to specify a Host entry followed by any options you want to apply to that connection. Here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server1&lt;br /&gt;
  HostName example.com&lt;br /&gt;
  User your_username&lt;br /&gt;
  Port 2222&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this example, we&#039;ve defined a connection called server1 with the following options:&lt;br /&gt;
&lt;br /&gt;
:*    HostName: The hostname or IP address of the remote server (example.com in this case).&lt;br /&gt;
:*    User: The username to use when connecting to the remote server (replace your_username with your actual username).&lt;br /&gt;
:*    Port: The port number to use for the SSH connection (2222 in this example).&lt;br /&gt;
:*    IdentityFile: The path to the private key file to use for authentication (replace ~/.ssh/id_rsa_server1 with the path to your private key file).&lt;br /&gt;
&lt;br /&gt;
You can define multiple connections in the same config file by creating separate Host entries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server2&lt;br /&gt;
  HostName 192.168.1.100&lt;br /&gt;
  User another_username&lt;br /&gt;
  Port 22&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Connect using the SSH config file: To connect to a remote server using the defined connection, simply use the ssh command followed by the Host entry:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, SSH will automatically use the options defined in the config file for server1, such as the hostname, username, port number, and identity file.&lt;br /&gt;
&lt;br /&gt;
By using an SSH config file, you can simplify the process of managing multiple SSH connections and customize the options for each connection.&lt;br /&gt;
&lt;br /&gt;
==Key-based Authentication==&lt;br /&gt;
&lt;br /&gt;
Why use key-based authentication?&lt;br /&gt;
* Server1: 12.34.56.78&lt;br /&gt;
* Server2: 12.34.56.87&lt;br /&gt;
&lt;br /&gt;
You are trying to login to Server1, but by mistake you enter your &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; to Server2, Can Server2 record the &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; you used?&lt;br /&gt;
[[Ubuntu_18.04_OpenSSH-Server_Capture_Failed_Passwords|YES, Yes it can]] &lt;br /&gt;
&lt;br /&gt;
=== Generating SSH key pairs===&lt;br /&gt;
&lt;br /&gt;
SSH key pairs consist of a private key and a public key. They provide a secure, passwordless authentication method for connecting to remote servers. The private key remains on your local machine, while the public key is added to the remote server&#039;s authorized keys. Here&#039;s how to generate an SSH key pair:&lt;br /&gt;
&lt;br /&gt;
Open a terminal: On Unix-based systems (Linux and macOS), open a terminal. On Windows, open PowerShell or the Command Prompt.&lt;br /&gt;
&lt;br /&gt;
Generate the key pair: Use the ssh-keygen command to create a new SSH key pair. The following command generates a 4096-bit RSA key pair:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also generate other types of keys, such as Ed25519, by changing the -t option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t ed25519&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specify the key&#039;s location: When prompted, you can either accept the default location (~/.ssh/id_rsa for RSA keys, ~/.ssh/id_ed25519 for Ed25519 keys) or enter a custom path. It is recommended to use the default location unless you have a specific reason to change it.&lt;br /&gt;
&lt;br /&gt;
Set a passphrase (optional): You can choose to protect your private key with a passphrase. If you do, you&#039;ll need to enter the passphrase every time you use the key. This adds an extra layer of security, but can be less convenient for automation or scripting. To set a passphrase, enter it when prompted; otherwise, leave the field blank&lt;br /&gt;
&lt;br /&gt;
====Selecting file name and path for keys====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option in the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command is used to specify the output file for the generated key pair. In your example, &#039;&#039;&#039;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&#039;&#039;&#039;, the command is generating an RSA key pair with a key length of 4096 bits, and the output files will be saved in the &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory with the base name &#039;&#039;&#039;nuc&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the options used in this command:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-f .ssh/nuc&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039; and the public key in &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Create keys with no passphase====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -N &amp;quot;&amp;quot; -C &amp;quot;MYSERVER&amp;quot; -f ~/.ssh/serverkey&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-N &amp;quot;&amp;quot;&#039;&#039;&#039;: Specifies an empty passphrase for the key pair. This means that the private key will not be encrypted, and no passphrase will be required when using it. This can be less secure, but more convenient for automated processes.&lt;br /&gt;
:*    &#039;&#039;&#039;-C &amp;quot;MYSERVER&amp;quot;&#039;&#039;&#039;: Adds a comment to the generated key pair. In this case, the comment is &amp;quot;MYSERVER&amp;quot;. Comments are useful for identifying keys when you have multiple keys in your ~/.ssh directory or on a remote server.&lt;br /&gt;
:*    &#039;&#039;&#039;-f ~/.ssh/serverkey&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039; and the public key in &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;. The private key will have an empty passphrase and a comment &amp;quot;MYSERVER&amp;quot; for easier identification.&lt;br /&gt;
&lt;br /&gt;
====Remove the passphrase from an existing SSH private key====&lt;br /&gt;
&lt;br /&gt;
To remove the passphrase from an existing SSH private key, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, which is used for changing the passphrase. Follow these steps:&lt;br /&gt;
&lt;br /&gt;
:*    Make a backup of your private key file, just in case something goes wrong during the process. You can do this by running the following command, replacing &#039;&#039;&#039;&amp;lt;your_private_key&amp;gt;&#039;&#039;&#039; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
::**     &#039;&#039;&#039;-p&#039;&#039;&#039;: Indicates that you want to change the passphrase of an existing private key.&lt;br /&gt;
::**    &#039;&#039;&#039;-f &amp;lt;your_private_key&amp;gt;&#039;&#039;&#039;: Specifies the private key file whose passphrase you want to change.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    You will be prompted to enter the old passphrase for the private key. Type it in and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Since you want to remove the passphrase, leave this field empty and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the empty passphrase. Press Enter again to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has its passphrase removed. Keep in mind that this makes the private key less secure, as anyone with access to the file can use it without needing to know the passphrase.&lt;br /&gt;
&lt;br /&gt;
====Add/Change a passphrase to an existing SSH Key====&lt;br /&gt;
&lt;br /&gt;
To add a passphrase to an existing SSH private key that doesn&#039;t have one, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, just like when you change or remove a passphrase. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;Make a backup of your private key file&#039;&#039;&#039;, just in case something goes wrong during the process. You can do this by running the following command, replacing &amp;lt;your_private_key&amp;gt; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the -p option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*   You will be prompted to enter the old passphrase for the private key. Since your private key doesn&#039;t currently have a passphrase, just press Enter to proceed.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Type in the passphrase you want to set for the private key and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the new passphrase. Type it again and press Enter to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has a passphrase added to it. This provides an extra layer of security, as anyone using the key will need to know the passphrase to access it. Keep in mind that you should use a strong passphrase to ensure better security.&lt;br /&gt;
&lt;br /&gt;
=== Copying public keys to the remote server===&lt;br /&gt;
After generating an SSH key pair, you&#039;ll need to copy the public key to the remote server to enable key-based authentication. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
====Using ssh-copy-id====&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;ssh-copy-id&#039;&#039;&#039; command (Linux and macOS): On Unix-based systems, you can use the ssh-copy-id command to copy your public key to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ~/.ssh/id_rsa.pub with the path to your public key file (e.g., ~/.ssh/id_ed25519.pub for Ed25519 keys), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
====Manually copy the public key====&lt;br /&gt;
&lt;br /&gt;
Manually copy the public key (Windows and alternative method): If you don&#039;t have access to the ssh-copy-id command or prefer to do it manually, you can:&lt;br /&gt;
&lt;br /&gt;
:* Open your public key file (e.g., id_rsa.pub or id_ed25519.pub) with a text editor and copy its content.&amp;gt;&lt;br /&gt;
:* Log in to the remote server via SSH.&amp;lt;br&amp;gt;&lt;br /&gt;
:* Create the ~/.ssh directory if it doesn&#039;t exist:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit or create the ~/.ssh/authorized_keys file using a text editor (e.g., nano, vim, or emacs), and paste the content of your public key at the end of the file. Save and close the file.&lt;br /&gt;
&lt;br /&gt;
Set the correct file permissions: To ensure the security of your SSH setup, it&#039;s essential to set the proper file permissions on your local machine and the remote server:&lt;br /&gt;
&lt;br /&gt;
:* On your local machine:&lt;br /&gt;
:**       Private key (id_rsa or id_ed25519): -rw------- (600)&lt;br /&gt;
:**       Public key (id_rsa.pub or id_ed25519.pub): -rw-r--r-- (644)&lt;br /&gt;
&lt;br /&gt;
:*    On the remote server:&lt;br /&gt;
:**        ~/.ssh directory: drwx------ (700)&lt;br /&gt;
:**        ~/.ssh/authorized_keys file: -rw------- (600)&lt;br /&gt;
&lt;br /&gt;
To set the permissions on your local machine, use the chmod command:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
chmod 644 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On the remote server, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 700 ~/.ssh&lt;br /&gt;
chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you&#039;ve copied your public key to the remote server and set the correct file permissions, you should be able to connect using key-based authentication without the need for a password.&lt;br /&gt;
&lt;br /&gt;
=== Disabling password authentication (optional)===&lt;br /&gt;
Disabling password authentication enhances the security of your SSH server by requiring key-based authentication for all connections. You can disable password authentication for specific users or for all users. To do so, follow these steps:&lt;br /&gt;
&lt;br /&gt;
:* Connect to the remote server: Log in to the remote server via SSH using your username and the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:* Edit the SSH configuration file: Open the SSH server configuration file (usually located at /etc/ssh/sshd_config) with a text editor such as nano, vim, or emacs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for all users: Find the line containing &amp;quot;PasswordAuthentication&amp;quot; and set its value to &amp;quot;no&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol.&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for a specific user: To disable password authentication only for a particular user, you can use a &amp;quot;Match User&amp;quot; block at the end of the sshd_config file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User username&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Replace username with the actual username for which you want to disable password authentication.&lt;br /&gt;
&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, password authentication will be disabled for the specified user(s), and only key-based authentication will be allowed. Remember that if you disable password authentication, you must have a working SSH key pair set up to access the server, or you may be locked out.&lt;br /&gt;
&lt;br /&gt;
== Configuring the SSH server==&lt;br /&gt;
&lt;br /&gt;
Edit the SSH server configuration file located at &amp;lt;b&amp;gt;/etc/ssh/sshd_config&amp;lt;/b&amp;gt; to set your desired settings. You can modify options like the listening port, allowing root login, and more.&lt;br /&gt;
&lt;br /&gt;
===Common sshd_config Options===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file is located at &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; on most Linux systems. This file contains various options and settings that determine the behavior of the OpenSSH server. Each option is followed by its value, and lines starting with a &amp;lt;b&amp;gt;#&amp;lt;/b&amp;gt; are considered comments.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an overview of some common options in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
===Port===&lt;br /&gt;
&lt;br /&gt;
Specifies the port number that the SSH server listens on.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Port 22&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AddressFamily===&lt;br /&gt;
&lt;br /&gt;
Determines the IP address family (IPv4, IPv6, or both) used by the SSH server.&lt;br /&gt;
&lt;br /&gt;
* To specify that the SSH server should only listen for incoming IPv4 connections:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Or, if you want the SSH server to only listen for incoming IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;inet6&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to allow both IPv4 and IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;any&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily any&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ListenAddress===&lt;br /&gt;
Specifies the IP address(es) the SSH server listens on. By default, it listens on all available addresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ListenAddress 192.168.1.10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Protocol===&lt;br /&gt;
Defines the SSH protocol version. It&#039;s recommended to use only protocol 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Protocol 2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PermitRootLogin===&lt;br /&gt;
Controls whether root login is allowed. It&#039;s generally advised to disable root login or set it to &amp;quot;without-password&amp;quot; to allow only key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitRootLogin no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===PasswordAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables password-based authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PubkeyAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PubkeyAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AuthorizedKeysFile===&lt;br /&gt;
Specifies the location of the authorized keys file for public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;AuthorizedKeysFile .ssh/authorized_keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LogLevel===&lt;br /&gt;
Sets the logging level for the SSH server.&lt;br /&gt;
&lt;br /&gt;
The LogLevel option in &#039;&#039;&#039;sshd_config&#039;&#039;&#039; controls the amount of information that SSH daemon (sshd) logs.&lt;br /&gt;
&lt;br /&gt;
There are different log levels that can be set with this option, each providing a different level of detail:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;QUIET&#039;&#039;&#039;: Disables all logging.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;FATAL&#039;&#039;&#039;: Only logs fatal errors.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;ERROR&#039;&#039;&#039;: Logs error messages.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;INFO&#039;&#039;&#039;: Logs informational messages such as login attempts.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VERBOSE&#039;&#039;&#039;: Logs more detailed information than INFO, including shell commands executed.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEBUG&#039;&#039;&#039;: Logs detailed debugging information, including raw protocol details.&lt;br /&gt;
&lt;br /&gt;
The default log level is &#039;&#039;&#039;INFO&#039;&#039;&#039;, which is usually sufficient for most purposes. However, if you need to troubleshoot SSH connections or monitor user activity, setting a higher log level may be helpful.&lt;br /&gt;
&lt;br /&gt;
To change the &#039;&#039;&#039;LogLevel&#039;&#039;&#039; in &#039;&#039;&#039;sshd_config&#039;&#039;&#039;, you can edit the file &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; (or the appropriate configuration file for your system), and add or modify the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel &amp;lt;log_level&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;log_level&amp;gt; is one of the log levels listed above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel INFO&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LoginGraceTime===&lt;br /&gt;
&lt;br /&gt;
Defines the time allowed for a user to successfully log in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LoginGraceTime 2m&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MaxAuthTries===&lt;br /&gt;
&lt;br /&gt;
Limits the number of authentication attempts allowed per connection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxAuthTries 6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MaxSessions===&lt;br /&gt;
&lt;br /&gt;
Specifies the maximum number of simultaneous sessions allowed per network connection.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxSessions 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AllowUsers, DenyUsers, AllowGroups, DenyGroups===&lt;br /&gt;
&lt;br /&gt;
These options control which users and groups are allowed or denied access to the SSH server. They provide a way to manage access control based on usernames and group membership.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;: Specifies a list of users allowed to access the SSH server. Other users will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowUsers user1 user2 user3&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;: Specifies a list of users denied access to the SSH server. Other users will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyUsers user4 user5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;: Specifies a list of groups whose members are allowed to access the SSH server. Users not belonging to these groups will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowGroups group1 group2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;: Specifies a list of groups whose members are denied access to the SSH server. Users not belonging to these groups will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyGroups group3 group4&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the order in which these options are applied is &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;, &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;, &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;, and finally &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Banner===&lt;br /&gt;
&lt;br /&gt;
The Banner option allows you to display a message or warning to users before they log in to the SSH server. This is often used to display legal notices, security warnings, or other important information.&lt;br /&gt;
&lt;br /&gt;
To enable the banner, set the Banner option to the path of a text file containing the message you want to display:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Banner /etc/ssh/banner.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create the /etc/ssh/banner.txt file and add your desired message. The content of this file will be displayed to users before they log in.&lt;br /&gt;
&lt;br /&gt;
==Advanced sshd_config Options==&lt;br /&gt;
=== PermitTunnel===&lt;br /&gt;
The PermitTunnel option enables or disables the use of SSH tunneling. Tunnels can be used to forward ports or create VPN-like connections between the client and the server. &lt;br /&gt;
* There are four possible values for this option:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;yes&amp;quot;&#039;&#039;&#039;: Allows all types of tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;point-to-point&amp;quot;&#039;&#039;&#039;: Allows only point-to-point (Layer 3) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;ethernet&amp;quot;&#039;&#039;&#039;: Allows only Ethernet (Layer 2) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;no&amp;quot;&#039;&#039;&#039;: Disables tunneling (default).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable tunneling, set the PermitTunnel option in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitTunnel yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keep in mind that enabling tunnels may expose your server to additional security risks. Only enable this option if you understand the implications and have a specific use case that requires it.&lt;br /&gt;
&lt;br /&gt;
=== ChrootDirectory===&lt;br /&gt;
The ChrootDirectory option allows you to restrict a user or a group to a specific directory (known as a chroot jail) when they log in via SSH. This can enhance security by isolating users and limiting their access to only the necessary parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
To set up a chroot jail, follow these steps:&lt;br /&gt;
&lt;br /&gt;
Create a directory that will serve as the chroot jail. For example, let&#039;s create a directory for user1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the ownership of the directory to the user and their primary group:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown user1:user1 /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ChrootDirectory for user1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ChrootDirectory /home/user1/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, they will be restricted to the /home/user1/chroot directory and won&#039;t be able to access other parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
Note that the chroot jail should be owned by root and not writable by the user. If you need to provide write access to specific directories, create subdirectories inside the chroot jail and set appropriate permissions for those. Also, some features like SFTP may require additional configuration within the chroot jail.&lt;br /&gt;
&lt;br /&gt;
===ForceCommand===&lt;br /&gt;
The ForceCommand option allows you to specify a command that will be executed when a user logs in via SSH, regardless of the command requested by the user. This can be useful for limiting the actions a user can perform or for automatically running specific tasks upon login.&lt;br /&gt;
&lt;br /&gt;
To use the ForceCommand option, follow these steps:&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ForceCommand for a specific user or group. For example, to force user1 to execute the command /usr/bin/my-command upon login:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ForceCommand /usr/bin/my-command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, the /usr/bin/my-command will be executed automatically, and they will not be able to run any other command.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that using ForceCommand may limit the user&#039;s ability to interact with the server or transfer files via SFTP. Make sure to test and verify the functionality for your specific use case.&lt;br /&gt;
&lt;br /&gt;
=== Match Blocks===&lt;br /&gt;
&lt;br /&gt;
Match blocks in the sshd_config file allow you to apply specific configuration options based on certain criteria, such as the user, group, address, or host. This enables you to create custom rules and settings for different users, groups, or connections.&lt;br /&gt;
&lt;br /&gt;
Match block syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match criteria&lt;br /&gt;
  Option value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are some examples of Match blocks and their usage:&lt;br /&gt;
&lt;br /&gt;
Apply settings only for a specific user:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
  AllowTcpForwarding yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication and enables TCP forwarding only for user1.&lt;br /&gt;
&lt;br /&gt;
Apply settings for multiple users:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1,user2&lt;br /&gt;
  ChrootDirectory /home/%u/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration sets the chroot directory for both user1 and user2.&lt;br /&gt;
&lt;br /&gt;
Apply settings for a specific group:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Group group1&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration enables password authentication only for members of group1.&lt;br /&gt;
&lt;br /&gt;
Apply settings based on the client&#039;s IP address:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication for clients connecting from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Combine multiple criteria:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1 Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This configuration enables password authentication only for user1 when they connect from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Remember to restart the SSH server after making changes to the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match blocks offer flexibility in customizing your SSH server&#039;s configuration based on various criteria. Use them wisely to enhance security and optimize your server&#039;s settings.&lt;br /&gt;
&lt;br /&gt;
==Best Practices and Tips &#039;&#039;&#039;sshd_config&#039;&#039;&#039;==&lt;br /&gt;
When configuring your &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file, it&#039;s essential to follow best practices to ensure the security and stability of your SSH server. Here are some recommendations and tips:&lt;br /&gt;
&lt;br /&gt;
:*   Keep the server up-to-date: Always update your SSH server software and the underlying operating system to ensure you have the latest security patches and features.&lt;br /&gt;
&lt;br /&gt;
:*    Use strong authentication: Enable key-based authentication (PubkeyAuthentication) and consider disabling password authentication (PasswordAuthentication) to reduce the risk of brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
:*    Limit root access: Set &amp;quot;PermitRootLogin&amp;quot; to &amp;quot;no&amp;quot; or &amp;quot;without-password&amp;quot; to prevent direct root login or require key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
:*    Use non-standard ports: Change the default SSH port (22) to a non-standard port to reduce the exposure to automated scans and attacks. Keep in mind this is security through obscurity and should be combined with other security measures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Restrict user access&#039;&#039;&#039;: Use &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; and &amp;quot;DenyGroups&amp;quot; options to control which users and groups can access the SSH server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Monitor logs&#039;&#039;&#039;: Regularly check your SSH server logs for any suspicious activity or failed login attempts. Adjust the &amp;quot;LogLevel&amp;quot; setting in sshd_config as needed.&lt;br /&gt;
* Default Log Path Ubuntu 22.04: &#039;&#039;&#039;/var/log/auth.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use chroot jails&#039;&#039;&#039;: Isolate users by creating chroot jails using the &amp;quot;ChrootDirectory&amp;quot; option, especially when providing SFTP access or when users don&#039;t require full access to the server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configure connection settings&#039;&#039;&#039;: Set appropriate values for &amp;quot;LoginGraceTime&amp;quot; and &amp;quot;MaxAuthTries&amp;quot; to limit the time allowed for successful login and the number of authentication attempts per connection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use a strong firewall&#039;&#039;&#039;: Configure your server&#039;s firewall to only allow SSH connections from trusted IP addresses or networks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Regularly review and audit&#039;&#039;&#039;: Periodically review your sshd_config settings and make adjustments as necessary. Keep up-to-date with SSH security best practices and recommendations.&lt;br /&gt;
&lt;br /&gt;
By following these best practices and tips, you can enhance the security and performance of your SSH server, protecting it from unauthorized access and potential attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting sshd_config Issues===&lt;br /&gt;
&lt;br /&gt;
When encountering problems with your SSH server configuration, it&#039;s important to know how to diagnose and resolve issues. Here are some common problems and troubleshooting steps:&lt;br /&gt;
&lt;br /&gt;
Check syntax and configuration errors: If the SSH server is not starting or not functioning as expected, check the sshd_config file for any syntax or configuration errors. Use the following command to test the configuration file for errors:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sshd -t&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are any issues, the command will provide error messages with information on what needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
Review log files: Inspect the SSH server log files for any error messages or relevant information. The location of the log files may vary depending on your system, but common locations are /var/log/auth.log or /var/log/secure. Tail the log file while attempting to connect to get real-time information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo tail -f /var/log/auth.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server&lt;br /&gt;
&lt;br /&gt;
Check firewall settings: Ensure that the server&#039;s firewall is allowing SSH connections on the correct port. If you changed the default SSH port, update your firewall rules accordingly.&lt;br /&gt;
&lt;br /&gt;
Verify user permissions: If a specific user is unable to connect, check the user&#039;s permissions, home directory, and the settings in the sshd_config file, such as &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; or &amp;quot;DenyGroups.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SSH server from a client, use the verbose mode to get more detailed information about the connection process. This can help identify any issues with authentication or configuration. Run the following command to enable verbose mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -v user@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user@example.com&amp;quot; with the appropriate username and server address. You can increase the verbosity level by adding more &amp;quot;v&amp;quot; characters (e.g., -vv or -vvv) if needed.&lt;br /&gt;
&lt;br /&gt;
Check file permissions: Ensure that the file permissions for the user&#039;s home directory, the .ssh directory, and the authorized_keys file are set correctly. The user&#039;s home directory should not be writable by other users, the .ssh directory should have permissions set to 700 (drwx------), and the authorized_keys file should have permissions set to 600 (-rw-------).&lt;br /&gt;
&lt;br /&gt;
Test network connectivity: If you&#039;re unable to connect to the SSH server, verify that you can reach the server on the network. Use tools like ping, traceroute, or telnet to check the connection to the server and the specific SSH port.&lt;br /&gt;
&lt;br /&gt;
By following these troubleshooting steps, you should be able to diagnose and resolve most issues related to the sshd_config file and the SSH server configuration. Remember to carefully review the settings in your sshd_config file and consult the server logs for additional information when encountering problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====After making changes, restart the SSH server:====&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running commands on a remote server==&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve connected to a remote server using SSH, you can execute commands on the remote machine just as you would on your local system. However, you can also run commands on a remote server without establishing an interactive SSH session. &lt;br /&gt;
&lt;br /&gt;
This can be useful for automation, scripting, or quick tasks. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
Use the SSH command: To run a command on a remote server without entering an interactive session, use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP -p port &#039;command&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, port with the SSH port number (if different from the default 22), and command with the command you want to execute.&lt;br /&gt;
&lt;br /&gt;
For example, to list the contents of the remote server&#039;s home directory, you can use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 22 &#039;ls -la&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Handling multiple commands===&lt;br /&gt;
If you need to execute multiple commands, you can chain them together using a &#039;&#039;&#039;semicolon&#039;&#039;&#039; or &#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The semicolon allows you to run multiple commands sequentially, while the &amp;amp;&amp;amp; operator runs the next command only if the previous command was successful.&lt;br /&gt;
&lt;br /&gt;
For example, to update the package list and then upgrade the packages on a remote Ubuntu server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 2222 &#039;sudo apt-get update; sudo apt-get upgrade -y&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Command output:&lt;br /&gt;
The output of the command will be displayed in your local terminal, just as if you were running the command on your local machine. Using key-based authentication&lt;br /&gt;
&lt;br /&gt;
==Transferring files with SCP==&lt;br /&gt;
&lt;br /&gt;
The Secure Copy Protocol (SCP) is a useful tool for transferring files between your local machine and a remote server using SSH. SCP ensures that the data is encrypted during transit, providing a secure and efficient way to transfer files.&lt;br /&gt;
&lt;br /&gt;
===Install an SCP client=== &lt;br /&gt;
&lt;br /&gt;
Most Unix-based systems, including Linux and macOS, have an SCP client pre-installed. For Windows, you can use the built-in SCP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from your local machine to a remote server===&lt;br /&gt;
&lt;br /&gt;
To copy a file from your local machine to a remote server, use the following command:&lt;br /&gt;
* Note the use of the upper case &#039;&#039;&#039;-P&#039;&#039;&#039; for ports with &#039;&#039;&#039;scp&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port local_file_path username@hostname_or_IP:remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), local_file_path with the path to the file on your local machine, username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, and remote_file_path with the desired location on the remote server.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 22 /home/john/documents/report.pdf john@example.com:/home/john/reports/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the local machine to the &amp;quot;reports&amp;quot; directory on the remote server.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from a remote server to your local machine===&lt;br /&gt;
To copy a file from a remote server to your local machine, use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port username@hostname_or_IP:remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, remote_file_path with the path to the file on the remote server, and local_file_path with the desired location on your local machine.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 2222 john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
: Or&lt;br /&gt;
&amp;lt;code&amp;gt;scp john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;-&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the remote server&#039;s &amp;quot;reports&amp;quot; directory to the &amp;quot;documents&amp;quot; directory on your local machine.&lt;br /&gt;
&lt;br /&gt;
===Transferring directories=== &lt;br /&gt;
&lt;br /&gt;
To transfer an entire directory, use the &#039;&#039;&#039;-r&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port local_directory_path username@hostname_or_IP:remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, to copy a directory from the remote server to your local machine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port username@hostname_or_IP:remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using SCP is a convenient and secure way to transfer files between your local machine and a remote server. It leverages the security of the SSH protocol to ensure that your data remains encrypted during transit.&lt;br /&gt;
&lt;br /&gt;
===Transferring from Remote Computer to Remote Computer===&lt;br /&gt;
&lt;br /&gt;
Copy the file &#039;&#039;&#039;stuff.txt&#039;&#039;&#039; from remote host &#039;&#039;&#039;12.34.56.67&#039;&#039;&#039; to host &#039;&#039;&#039;11.22.33.44&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.67:/home/user/Documents/stuff.txt name@11.22.33.44:/home/user/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;&#039;-3&#039;&#039;&#039; flag copies between two remote hosts &amp;quot;12.34.56.67&amp;quot; and &amp;quot;11.22.33.44&amp;quot; are transferred through the local host running the command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -3 name@12.34.56.67:/home/user/Documents/stuff.txt \ name@11.22.33.44:/home/user/Documents/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Transferring multiple files===&lt;br /&gt;
&lt;br /&gt;
Send files foo.txt and bar.txt to remote.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp foo.txt bar.txt user@12.34.56.78:~/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from remote &amp;quot;Documents&amp;quot; directory to local &amp;quot;Documents&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp user@11.22.33.44:/home/user/Documents/\{todo_list.txt,links.txt,stuff.txt\} /home/$USER/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from the remote to local current directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.78:~/\{README.md,.bashrc\} . &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Transferring files with SFTP==&lt;br /&gt;
The SSH File Transfer Protocol (SFTP) is another method for transferring files securely between your local machine and a remote server. Unlike SCP, SFTP provides an interactive interface that allows you to navigate, upload, and download files more easily.&lt;br /&gt;
&lt;br /&gt;
Install an SFTP client: Most Unix-based systems, including Linux and macOS, have an SFTP client pre-installed. For Windows, you can use the built-in SFTP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Connect to a remote server: To start an SFTP session with a remote server, open a terminal or command prompt on your local machine and use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P 22 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Navigate the remote filesystem: Once connected, you can use commands similar to those available in a Unix shell to navigate the remote server&#039;s filesystem. Some common SFTP commands include:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;ls&#039;&#039;&#039;: List files and directories&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;cd&#039;&#039;&#039;: Change the current directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;mkdir&#039;&#039;&#039;: Create a new directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rmdir&#039;&#039;&#039;: Remove an empty directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;get&#039;&#039;&#039;: Download a file from the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;put&#039;&#039;&#039;: Upload a file to the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rm&#039;&#039;&#039;: Remove a file&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rename&#039;&#039;&#039;: Rename a file or directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;exit&#039;&#039;&#039;: Exit the SFTP session&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transfer files: To transfer files, use the put command to upload a file from your local machine to the remote server, and the get command to download a file from the remote server to your local machine. For example:&lt;br /&gt;
&lt;br /&gt;
Upload a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put local_file_path remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_file_path and remote_file_path with the appropriate paths for the files you want to transfer.&lt;br /&gt;
&lt;br /&gt;
Transferring directories: To transfer entire directories, use the -r flag with the put and get commands:&lt;br /&gt;
&lt;br /&gt;
Upload a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put -r local_directory_path remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get -r remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disconnect from the remote server: When you&#039;ve finished transferring files, type exit to close the SFTP session.&lt;br /&gt;
&lt;br /&gt;
SFTP offers a more user-friendly, interactive experience for transferring files compared to SCP. By utilizing the secure and encrypted SSH protocol, SFTP ensures that your data remains safe during transfer.&lt;br /&gt;
&lt;br /&gt;
==Advanced SSH Techniques==&lt;br /&gt;
=== Port forwarding and tunneling===&lt;br /&gt;
&lt;br /&gt;
SSH port forwarding and tunneling allow you to securely forward network traffic between your local machine and a remote server. This can be useful for accessing remote services, bypassing firewalls, or securely transmitting sensitive data.&lt;br /&gt;
&lt;br /&gt;
Local Port Forwarding: Local port forwarding creates a secure tunnel between your local machine and a remote server, allowing you to access remote services as if they were running on your local machine. To set up local port forwarding, use the -L flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -L local_port:remote_host:remote_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_port with an available port on your local machine, remote_host with the hostname or IP address of the remote server hosting the service, remote_port with the port number of the remote service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
Remote Port Forwarding: Remote port forwarding enables you to expose a local service running on your machine to a remote network. To set up remote port forwarding, use the -R flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -R remote_port:local_host:local_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace remote_port with an available port on the remote server, local_host with the hostname or IP address of the local machine hosting the service, local_port with the port number of the local service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:**Forwarding X, Sound, and Video on Ubuntu 22.04 with Ubuntu 22.04 LXC**: To forward X, sound, and video from a remote Ubuntu 22.04 server to your local Ubuntu 22.04 machine, you&#039;ll need to enable X11 forwarding and install the necessary packages.&lt;br /&gt;
&lt;br /&gt;
:*    Install required packages: On both your local machine and the remote server, install the x11-apps and pulseaudio packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt update&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install x11-apps pulseaudio&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Enable X11 forwarding: To enable X11 forwarding, you&#039;ll need to edit the SSH server configuration file (/etc/ssh/sshd_config) on the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line containing &amp;quot;X11Forwarding&amp;quot; and set its value to &amp;quot;yes&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;X11Forwarding yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol. Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Connect with X11 forwarding: From your local machine, use the -X flag to enable X11 forwarding when connecting to the remote server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -X username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Export PULSE_SERVER environment variable: On the remote server, export the PULSE_SERVER environment variable to forward sound:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;export PULSE_SERVER=tcp:localhost&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add this line to the remote user&#039;s ~/.bashrc or ~/.profile file to make the change permanent.&lt;br /&gt;
&lt;br /&gt;
:*    Run applications: Now, you can run graphical applications on the remote server, and they will be displayed on your local machine with sound and video forwarded.&lt;br /&gt;
&lt;br /&gt;
Please note that forwarding X, sound, and video might cause increased latency and reduced performance compared to running the applications locally.&lt;br /&gt;
&lt;br /&gt;
=== SSH agent forwarding===&lt;br /&gt;
SSH agent forwarding is a powerful feature that allows you to use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers. This is particularly useful when you need to access one remote server (Server B) through another remote server (Server A).&lt;br /&gt;
&lt;br /&gt;
====    Start the SSH agent on your local machine ====&lt;br /&gt;
&lt;br /&gt;
Before you enable SSH agent forwarding, you need to start the SSH agent on your local machine. Open a terminal and run the following command:&lt;br /&gt;
&lt;br /&gt;
:* For Linux and macOS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Windows (Git Bash or Cygwin):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval $(ssh-agent)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command starts the SSH agent and sets the required environment variables.&lt;br /&gt;
&lt;br /&gt;
====Add your SSH key to the agent====&lt;br /&gt;
&lt;br /&gt;
Next, add your private key to the SSH agent with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-add ~/.ssh/your_private_key&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_private_key&#039;&#039;&#039; with the filename of your private key. This might be &#039;&#039;&#039;id_rsa&#039;&#039;&#039;, &#039;&#039;&#039;id_ed25519&#039;&#039;&#039;, or another key file depending on your setup.&lt;br /&gt;
&lt;br /&gt;
====Configure SSH agent forwarding on your local machine====&lt;br /&gt;
&lt;br /&gt;
Edit your SSH config file to enable agent forwarding. The config file is usually located at &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;. If the file doesn&#039;t exist, create it.&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the config file: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server_a_alias&lt;br /&gt;
  HostName server_a_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_a&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host server_b_alias&lt;br /&gt;
  HostName server_b_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_b&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &lt;br /&gt;
:* &#039;&#039;&#039;server_a_alias&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039; server_a_ip_or_hostname&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_a&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;server_b_alias&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;server_b_ip_or_hostname&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_b&#039;&#039;&#039; &lt;br /&gt;
with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Make sure your public key is added to the remote servers====&lt;br /&gt;
&lt;br /&gt;
Before you can use SSH agent forwarding, you need to add your public key to the &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; file on both Server A and Server B. If you haven&#039;t done this already, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/your_public_key user@server_ip_or_hostname&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_public_key&#039;&#039;&#039;, &#039;&#039;&#039;user&#039;&#039;&#039;, and &#039;&#039;&#039;server_ip_or_hostname&#039;&#039;&#039; with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Test SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
First, SSH into Server A:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_a_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from Server A, SSH into Server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_b_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything is set up correctly, you should be able to access Server B without being prompted for a password.&lt;br /&gt;
&lt;br /&gt;
====Verify SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
To make sure that SSH agent forwarding is working, you can check the value of the &#039;&#039;&#039;SSH_AUTH_SOCK&#039;&#039;&#039; environment variable on Server B.&lt;br /&gt;
&lt;br /&gt;
From Server B, run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;echo $SSH_AUTH_SOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If SSH agent forwarding is working, this command should return a non-empty value.&lt;br /&gt;
&lt;br /&gt;
That&#039;s it! You&#039;ve successfully set up and tested SSH agent forwarding. Now you can use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Command Restriction===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file can be used to restrict the commands that a specific SSH key can execute. This is especially useful for security purposes, to limit the potential damage that could be done if a key is compromised.&lt;br /&gt;
&lt;br /&gt;
By including a &#039;&#039;&#039;command=&#039;&#039;&#039; directive in the &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file, you can specify the exact command that will be run when a client connects using the associated key. Any command provided by the client will be ignored, and the command specified in the authorized_keys file will be used instead.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is set up to always execute the &#039;&#039;&#039;scp&#039;&#039;&#039; command (used for secure copy of files over SSH) to the specified directory, no matter what command was originally issued by the client. This is a good way to create a &amp;quot;write-only&amp;quot; drop box, for instance.&lt;br /&gt;
&lt;br /&gt;
However, the keyholder could potentially still execute arbitrary commands by carefully crafting the file names they upload, so additional precautions should be taken, such as using command= along with other directives like &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039;, &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039;, and &#039;&#039;&#039;no-pty&#039;&#039;&#039; to further limit what can be done with the key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;,no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This entry does the following:&lt;br /&gt;
&lt;br /&gt;
:*    The &#039;&#039;&#039;command=&#039;&#039;&#039; directive runs the specified command when a client connects using this key. In this case, the command is scp, which securely copies files to the /home/rscp/media/ directory.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039; directive prevents the client from using SSH&#039;s port forwarding features, which could potentially be used to create a secure tunnel for other network traffic.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039; directive prevents the client from forwarding X11 graphical sessions, which could be used to run graphical applications over the SSH connection.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-pty&#039;&#039;&#039; directive prevents the allocation of a pseudo-terminal, which means the client can&#039;t interact with a shell or run interactive commands.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039; part is the public key of the client. Replace this with the actual key.&lt;br /&gt;
&lt;br /&gt;
This configuration significantly limits the operations that can be performed with this key, providing an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
====SCP Only====&lt;br /&gt;
&lt;br /&gt;
Use Case Example: Have a Server hosting XML Dumps, and want to automate sending a file or directory from Server1 to Server2 using a script and ssh-key so i don&#039;t need to enter password. &lt;br /&gt;
&lt;br /&gt;
=====Create Account on Server=====&lt;br /&gt;
Create user account you are going to use:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;adduser rscp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure user has a &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory to send public key to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make a Directory to transfer files to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If you see error &amp;lt;code&amp;gt;scp: /home/rscp/media/test.txt: Permission denied&amp;lt;/code&amp;gt; If you created directory &#039;&#039;&#039;media&#039;&#039;&#039; when logged in as &#039;&#039;&#039;root&#039;&#039;&#039; then check directory permissions and if need [[Linux_Users_and_Groups#File_Ownership_and_Permissions|assign ownership to &#039;&#039;&#039;user&#039;&#039;&#039; account.]]&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;code&amp;gt;chown rscp:rscp /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Ubuntu_22.04_SSH_Guide#Copying_public_keys_to_the_remote_server|Send your public key to server]]&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If from remote server you are sending a Directory include the &#039;&#039;&#039;-r&#039;&#039;&#039; flag in command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t -r /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This entry in the authorized_keys file uses the command option to restrict the SSH command that can be run with the associated SSH key. The command option specifies that the scp command should be used to transfer files to the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory on the server.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the entry:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;command=&amp;quot;/usr/bin/scp -t /home/rscp/&amp;quot;&#039;&#039;&#039;: This specifies that the scp command should be used as the SSH command for this key, with the &#039;&#039;&#039;-t&#039;&#039;&#039; option to specify that the remote end is a file (in this case, a directory), and the destination directory on the server is /home/rscp/. This means that the user can only use the SSH key to transfer files to the /home/rscp/ directory on the server.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039;: This is the public key associated with the private key that is used for authentication.&lt;br /&gt;
&lt;br /&gt;
By using the command option in this way, you can restrict the actions that the user can perform with the SSH key, which can help to improve security. In this case, the user can only transfer files to the specified directory on the server using the scp command.&lt;br /&gt;
&lt;br /&gt;
======Tip - transfer file to a path your USER does not have permissions for======&lt;br /&gt;
&lt;br /&gt;
You can write a shell script to check the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory every minute using a while loop and the sleep command. If any files are found in the directory, the script can move them to the &#039;&#039;&#039;/var/www/media&#039;&#039;&#039; directory using the mv command. Here&#039;s an example script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
  if [ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]; then&lt;br /&gt;
    mv /home/rscp/media/* /var/www/media/&lt;br /&gt;
  fi&lt;br /&gt;
  sleep 60&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this script, the while loop runs indefinitely (&#039;&#039;&#039;while true&#039;&#039;&#039;) and sleeps for 60 seconds at the end of each iteration (&#039;&#039;&#039;sleep 60&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;if&#039;&#039;&#039; statement checks if the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory is not empty (&#039;&#039;&#039;[ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]&#039;&#039;&#039;). If it is not empty, the &#039;&#039;&#039;mv&#039;&#039;&#039; command is used to move all files and directories from the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory to the &#039;&#039;&#039;/var/www/media/&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Save this script to a file (e.g. &#039;&#039;&#039;move-files.sh&#039;&#039;&#039;) and make it executable using the &#039;&#039;&#039;chmod +x move-files.sh&#039;&#039;&#039; command. You can then run the script using &#039;&#039;&#039;./move-files.sh &amp;amp;&#039;&#039;&#039; to start it in the background and allow it to run indefinitely. The &amp;amp; symbol is used to run the script in the background so that you can continue using the terminal.&lt;br /&gt;
&lt;br /&gt;
Note that running this script indefinitely can consume system resources, so you may want to consider setting up a scheduled task (e.g. using &#039;&#039;&#039;[[Cron_ubuntu_22.04|cron]]&#039;&#039;&#039;) to run the script at a specific interval instead of running it indefinitely.&lt;br /&gt;
&lt;br /&gt;
==Tilde &#039;&#039;&#039;~&#039;&#039;&#039; the escape character==&lt;br /&gt;
&lt;br /&gt;
The tilde (~) character has a special meaning in the context of SSH. When using SSH, you can use the tilde character followed by a control sequence to perform certain actions. These are called &amp;quot;tilde escape sequences&amp;quot; or &amp;quot;tilde commands.&amp;quot; They are useful for managing your SSH connections.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to use tilde escape sequences when connected to a remote server via SSH:&lt;br /&gt;
&lt;br /&gt;
:*    Make sure you are at the beginning of a new line in your terminal. Press &#039;&#039;&#039;Enter&#039;&#039;&#039; if you are not.&lt;br /&gt;
&lt;br /&gt;
:*    Type the tilde (~) character, followed by the appropriate control sequence. Note that you should not press &#039;&#039;&#039;Enter&#039;&#039;&#039; after typing the tilde character, but rather type the control sequence directly after it.&lt;br /&gt;
&lt;br /&gt;
Here are some common tilde escape sequences:&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;~.&#039;&#039;&#039; : Close the SSH connection. This can be helpful if the connection is frozen or unresponsive.&lt;br /&gt;
:    &#039;&#039;&#039;~^Z&#039;&#039;&#039; : Suspend the SSH connection and return to your local shell. You can later resume the connection using the fg command.&lt;br /&gt;
:    &#039;&#039;&#039;~#&#039;&#039;&#039; : List all forwarded connections (both local and remote) that are active in the current SSH session.&lt;br /&gt;
:    &#039;&#039;&#039;~&amp;amp;&#039;&#039;&#039; : Run the SSH session in the background. This is useful if you want to perform other tasks on your local machine without closing the SSH connection.&lt;br /&gt;
:    &#039;&#039;&#039;~~&#039;&#039;&#039; : Send a literal tilde character to the remote system. This is useful if you need to type a tilde character in the remote system without triggering an escape sequence.&lt;br /&gt;
&lt;br /&gt;
Remember that these escape sequences only work if they are entered at the beginning of a new line in your terminal. If you&#039;re typing them in the middle of a command or text, they won&#039;t be recognized as special control sequences.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting and Best Practices==&lt;br /&gt;
&lt;br /&gt;
In this section, we&#039;ll cover some common issues and best practices related to SSH connections, including managing a large number of SSH keys.&lt;br /&gt;
&lt;br /&gt;
===Too many authentication attempts===&lt;br /&gt;
&lt;br /&gt;
When connecting to an SSH server, you might encounter the &amp;quot;Too many authentication attempts&amp;quot; error. This is often caused by having too many private keys in your ~/.ssh directory. By default, SSH tries each key until it finds the correct one, but many servers limit the number of authentication attempts.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;: To resolve this issue, you can create a separate directory for your keys and configure the SSH config file to use the appropriate key for each connection.&lt;br /&gt;
&lt;br /&gt;
:*    Create a new directory for your keys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir ~/.ssh/keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Move your private key files to the new directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv ~/.ssh/id_rsa_* ~/.ssh/keys/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update your SSH config file to specify the correct key for each connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Host server1&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server1&lt;br /&gt;
&lt;br /&gt;
    Host server2&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permission issues=== &lt;br /&gt;
&lt;br /&gt;
SSH is very strict about file and directory permissions. Ensure that your ~/.ssh directory and its contents have the correct permissions:&lt;br /&gt;
&lt;br /&gt;
:*    The ~/.ssh directory should have permissions set to 700:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 700 ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private key files should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/id_rsa&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ~/.ssh/config file should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &amp;lt;b&amp;gt;Best practices&amp;lt;/b&amp;gt;: Follow these best practices to maintain secure and efficient SSH connections:&lt;br /&gt;
&lt;br /&gt;
:*    Use SSH key pairs instead of passwords for authentication, as they provide better security.&lt;br /&gt;
:*    Regularly update your SSH keys to maintain their security.&lt;br /&gt;
:*    Use strong, unique passphrases to protect your private keys.&lt;br /&gt;
:*    Disable password authentication and root login on your SSH server to reduce the risk of brute-force attacks.&lt;br /&gt;
:*    Regularly update your SSH server software to ensure you&#039;re running the latest security patches.&lt;br /&gt;
:*    Use non-standard port numbers for your SSH server to make it less likely to be targeted by automated attacks.&lt;br /&gt;
:*    Implement multi-factor authentication (MFA) for your SSH connections, if possible.&lt;br /&gt;
:*    Regularly review and remove any unnecessary authorized keys from the ~/.ssh/authorized_keys file on your servers.&lt;br /&gt;
:*    Use the Match directive in the sshd_config file to apply custom rules and settings for different users, groups, or connections.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=437</id>
		<title>Ubuntu 22.04 SSH Guide</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=437"/>
		<updated>2023-05-16T12:05:39Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Key-based Authentication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Understanding SSH==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SSH&#039;&#039;&#039; is a protocol that uses encryption to secure data transmitted between a client and a server. &amp;lt;br&amp;gt;&lt;br /&gt;
It enables users to execute commands, transfer files, and manage remote systems through an encrypted channel. &amp;lt;br&amp;gt;&lt;br /&gt;
SSH is widely used by system administrators for managing servers, network devices, and other remote systems.&lt;br /&gt;
&lt;br /&gt;
==Installing SSH==&lt;br /&gt;
&lt;br /&gt;
To start using SSH, you&#039;ll need to install and configure both the server and client components.&lt;br /&gt;
&lt;br /&gt;
* OpenSSH-Server&lt;br /&gt;
** Is required to allow &#039;&#039;&#039;ssh&#039;&#039;&#039; connections&lt;br /&gt;
* OpenSSH-Client&lt;br /&gt;
** Is used to login/connect to OpenSSH-Server&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Desktop, the &#039;&#039;&#039;openssh client&#039;&#039;&#039; will be preinstalled, allowing you to connect to a server which is running &#039;&#039;&#039;openssh-server&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Server, both the &#039;&#039;&#039;ssh client&#039;&#039;&#039; and &#039;&#039;&#039;openssh server&#039;&#039;&#039; are preinstalled by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing OpenSSH Server===&lt;br /&gt;
On Ubuntu distributions, you can install the OpenSSH server by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install openssh-server&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the SSH server status with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl status ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Installing OpenSSH Client===&lt;br /&gt;
&lt;br /&gt;
The OpenSSH client is usually pre-installed on most Linux and macOS systems. &amp;lt;br&amp;gt;For Windows, you can install the OpenSSH client by following the instructions on the official website:&amp;lt;br&amp;gt; https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse&lt;br /&gt;
&lt;br /&gt;
==Basic SSH Commands and Usage==&lt;br /&gt;
=== Connecting to a remote server===&lt;br /&gt;
Connecting to a remote server using SSH is a fundamental task when managing remote systems. Here&#039;s how to connect to a remote server using the command-line interface.&lt;br /&gt;
&lt;br /&gt;
Install an SSH client: Ensure you have an SSH client installed on your local machine. Most Unix-based systems, including Linux and macOS, have an SSH client pre-installed. For Windows, you can use the built-in OpenSSH client (available in Windows 10 and later) or a third-party client like PuTTY.&lt;br /&gt;
&lt;br /&gt;
====Gather connection information====&lt;br /&gt;
To connect to a remote server, you&#039;ll need the following information:&lt;br /&gt;
* The remote server&#039;s IP address or hostname&lt;br /&gt;
* The SSH port number (default is 22)&lt;br /&gt;
* Your username on the remote server&lt;br /&gt;
* The password for the user on remote server.&lt;br /&gt;
&lt;br /&gt;
====Connect using SSH====&lt;br /&gt;
Open a terminal or command prompt on your local machine and use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;username&#039;&#039;&#039; with your username on the remote server, &#039;&#039;&#039;hostname_or_IP&#039;&#039;&#039; with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
If OpenSSH-Server is running/listening on a port other than the default port &#039;&#039;&#039;22&#039;&#039;&#039; include the port with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag.&lt;br /&gt;
&lt;br /&gt;
For example (If port 2222):&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh john@example.com -p 2222&amp;lt;/code&amp;gt;&lt;br /&gt;
Or&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh -p 2222 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Connecting to a Remote Server =====&lt;br /&gt;
&lt;br /&gt;
In this example, we connect to a remote Ubuntu VPS with the following credentials:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Username: root&lt;br /&gt;
    IP address: 12.34.56.78&lt;br /&gt;
    Password: password2simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password. Type password2simple and press Enter. This demonstrates how simple it can be to log into a remote computer with root access.&lt;br /&gt;
&lt;br /&gt;
* If your Server is hosting SSHD on a port other than default &#039;port 22&#039; include port number with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag&lt;br /&gt;
Example with port 2222:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -p 2222 root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Authenticate====&lt;br /&gt;
When connecting for the first time, you&#039;ll see a prompt asking you to confirm the remote server&#039;s fingerprint. Verify the fingerprint and type &amp;quot;yes&amp;quot; to proceed. Next, you&#039;ll be prompted for your password. Enter your password to complete the authentication process.&lt;br /&gt;
&lt;br /&gt;
Once authenticated, you&#039;ll have access to the remote server&#039;s command line. You can now execute commands and manage the remote server as if you were working on it directly.&lt;br /&gt;
&lt;br /&gt;
Remember that you can use key-based authentication (with a private-public key pair) instead of a password for a more secure and convenient connection method.&lt;br /&gt;
== Using SSH config file==&lt;br /&gt;
&lt;br /&gt;
An SSH config file allows you to define and manage multiple SSH connections, simplifying the process of connecting to remote servers. By creating an SSH config file, you can define custom options, such as port numbers, usernames, and key files, for each connection. The SSH config file is typically located in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory and named config.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to create and use an SSH config file:&lt;br /&gt;
&lt;br /&gt;
:*    Create the SSH config file: If it doesn&#039;t exist, create the config file in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory using a text editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Define a connection: To define a connection, you&#039;ll need to specify a Host entry followed by any options you want to apply to that connection. Here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server1&lt;br /&gt;
  HostName example.com&lt;br /&gt;
  User your_username&lt;br /&gt;
  Port 2222&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this example, we&#039;ve defined a connection called server1 with the following options:&lt;br /&gt;
&lt;br /&gt;
:*    HostName: The hostname or IP address of the remote server (example.com in this case).&lt;br /&gt;
:*    User: The username to use when connecting to the remote server (replace your_username with your actual username).&lt;br /&gt;
:*    Port: The port number to use for the SSH connection (2222 in this example).&lt;br /&gt;
:*    IdentityFile: The path to the private key file to use for authentication (replace ~/.ssh/id_rsa_server1 with the path to your private key file).&lt;br /&gt;
&lt;br /&gt;
You can define multiple connections in the same config file by creating separate Host entries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server2&lt;br /&gt;
  HostName 192.168.1.100&lt;br /&gt;
  User another_username&lt;br /&gt;
  Port 22&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Connect using the SSH config file: To connect to a remote server using the defined connection, simply use the ssh command followed by the Host entry:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, SSH will automatically use the options defined in the config file for server1, such as the hostname, username, port number, and identity file.&lt;br /&gt;
&lt;br /&gt;
By using an SSH config file, you can simplify the process of managing multiple SSH connections and customize the options for each connection.&lt;br /&gt;
&lt;br /&gt;
==Key-based Authentication==&lt;br /&gt;
&lt;br /&gt;
Why use key-based authentication?&lt;br /&gt;
* Server1: 12.34.56.78&lt;br /&gt;
* Server2: 12.34.56.87&lt;br /&gt;
&lt;br /&gt;
You are trying to login to Server1, but by mistake you enter your &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; to Server2, Can Server2 record the &#039;&#039;&#039;user&#039;&#039;&#039; and &#039;&#039;&#039;password&#039;&#039;&#039; you used?&lt;br /&gt;
[[placeholder|YES, Yes it can]] &lt;br /&gt;
&lt;br /&gt;
=== Generating SSH key pairs===&lt;br /&gt;
&lt;br /&gt;
SSH key pairs consist of a private key and a public key. They provide a secure, passwordless authentication method for connecting to remote servers. The private key remains on your local machine, while the public key is added to the remote server&#039;s authorized keys. Here&#039;s how to generate an SSH key pair:&lt;br /&gt;
&lt;br /&gt;
Open a terminal: On Unix-based systems (Linux and macOS), open a terminal. On Windows, open PowerShell or the Command Prompt.&lt;br /&gt;
&lt;br /&gt;
Generate the key pair: Use the ssh-keygen command to create a new SSH key pair. The following command generates a 4096-bit RSA key pair:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also generate other types of keys, such as Ed25519, by changing the -t option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t ed25519&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specify the key&#039;s location: When prompted, you can either accept the default location (~/.ssh/id_rsa for RSA keys, ~/.ssh/id_ed25519 for Ed25519 keys) or enter a custom path. It is recommended to use the default location unless you have a specific reason to change it.&lt;br /&gt;
&lt;br /&gt;
Set a passphrase (optional): You can choose to protect your private key with a passphrase. If you do, you&#039;ll need to enter the passphrase every time you use the key. This adds an extra layer of security, but can be less convenient for automation or scripting. To set a passphrase, enter it when prompted; otherwise, leave the field blank&lt;br /&gt;
&lt;br /&gt;
====Selecting file name and path for keys====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option in the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command is used to specify the output file for the generated key pair. In your example, &#039;&#039;&#039;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&#039;&#039;&#039;, the command is generating an RSA key pair with a key length of 4096 bits, and the output files will be saved in the &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory with the base name &#039;&#039;&#039;nuc&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the options used in this command:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-f .ssh/nuc&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039; and the public key in &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Create keys with no passphase====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -N &amp;quot;&amp;quot; -C &amp;quot;MYSERVER&amp;quot; -f ~/.ssh/serverkey&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-N &amp;quot;&amp;quot;&#039;&#039;&#039;: Specifies an empty passphrase for the key pair. This means that the private key will not be encrypted, and no passphrase will be required when using it. This can be less secure, but more convenient for automated processes.&lt;br /&gt;
:*    &#039;&#039;&#039;-C &amp;quot;MYSERVER&amp;quot;&#039;&#039;&#039;: Adds a comment to the generated key pair. In this case, the comment is &amp;quot;MYSERVER&amp;quot;. Comments are useful for identifying keys when you have multiple keys in your ~/.ssh directory or on a remote server.&lt;br /&gt;
:*    &#039;&#039;&#039;-f ~/.ssh/serverkey&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039; and the public key in &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;. The private key will have an empty passphrase and a comment &amp;quot;MYSERVER&amp;quot; for easier identification.&lt;br /&gt;
&lt;br /&gt;
====Remove the passphrase from an existing SSH private key====&lt;br /&gt;
&lt;br /&gt;
To remove the passphrase from an existing SSH private key, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, which is used for changing the passphrase. Follow these steps:&lt;br /&gt;
&lt;br /&gt;
:*    Make a backup of your private key file, just in case something goes wrong during the process. You can do this by running the following command, replacing &#039;&#039;&#039;&amp;lt;your_private_key&amp;gt;&#039;&#039;&#039; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
::**     &#039;&#039;&#039;-p&#039;&#039;&#039;: Indicates that you want to change the passphrase of an existing private key.&lt;br /&gt;
::**    &#039;&#039;&#039;-f &amp;lt;your_private_key&amp;gt;&#039;&#039;&#039;: Specifies the private key file whose passphrase you want to change.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    You will be prompted to enter the old passphrase for the private key. Type it in and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Since you want to remove the passphrase, leave this field empty and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the empty passphrase. Press Enter again to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has its passphrase removed. Keep in mind that this makes the private key less secure, as anyone with access to the file can use it without needing to know the passphrase.&lt;br /&gt;
&lt;br /&gt;
====Add/Change a passphrase to an existing SSH Key====&lt;br /&gt;
&lt;br /&gt;
To add a passphrase to an existing SSH private key that doesn&#039;t have one, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, just like when you change or remove a passphrase. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;Make a backup of your private key file&#039;&#039;&#039;, just in case something goes wrong during the process. You can do this by running the following command, replacing &amp;lt;your_private_key&amp;gt; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the -p option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*   You will be prompted to enter the old passphrase for the private key. Since your private key doesn&#039;t currently have a passphrase, just press Enter to proceed.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Type in the passphrase you want to set for the private key and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the new passphrase. Type it again and press Enter to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has a passphrase added to it. This provides an extra layer of security, as anyone using the key will need to know the passphrase to access it. Keep in mind that you should use a strong passphrase to ensure better security.&lt;br /&gt;
&lt;br /&gt;
=== Copying public keys to the remote server===&lt;br /&gt;
After generating an SSH key pair, you&#039;ll need to copy the public key to the remote server to enable key-based authentication. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
====Using ssh-copy-id====&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;ssh-copy-id&#039;&#039;&#039; command (Linux and macOS): On Unix-based systems, you can use the ssh-copy-id command to copy your public key to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ~/.ssh/id_rsa.pub with the path to your public key file (e.g., ~/.ssh/id_ed25519.pub for Ed25519 keys), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
====Manually copy the public key====&lt;br /&gt;
&lt;br /&gt;
Manually copy the public key (Windows and alternative method): If you don&#039;t have access to the ssh-copy-id command or prefer to do it manually, you can:&lt;br /&gt;
&lt;br /&gt;
:* Open your public key file (e.g., id_rsa.pub or id_ed25519.pub) with a text editor and copy its content.&amp;gt;&lt;br /&gt;
:* Log in to the remote server via SSH.&amp;lt;br&amp;gt;&lt;br /&gt;
:* Create the ~/.ssh directory if it doesn&#039;t exist:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit or create the ~/.ssh/authorized_keys file using a text editor (e.g., nano, vim, or emacs), and paste the content of your public key at the end of the file. Save and close the file.&lt;br /&gt;
&lt;br /&gt;
Set the correct file permissions: To ensure the security of your SSH setup, it&#039;s essential to set the proper file permissions on your local machine and the remote server:&lt;br /&gt;
&lt;br /&gt;
:* On your local machine:&lt;br /&gt;
:**       Private key (id_rsa or id_ed25519): -rw------- (600)&lt;br /&gt;
:**       Public key (id_rsa.pub or id_ed25519.pub): -rw-r--r-- (644)&lt;br /&gt;
&lt;br /&gt;
:*    On the remote server:&lt;br /&gt;
:**        ~/.ssh directory: drwx------ (700)&lt;br /&gt;
:**        ~/.ssh/authorized_keys file: -rw------- (600)&lt;br /&gt;
&lt;br /&gt;
To set the permissions on your local machine, use the chmod command:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
chmod 644 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On the remote server, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 700 ~/.ssh&lt;br /&gt;
chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you&#039;ve copied your public key to the remote server and set the correct file permissions, you should be able to connect using key-based authentication without the need for a password.&lt;br /&gt;
&lt;br /&gt;
=== Disabling password authentication (optional)===&lt;br /&gt;
Disabling password authentication enhances the security of your SSH server by requiring key-based authentication for all connections. You can disable password authentication for specific users or for all users. To do so, follow these steps:&lt;br /&gt;
&lt;br /&gt;
:* Connect to the remote server: Log in to the remote server via SSH using your username and the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:* Edit the SSH configuration file: Open the SSH server configuration file (usually located at /etc/ssh/sshd_config) with a text editor such as nano, vim, or emacs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for all users: Find the line containing &amp;quot;PasswordAuthentication&amp;quot; and set its value to &amp;quot;no&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol.&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for a specific user: To disable password authentication only for a particular user, you can use a &amp;quot;Match User&amp;quot; block at the end of the sshd_config file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User username&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Replace username with the actual username for which you want to disable password authentication.&lt;br /&gt;
&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, password authentication will be disabled for the specified user(s), and only key-based authentication will be allowed. Remember that if you disable password authentication, you must have a working SSH key pair set up to access the server, or you may be locked out.&lt;br /&gt;
&lt;br /&gt;
== Configuring the SSH server==&lt;br /&gt;
&lt;br /&gt;
Edit the SSH server configuration file located at &amp;lt;b&amp;gt;/etc/ssh/sshd_config&amp;lt;/b&amp;gt; to set your desired settings. You can modify options like the listening port, allowing root login, and more.&lt;br /&gt;
&lt;br /&gt;
===Common sshd_config Options===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file is located at &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; on most Linux systems. This file contains various options and settings that determine the behavior of the OpenSSH server. Each option is followed by its value, and lines starting with a &amp;lt;b&amp;gt;#&amp;lt;/b&amp;gt; are considered comments.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an overview of some common options in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
===Port===&lt;br /&gt;
&lt;br /&gt;
Specifies the port number that the SSH server listens on.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Port 22&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AddressFamily===&lt;br /&gt;
&lt;br /&gt;
Determines the IP address family (IPv4, IPv6, or both) used by the SSH server.&lt;br /&gt;
&lt;br /&gt;
* To specify that the SSH server should only listen for incoming IPv4 connections:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Or, if you want the SSH server to only listen for incoming IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;inet6&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to allow both IPv4 and IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;any&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily any&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ListenAddress===&lt;br /&gt;
Specifies the IP address(es) the SSH server listens on. By default, it listens on all available addresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ListenAddress 192.168.1.10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Protocol===&lt;br /&gt;
Defines the SSH protocol version. It&#039;s recommended to use only protocol 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Protocol 2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PermitRootLogin===&lt;br /&gt;
Controls whether root login is allowed. It&#039;s generally advised to disable root login or set it to &amp;quot;without-password&amp;quot; to allow only key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitRootLogin no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===PasswordAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables password-based authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PubkeyAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PubkeyAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AuthorizedKeysFile===&lt;br /&gt;
Specifies the location of the authorized keys file for public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;AuthorizedKeysFile .ssh/authorized_keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LogLevel===&lt;br /&gt;
Sets the logging level for the SSH server.&lt;br /&gt;
&lt;br /&gt;
The LogLevel option in &#039;&#039;&#039;sshd_config&#039;&#039;&#039; controls the amount of information that SSH daemon (sshd) logs.&lt;br /&gt;
&lt;br /&gt;
There are different log levels that can be set with this option, each providing a different level of detail:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;QUIET&#039;&#039;&#039;: Disables all logging.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;FATAL&#039;&#039;&#039;: Only logs fatal errors.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;ERROR&#039;&#039;&#039;: Logs error messages.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;INFO&#039;&#039;&#039;: Logs informational messages such as login attempts.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VERBOSE&#039;&#039;&#039;: Logs more detailed information than INFO, including shell commands executed.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEBUG&#039;&#039;&#039;: Logs detailed debugging information, including raw protocol details.&lt;br /&gt;
&lt;br /&gt;
The default log level is &#039;&#039;&#039;INFO&#039;&#039;&#039;, which is usually sufficient for most purposes. However, if you need to troubleshoot SSH connections or monitor user activity, setting a higher log level may be helpful.&lt;br /&gt;
&lt;br /&gt;
To change the &#039;&#039;&#039;LogLevel&#039;&#039;&#039; in &#039;&#039;&#039;sshd_config&#039;&#039;&#039;, you can edit the file &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; (or the appropriate configuration file for your system), and add or modify the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel &amp;lt;log_level&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;log_level&amp;gt; is one of the log levels listed above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel INFO&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LoginGraceTime===&lt;br /&gt;
&lt;br /&gt;
Defines the time allowed for a user to successfully log in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LoginGraceTime 2m&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MaxAuthTries===&lt;br /&gt;
&lt;br /&gt;
Limits the number of authentication attempts allowed per connection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxAuthTries 6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MaxSessions===&lt;br /&gt;
&lt;br /&gt;
Specifies the maximum number of simultaneous sessions allowed per network connection.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxSessions 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AllowUsers, DenyUsers, AllowGroups, DenyGroups===&lt;br /&gt;
&lt;br /&gt;
These options control which users and groups are allowed or denied access to the SSH server. They provide a way to manage access control based on usernames and group membership.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;: Specifies a list of users allowed to access the SSH server. Other users will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowUsers user1 user2 user3&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;: Specifies a list of users denied access to the SSH server. Other users will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyUsers user4 user5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;: Specifies a list of groups whose members are allowed to access the SSH server. Users not belonging to these groups will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowGroups group1 group2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;: Specifies a list of groups whose members are denied access to the SSH server. Users not belonging to these groups will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyGroups group3 group4&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the order in which these options are applied is &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;, &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;, &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;, and finally &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Banner===&lt;br /&gt;
&lt;br /&gt;
The Banner option allows you to display a message or warning to users before they log in to the SSH server. This is often used to display legal notices, security warnings, or other important information.&lt;br /&gt;
&lt;br /&gt;
To enable the banner, set the Banner option to the path of a text file containing the message you want to display:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Banner /etc/ssh/banner.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create the /etc/ssh/banner.txt file and add your desired message. The content of this file will be displayed to users before they log in.&lt;br /&gt;
&lt;br /&gt;
==Advanced sshd_config Options==&lt;br /&gt;
=== PermitTunnel===&lt;br /&gt;
The PermitTunnel option enables or disables the use of SSH tunneling. Tunnels can be used to forward ports or create VPN-like connections between the client and the server. &lt;br /&gt;
* There are four possible values for this option:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;yes&amp;quot;&#039;&#039;&#039;: Allows all types of tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;point-to-point&amp;quot;&#039;&#039;&#039;: Allows only point-to-point (Layer 3) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;ethernet&amp;quot;&#039;&#039;&#039;: Allows only Ethernet (Layer 2) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;no&amp;quot;&#039;&#039;&#039;: Disables tunneling (default).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable tunneling, set the PermitTunnel option in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitTunnel yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keep in mind that enabling tunnels may expose your server to additional security risks. Only enable this option if you understand the implications and have a specific use case that requires it.&lt;br /&gt;
&lt;br /&gt;
=== ChrootDirectory===&lt;br /&gt;
The ChrootDirectory option allows you to restrict a user or a group to a specific directory (known as a chroot jail) when they log in via SSH. This can enhance security by isolating users and limiting their access to only the necessary parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
To set up a chroot jail, follow these steps:&lt;br /&gt;
&lt;br /&gt;
Create a directory that will serve as the chroot jail. For example, let&#039;s create a directory for user1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the ownership of the directory to the user and their primary group:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown user1:user1 /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ChrootDirectory for user1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ChrootDirectory /home/user1/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, they will be restricted to the /home/user1/chroot directory and won&#039;t be able to access other parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
Note that the chroot jail should be owned by root and not writable by the user. If you need to provide write access to specific directories, create subdirectories inside the chroot jail and set appropriate permissions for those. Also, some features like SFTP may require additional configuration within the chroot jail.&lt;br /&gt;
&lt;br /&gt;
===ForceCommand===&lt;br /&gt;
The ForceCommand option allows you to specify a command that will be executed when a user logs in via SSH, regardless of the command requested by the user. This can be useful for limiting the actions a user can perform or for automatically running specific tasks upon login.&lt;br /&gt;
&lt;br /&gt;
To use the ForceCommand option, follow these steps:&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ForceCommand for a specific user or group. For example, to force user1 to execute the command /usr/bin/my-command upon login:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ForceCommand /usr/bin/my-command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, the /usr/bin/my-command will be executed automatically, and they will not be able to run any other command.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that using ForceCommand may limit the user&#039;s ability to interact with the server or transfer files via SFTP. Make sure to test and verify the functionality for your specific use case.&lt;br /&gt;
&lt;br /&gt;
=== Match Blocks===&lt;br /&gt;
&lt;br /&gt;
Match blocks in the sshd_config file allow you to apply specific configuration options based on certain criteria, such as the user, group, address, or host. This enables you to create custom rules and settings for different users, groups, or connections.&lt;br /&gt;
&lt;br /&gt;
Match block syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match criteria&lt;br /&gt;
  Option value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are some examples of Match blocks and their usage:&lt;br /&gt;
&lt;br /&gt;
Apply settings only for a specific user:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
  AllowTcpForwarding yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication and enables TCP forwarding only for user1.&lt;br /&gt;
&lt;br /&gt;
Apply settings for multiple users:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1,user2&lt;br /&gt;
  ChrootDirectory /home/%u/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration sets the chroot directory for both user1 and user2.&lt;br /&gt;
&lt;br /&gt;
Apply settings for a specific group:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Group group1&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration enables password authentication only for members of group1.&lt;br /&gt;
&lt;br /&gt;
Apply settings based on the client&#039;s IP address:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication for clients connecting from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Combine multiple criteria:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1 Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This configuration enables password authentication only for user1 when they connect from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Remember to restart the SSH server after making changes to the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match blocks offer flexibility in customizing your SSH server&#039;s configuration based on various criteria. Use them wisely to enhance security and optimize your server&#039;s settings.&lt;br /&gt;
&lt;br /&gt;
==Best Practices and Tips &#039;&#039;&#039;sshd_config&#039;&#039;&#039;==&lt;br /&gt;
When configuring your &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file, it&#039;s essential to follow best practices to ensure the security and stability of your SSH server. Here are some recommendations and tips:&lt;br /&gt;
&lt;br /&gt;
:*   Keep the server up-to-date: Always update your SSH server software and the underlying operating system to ensure you have the latest security patches and features.&lt;br /&gt;
&lt;br /&gt;
:*    Use strong authentication: Enable key-based authentication (PubkeyAuthentication) and consider disabling password authentication (PasswordAuthentication) to reduce the risk of brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
:*    Limit root access: Set &amp;quot;PermitRootLogin&amp;quot; to &amp;quot;no&amp;quot; or &amp;quot;without-password&amp;quot; to prevent direct root login or require key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
:*    Use non-standard ports: Change the default SSH port (22) to a non-standard port to reduce the exposure to automated scans and attacks. Keep in mind this is security through obscurity and should be combined with other security measures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Restrict user access&#039;&#039;&#039;: Use &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; and &amp;quot;DenyGroups&amp;quot; options to control which users and groups can access the SSH server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Monitor logs&#039;&#039;&#039;: Regularly check your SSH server logs for any suspicious activity or failed login attempts. Adjust the &amp;quot;LogLevel&amp;quot; setting in sshd_config as needed.&lt;br /&gt;
* Default Log Path Ubuntu 22.04: &#039;&#039;&#039;/var/log/auth.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use chroot jails&#039;&#039;&#039;: Isolate users by creating chroot jails using the &amp;quot;ChrootDirectory&amp;quot; option, especially when providing SFTP access or when users don&#039;t require full access to the server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configure connection settings&#039;&#039;&#039;: Set appropriate values for &amp;quot;LoginGraceTime&amp;quot; and &amp;quot;MaxAuthTries&amp;quot; to limit the time allowed for successful login and the number of authentication attempts per connection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use a strong firewall&#039;&#039;&#039;: Configure your server&#039;s firewall to only allow SSH connections from trusted IP addresses or networks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Regularly review and audit&#039;&#039;&#039;: Periodically review your sshd_config settings and make adjustments as necessary. Keep up-to-date with SSH security best practices and recommendations.&lt;br /&gt;
&lt;br /&gt;
By following these best practices and tips, you can enhance the security and performance of your SSH server, protecting it from unauthorized access and potential attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting sshd_config Issues===&lt;br /&gt;
&lt;br /&gt;
When encountering problems with your SSH server configuration, it&#039;s important to know how to diagnose and resolve issues. Here are some common problems and troubleshooting steps:&lt;br /&gt;
&lt;br /&gt;
Check syntax and configuration errors: If the SSH server is not starting or not functioning as expected, check the sshd_config file for any syntax or configuration errors. Use the following command to test the configuration file for errors:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sshd -t&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are any issues, the command will provide error messages with information on what needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
Review log files: Inspect the SSH server log files for any error messages or relevant information. The location of the log files may vary depending on your system, but common locations are /var/log/auth.log or /var/log/secure. Tail the log file while attempting to connect to get real-time information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo tail -f /var/log/auth.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server&lt;br /&gt;
&lt;br /&gt;
Check firewall settings: Ensure that the server&#039;s firewall is allowing SSH connections on the correct port. If you changed the default SSH port, update your firewall rules accordingly.&lt;br /&gt;
&lt;br /&gt;
Verify user permissions: If a specific user is unable to connect, check the user&#039;s permissions, home directory, and the settings in the sshd_config file, such as &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; or &amp;quot;DenyGroups.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SSH server from a client, use the verbose mode to get more detailed information about the connection process. This can help identify any issues with authentication or configuration. Run the following command to enable verbose mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -v user@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user@example.com&amp;quot; with the appropriate username and server address. You can increase the verbosity level by adding more &amp;quot;v&amp;quot; characters (e.g., -vv or -vvv) if needed.&lt;br /&gt;
&lt;br /&gt;
Check file permissions: Ensure that the file permissions for the user&#039;s home directory, the .ssh directory, and the authorized_keys file are set correctly. The user&#039;s home directory should not be writable by other users, the .ssh directory should have permissions set to 700 (drwx------), and the authorized_keys file should have permissions set to 600 (-rw-------).&lt;br /&gt;
&lt;br /&gt;
Test network connectivity: If you&#039;re unable to connect to the SSH server, verify that you can reach the server on the network. Use tools like ping, traceroute, or telnet to check the connection to the server and the specific SSH port.&lt;br /&gt;
&lt;br /&gt;
By following these troubleshooting steps, you should be able to diagnose and resolve most issues related to the sshd_config file and the SSH server configuration. Remember to carefully review the settings in your sshd_config file and consult the server logs for additional information when encountering problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====After making changes, restart the SSH server:====&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running commands on a remote server==&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve connected to a remote server using SSH, you can execute commands on the remote machine just as you would on your local system. However, you can also run commands on a remote server without establishing an interactive SSH session. &lt;br /&gt;
&lt;br /&gt;
This can be useful for automation, scripting, or quick tasks. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
Use the SSH command: To run a command on a remote server without entering an interactive session, use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP -p port &#039;command&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, port with the SSH port number (if different from the default 22), and command with the command you want to execute.&lt;br /&gt;
&lt;br /&gt;
For example, to list the contents of the remote server&#039;s home directory, you can use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 22 &#039;ls -la&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Handling multiple commands===&lt;br /&gt;
If you need to execute multiple commands, you can chain them together using a &#039;&#039;&#039;semicolon&#039;&#039;&#039; or &#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The semicolon allows you to run multiple commands sequentially, while the &amp;amp;&amp;amp; operator runs the next command only if the previous command was successful.&lt;br /&gt;
&lt;br /&gt;
For example, to update the package list and then upgrade the packages on a remote Ubuntu server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 2222 &#039;sudo apt-get update; sudo apt-get upgrade -y&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Command output:&lt;br /&gt;
The output of the command will be displayed in your local terminal, just as if you were running the command on your local machine. Using key-based authentication&lt;br /&gt;
&lt;br /&gt;
==Transferring files with SCP==&lt;br /&gt;
&lt;br /&gt;
The Secure Copy Protocol (SCP) is a useful tool for transferring files between your local machine and a remote server using SSH. SCP ensures that the data is encrypted during transit, providing a secure and efficient way to transfer files.&lt;br /&gt;
&lt;br /&gt;
===Install an SCP client=== &lt;br /&gt;
&lt;br /&gt;
Most Unix-based systems, including Linux and macOS, have an SCP client pre-installed. For Windows, you can use the built-in SCP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from your local machine to a remote server===&lt;br /&gt;
&lt;br /&gt;
To copy a file from your local machine to a remote server, use the following command:&lt;br /&gt;
* Note the use of the upper case &#039;&#039;&#039;-P&#039;&#039;&#039; for ports with &#039;&#039;&#039;scp&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port local_file_path username@hostname_or_IP:remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), local_file_path with the path to the file on your local machine, username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, and remote_file_path with the desired location on the remote server.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 22 /home/john/documents/report.pdf john@example.com:/home/john/reports/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the local machine to the &amp;quot;reports&amp;quot; directory on the remote server.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from a remote server to your local machine===&lt;br /&gt;
To copy a file from a remote server to your local machine, use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port username@hostname_or_IP:remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, remote_file_path with the path to the file on the remote server, and local_file_path with the desired location on your local machine.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 2222 john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
: Or&lt;br /&gt;
&amp;lt;code&amp;gt;scp john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;-&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the remote server&#039;s &amp;quot;reports&amp;quot; directory to the &amp;quot;documents&amp;quot; directory on your local machine.&lt;br /&gt;
&lt;br /&gt;
===Transferring directories=== &lt;br /&gt;
&lt;br /&gt;
To transfer an entire directory, use the &#039;&#039;&#039;-r&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port local_directory_path username@hostname_or_IP:remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, to copy a directory from the remote server to your local machine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port username@hostname_or_IP:remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using SCP is a convenient and secure way to transfer files between your local machine and a remote server. It leverages the security of the SSH protocol to ensure that your data remains encrypted during transit.&lt;br /&gt;
&lt;br /&gt;
===Transferring from Remote Computer to Remote Computer===&lt;br /&gt;
&lt;br /&gt;
Copy the file &#039;&#039;&#039;stuff.txt&#039;&#039;&#039; from remote host &#039;&#039;&#039;12.34.56.67&#039;&#039;&#039; to host &#039;&#039;&#039;11.22.33.44&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.67:/home/user/Documents/stuff.txt name@11.22.33.44:/home/user/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;&#039;-3&#039;&#039;&#039; flag copies between two remote hosts &amp;quot;12.34.56.67&amp;quot; and &amp;quot;11.22.33.44&amp;quot; are transferred through the local host running the command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -3 name@12.34.56.67:/home/user/Documents/stuff.txt \ name@11.22.33.44:/home/user/Documents/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Transferring multiple files===&lt;br /&gt;
&lt;br /&gt;
Send files foo.txt and bar.txt to remote.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp foo.txt bar.txt user@12.34.56.78:~/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from remote &amp;quot;Documents&amp;quot; directory to local &amp;quot;Documents&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp user@11.22.33.44:/home/user/Documents/\{todo_list.txt,links.txt,stuff.txt\} /home/$USER/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from the remote to local current directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.78:~/\{README.md,.bashrc\} . &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Transferring files with SFTP==&lt;br /&gt;
The SSH File Transfer Protocol (SFTP) is another method for transferring files securely between your local machine and a remote server. Unlike SCP, SFTP provides an interactive interface that allows you to navigate, upload, and download files more easily.&lt;br /&gt;
&lt;br /&gt;
Install an SFTP client: Most Unix-based systems, including Linux and macOS, have an SFTP client pre-installed. For Windows, you can use the built-in SFTP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Connect to a remote server: To start an SFTP session with a remote server, open a terminal or command prompt on your local machine and use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P 22 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Navigate the remote filesystem: Once connected, you can use commands similar to those available in a Unix shell to navigate the remote server&#039;s filesystem. Some common SFTP commands include:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;ls&#039;&#039;&#039;: List files and directories&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;cd&#039;&#039;&#039;: Change the current directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;mkdir&#039;&#039;&#039;: Create a new directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rmdir&#039;&#039;&#039;: Remove an empty directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;get&#039;&#039;&#039;: Download a file from the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;put&#039;&#039;&#039;: Upload a file to the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rm&#039;&#039;&#039;: Remove a file&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rename&#039;&#039;&#039;: Rename a file or directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;exit&#039;&#039;&#039;: Exit the SFTP session&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transfer files: To transfer files, use the put command to upload a file from your local machine to the remote server, and the get command to download a file from the remote server to your local machine. For example:&lt;br /&gt;
&lt;br /&gt;
Upload a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put local_file_path remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_file_path and remote_file_path with the appropriate paths for the files you want to transfer.&lt;br /&gt;
&lt;br /&gt;
Transferring directories: To transfer entire directories, use the -r flag with the put and get commands:&lt;br /&gt;
&lt;br /&gt;
Upload a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put -r local_directory_path remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get -r remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disconnect from the remote server: When you&#039;ve finished transferring files, type exit to close the SFTP session.&lt;br /&gt;
&lt;br /&gt;
SFTP offers a more user-friendly, interactive experience for transferring files compared to SCP. By utilizing the secure and encrypted SSH protocol, SFTP ensures that your data remains safe during transfer.&lt;br /&gt;
&lt;br /&gt;
==Advanced SSH Techniques==&lt;br /&gt;
=== Port forwarding and tunneling===&lt;br /&gt;
&lt;br /&gt;
SSH port forwarding and tunneling allow you to securely forward network traffic between your local machine and a remote server. This can be useful for accessing remote services, bypassing firewalls, or securely transmitting sensitive data.&lt;br /&gt;
&lt;br /&gt;
Local Port Forwarding: Local port forwarding creates a secure tunnel between your local machine and a remote server, allowing you to access remote services as if they were running on your local machine. To set up local port forwarding, use the -L flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -L local_port:remote_host:remote_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_port with an available port on your local machine, remote_host with the hostname or IP address of the remote server hosting the service, remote_port with the port number of the remote service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
Remote Port Forwarding: Remote port forwarding enables you to expose a local service running on your machine to a remote network. To set up remote port forwarding, use the -R flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -R remote_port:local_host:local_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace remote_port with an available port on the remote server, local_host with the hostname or IP address of the local machine hosting the service, local_port with the port number of the local service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:**Forwarding X, Sound, and Video on Ubuntu 22.04 with Ubuntu 22.04 LXC**: To forward X, sound, and video from a remote Ubuntu 22.04 server to your local Ubuntu 22.04 machine, you&#039;ll need to enable X11 forwarding and install the necessary packages.&lt;br /&gt;
&lt;br /&gt;
:*    Install required packages: On both your local machine and the remote server, install the x11-apps and pulseaudio packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt update&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install x11-apps pulseaudio&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Enable X11 forwarding: To enable X11 forwarding, you&#039;ll need to edit the SSH server configuration file (/etc/ssh/sshd_config) on the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line containing &amp;quot;X11Forwarding&amp;quot; and set its value to &amp;quot;yes&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;X11Forwarding yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol. Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Connect with X11 forwarding: From your local machine, use the -X flag to enable X11 forwarding when connecting to the remote server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -X username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Export PULSE_SERVER environment variable: On the remote server, export the PULSE_SERVER environment variable to forward sound:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;export PULSE_SERVER=tcp:localhost&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add this line to the remote user&#039;s ~/.bashrc or ~/.profile file to make the change permanent.&lt;br /&gt;
&lt;br /&gt;
:*    Run applications: Now, you can run graphical applications on the remote server, and they will be displayed on your local machine with sound and video forwarded.&lt;br /&gt;
&lt;br /&gt;
Please note that forwarding X, sound, and video might cause increased latency and reduced performance compared to running the applications locally.&lt;br /&gt;
&lt;br /&gt;
=== SSH agent forwarding===&lt;br /&gt;
SSH agent forwarding is a powerful feature that allows you to use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers. This is particularly useful when you need to access one remote server (Server B) through another remote server (Server A).&lt;br /&gt;
&lt;br /&gt;
====    Start the SSH agent on your local machine ====&lt;br /&gt;
&lt;br /&gt;
Before you enable SSH agent forwarding, you need to start the SSH agent on your local machine. Open a terminal and run the following command:&lt;br /&gt;
&lt;br /&gt;
:* For Linux and macOS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Windows (Git Bash or Cygwin):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval $(ssh-agent)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command starts the SSH agent and sets the required environment variables.&lt;br /&gt;
&lt;br /&gt;
====Add your SSH key to the agent====&lt;br /&gt;
&lt;br /&gt;
Next, add your private key to the SSH agent with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-add ~/.ssh/your_private_key&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_private_key&#039;&#039;&#039; with the filename of your private key. This might be &#039;&#039;&#039;id_rsa&#039;&#039;&#039;, &#039;&#039;&#039;id_ed25519&#039;&#039;&#039;, or another key file depending on your setup.&lt;br /&gt;
&lt;br /&gt;
====Configure SSH agent forwarding on your local machine====&lt;br /&gt;
&lt;br /&gt;
Edit your SSH config file to enable agent forwarding. The config file is usually located at &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;. If the file doesn&#039;t exist, create it.&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the config file: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server_a_alias&lt;br /&gt;
  HostName server_a_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_a&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host server_b_alias&lt;br /&gt;
  HostName server_b_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_b&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &lt;br /&gt;
:* &#039;&#039;&#039;server_a_alias&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039; server_a_ip_or_hostname&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_a&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;server_b_alias&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;server_b_ip_or_hostname&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_b&#039;&#039;&#039; &lt;br /&gt;
with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Make sure your public key is added to the remote servers====&lt;br /&gt;
&lt;br /&gt;
Before you can use SSH agent forwarding, you need to add your public key to the &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; file on both Server A and Server B. If you haven&#039;t done this already, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/your_public_key user@server_ip_or_hostname&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_public_key&#039;&#039;&#039;, &#039;&#039;&#039;user&#039;&#039;&#039;, and &#039;&#039;&#039;server_ip_or_hostname&#039;&#039;&#039; with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Test SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
First, SSH into Server A:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_a_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from Server A, SSH into Server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_b_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything is set up correctly, you should be able to access Server B without being prompted for a password.&lt;br /&gt;
&lt;br /&gt;
====Verify SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
To make sure that SSH agent forwarding is working, you can check the value of the &#039;&#039;&#039;SSH_AUTH_SOCK&#039;&#039;&#039; environment variable on Server B.&lt;br /&gt;
&lt;br /&gt;
From Server B, run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;echo $SSH_AUTH_SOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If SSH agent forwarding is working, this command should return a non-empty value.&lt;br /&gt;
&lt;br /&gt;
That&#039;s it! You&#039;ve successfully set up and tested SSH agent forwarding. Now you can use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Command Restriction===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file can be used to restrict the commands that a specific SSH key can execute. This is especially useful for security purposes, to limit the potential damage that could be done if a key is compromised.&lt;br /&gt;
&lt;br /&gt;
By including a &#039;&#039;&#039;command=&#039;&#039;&#039; directive in the &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file, you can specify the exact command that will be run when a client connects using the associated key. Any command provided by the client will be ignored, and the command specified in the authorized_keys file will be used instead.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is set up to always execute the &#039;&#039;&#039;scp&#039;&#039;&#039; command (used for secure copy of files over SSH) to the specified directory, no matter what command was originally issued by the client. This is a good way to create a &amp;quot;write-only&amp;quot; drop box, for instance.&lt;br /&gt;
&lt;br /&gt;
However, the keyholder could potentially still execute arbitrary commands by carefully crafting the file names they upload, so additional precautions should be taken, such as using command= along with other directives like &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039;, &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039;, and &#039;&#039;&#039;no-pty&#039;&#039;&#039; to further limit what can be done with the key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;,no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This entry does the following:&lt;br /&gt;
&lt;br /&gt;
:*    The &#039;&#039;&#039;command=&#039;&#039;&#039; directive runs the specified command when a client connects using this key. In this case, the command is scp, which securely copies files to the /home/rscp/media/ directory.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039; directive prevents the client from using SSH&#039;s port forwarding features, which could potentially be used to create a secure tunnel for other network traffic.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039; directive prevents the client from forwarding X11 graphical sessions, which could be used to run graphical applications over the SSH connection.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-pty&#039;&#039;&#039; directive prevents the allocation of a pseudo-terminal, which means the client can&#039;t interact with a shell or run interactive commands.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039; part is the public key of the client. Replace this with the actual key.&lt;br /&gt;
&lt;br /&gt;
This configuration significantly limits the operations that can be performed with this key, providing an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
====SCP Only====&lt;br /&gt;
&lt;br /&gt;
Use Case Example: Have a Server hosting XML Dumps, and want to automate sending a file or directory from Server1 to Server2 using a script and ssh-key so i don&#039;t need to enter password. &lt;br /&gt;
&lt;br /&gt;
=====Create Account on Server=====&lt;br /&gt;
Create user account you are going to use:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;adduser rscp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure user has a &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory to send public key to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make a Directory to transfer files to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If you see error &amp;lt;code&amp;gt;scp: /home/rscp/media/test.txt: Permission denied&amp;lt;/code&amp;gt; If you created directory &#039;&#039;&#039;media&#039;&#039;&#039; when logged in as &#039;&#039;&#039;root&#039;&#039;&#039; then check directory permissions and if need [[Linux_Users_and_Groups#File_Ownership_and_Permissions|assign ownership to &#039;&#039;&#039;user&#039;&#039;&#039; account.]]&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;code&amp;gt;chown rscp:rscp /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Ubuntu_22.04_SSH_Guide#Copying_public_keys_to_the_remote_server|Send your public key to server]]&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If from remote server you are sending a Directory include the &#039;&#039;&#039;-r&#039;&#039;&#039; flag in command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t -r /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This entry in the authorized_keys file uses the command option to restrict the SSH command that can be run with the associated SSH key. The command option specifies that the scp command should be used to transfer files to the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory on the server.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the entry:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;command=&amp;quot;/usr/bin/scp -t /home/rscp/&amp;quot;&#039;&#039;&#039;: This specifies that the scp command should be used as the SSH command for this key, with the &#039;&#039;&#039;-t&#039;&#039;&#039; option to specify that the remote end is a file (in this case, a directory), and the destination directory on the server is /home/rscp/. This means that the user can only use the SSH key to transfer files to the /home/rscp/ directory on the server.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039;: This is the public key associated with the private key that is used for authentication.&lt;br /&gt;
&lt;br /&gt;
By using the command option in this way, you can restrict the actions that the user can perform with the SSH key, which can help to improve security. In this case, the user can only transfer files to the specified directory on the server using the scp command.&lt;br /&gt;
&lt;br /&gt;
======Tip - transfer file to a path your USER does not have permissions for======&lt;br /&gt;
&lt;br /&gt;
You can write a shell script to check the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory every minute using a while loop and the sleep command. If any files are found in the directory, the script can move them to the &#039;&#039;&#039;/var/www/media&#039;&#039;&#039; directory using the mv command. Here&#039;s an example script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
  if [ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]; then&lt;br /&gt;
    mv /home/rscp/media/* /var/www/media/&lt;br /&gt;
  fi&lt;br /&gt;
  sleep 60&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this script, the while loop runs indefinitely (&#039;&#039;&#039;while true&#039;&#039;&#039;) and sleeps for 60 seconds at the end of each iteration (&#039;&#039;&#039;sleep 60&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;if&#039;&#039;&#039; statement checks if the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory is not empty (&#039;&#039;&#039;[ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]&#039;&#039;&#039;). If it is not empty, the &#039;&#039;&#039;mv&#039;&#039;&#039; command is used to move all files and directories from the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory to the &#039;&#039;&#039;/var/www/media/&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Save this script to a file (e.g. &#039;&#039;&#039;move-files.sh&#039;&#039;&#039;) and make it executable using the &#039;&#039;&#039;chmod +x move-files.sh&#039;&#039;&#039; command. You can then run the script using &#039;&#039;&#039;./move-files.sh &amp;amp;&#039;&#039;&#039; to start it in the background and allow it to run indefinitely. The &amp;amp; symbol is used to run the script in the background so that you can continue using the terminal.&lt;br /&gt;
&lt;br /&gt;
Note that running this script indefinitely can consume system resources, so you may want to consider setting up a scheduled task (e.g. using &#039;&#039;&#039;[[Cron_ubuntu_22.04|cron]]&#039;&#039;&#039;) to run the script at a specific interval instead of running it indefinitely.&lt;br /&gt;
&lt;br /&gt;
==Tilde &#039;&#039;&#039;~&#039;&#039;&#039; the escape character==&lt;br /&gt;
&lt;br /&gt;
The tilde (~) character has a special meaning in the context of SSH. When using SSH, you can use the tilde character followed by a control sequence to perform certain actions. These are called &amp;quot;tilde escape sequences&amp;quot; or &amp;quot;tilde commands.&amp;quot; They are useful for managing your SSH connections.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to use tilde escape sequences when connected to a remote server via SSH:&lt;br /&gt;
&lt;br /&gt;
:*    Make sure you are at the beginning of a new line in your terminal. Press &#039;&#039;&#039;Enter&#039;&#039;&#039; if you are not.&lt;br /&gt;
&lt;br /&gt;
:*    Type the tilde (~) character, followed by the appropriate control sequence. Note that you should not press &#039;&#039;&#039;Enter&#039;&#039;&#039; after typing the tilde character, but rather type the control sequence directly after it.&lt;br /&gt;
&lt;br /&gt;
Here are some common tilde escape sequences:&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;~.&#039;&#039;&#039; : Close the SSH connection. This can be helpful if the connection is frozen or unresponsive.&lt;br /&gt;
:    &#039;&#039;&#039;~^Z&#039;&#039;&#039; : Suspend the SSH connection and return to your local shell. You can later resume the connection using the fg command.&lt;br /&gt;
:    &#039;&#039;&#039;~#&#039;&#039;&#039; : List all forwarded connections (both local and remote) that are active in the current SSH session.&lt;br /&gt;
:    &#039;&#039;&#039;~&amp;amp;&#039;&#039;&#039; : Run the SSH session in the background. This is useful if you want to perform other tasks on your local machine without closing the SSH connection.&lt;br /&gt;
:    &#039;&#039;&#039;~~&#039;&#039;&#039; : Send a literal tilde character to the remote system. This is useful if you need to type a tilde character in the remote system without triggering an escape sequence.&lt;br /&gt;
&lt;br /&gt;
Remember that these escape sequences only work if they are entered at the beginning of a new line in your terminal. If you&#039;re typing them in the middle of a command or text, they won&#039;t be recognized as special control sequences.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting and Best Practices==&lt;br /&gt;
&lt;br /&gt;
In this section, we&#039;ll cover some common issues and best practices related to SSH connections, including managing a large number of SSH keys.&lt;br /&gt;
&lt;br /&gt;
===Too many authentication attempts===&lt;br /&gt;
&lt;br /&gt;
When connecting to an SSH server, you might encounter the &amp;quot;Too many authentication attempts&amp;quot; error. This is often caused by having too many private keys in your ~/.ssh directory. By default, SSH tries each key until it finds the correct one, but many servers limit the number of authentication attempts.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;: To resolve this issue, you can create a separate directory for your keys and configure the SSH config file to use the appropriate key for each connection.&lt;br /&gt;
&lt;br /&gt;
:*    Create a new directory for your keys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir ~/.ssh/keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Move your private key files to the new directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv ~/.ssh/id_rsa_* ~/.ssh/keys/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update your SSH config file to specify the correct key for each connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Host server1&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server1&lt;br /&gt;
&lt;br /&gt;
    Host server2&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permission issues=== &lt;br /&gt;
&lt;br /&gt;
SSH is very strict about file and directory permissions. Ensure that your ~/.ssh directory and its contents have the correct permissions:&lt;br /&gt;
&lt;br /&gt;
:*    The ~/.ssh directory should have permissions set to 700:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 700 ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private key files should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/id_rsa&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ~/.ssh/config file should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &amp;lt;b&amp;gt;Best practices&amp;lt;/b&amp;gt;: Follow these best practices to maintain secure and efficient SSH connections:&lt;br /&gt;
&lt;br /&gt;
:*    Use SSH key pairs instead of passwords for authentication, as they provide better security.&lt;br /&gt;
:*    Regularly update your SSH keys to maintain their security.&lt;br /&gt;
:*    Use strong, unique passphrases to protect your private keys.&lt;br /&gt;
:*    Disable password authentication and root login on your SSH server to reduce the risk of brute-force attacks.&lt;br /&gt;
:*    Regularly update your SSH server software to ensure you&#039;re running the latest security patches.&lt;br /&gt;
:*    Use non-standard port numbers for your SSH server to make it less likely to be targeted by automated attacks.&lt;br /&gt;
:*    Implement multi-factor authentication (MFA) for your SSH connections, if possible.&lt;br /&gt;
:*    Regularly review and remove any unnecessary authorized keys from the ~/.ssh/authorized_keys file on your servers.&lt;br /&gt;
:*    Use the Match directive in the sshd_config file to apply custom rules and settings for different users, groups, or connections.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Man_Pages&amp;diff=436</id>
		<title>Ubuntu 22.04 Man Pages</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Man_Pages&amp;diff=436"/>
		<updated>2023-05-16T12:01:09Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;Man pages, short for manual pages, are the standard form of documentation on a Unix-like system like Ubuntu 22.04. They provide detailed information about commands, system calls, library routines, and other components of the system. Man pages serve as a comprehensive reference, explaining the function of these components, their syntax, options, return values, and more.  ==Accessing Man Pages==  To access a man page for a specific command or program, use the man command f...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Man pages, short for manual pages, are the standard form of documentation on a Unix-like system like Ubuntu 22.04. They provide detailed information about commands, system calls, library routines, and other components of the system. Man pages serve as a comprehensive reference, explaining the function of these components, their syntax, options, return values, and more.&lt;br /&gt;
&lt;br /&gt;
==Accessing Man Pages==&lt;br /&gt;
&lt;br /&gt;
To access a man page for a specific command or program, use the man command followed by the name of the command or program. For example, to view the man page for the ls command, you would type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man ls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will bring up the man page for ls, which you can scroll through using the arrow keys. To exit, press &#039;&#039;&#039;q&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Sections of Man Pages===&lt;br /&gt;
&lt;br /&gt;
In Ubuntu 20.04 and other Linux distributions, man pages are typically stored in several directories under /usr/share/man. These directories are organized by sections, which are represented by numbers. The sections are as follows:&lt;br /&gt;
&lt;br /&gt;
:* 1 &#039;&#039;&#039;User commands&#039;&#039;&#039; (Executable programs or shell commands)&lt;br /&gt;
:* 2 &#039;&#039;&#039;System calls&#039;&#039;&#039; (Functions provided by the kernel)&lt;br /&gt;
:* 3 &#039;&#039;&#039;Library calls&#039;&#039;&#039; (Functions within program libraries)&lt;br /&gt;
:* 4 &#039;&#039;&#039;Special files&#039;&#039;&#039; (Files found in /dev)&lt;br /&gt;
:* 5 &#039;&#039;&#039;File formats and conventions&#039;&#039;&#039;&lt;br /&gt;
:* 6 &#039;&#039;&#039;Games&#039;&#039;&#039;&lt;br /&gt;
:* 7 &#039;&#039;&#039;Miscellaneous&#039;&#039;&#039; (including macro packages and conventions)&lt;br /&gt;
:* 8 &#039;&#039;&#039;System administration commands&#039;&#039;&#039; (usually only for root)&lt;br /&gt;
:* 9 &#039;&#039;&#039;Kernel routines&#039;&#039;&#039; (Non-standard)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To access a man page in a specific section, you can specify the section number before the topic. For example, to access the system call read, you would type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man 2 read&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Searching Man Pages===&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not sure what command or program you&#039;re looking for, you can search the man pages using the &#039;&#039;&#039;apropos&#039;&#039;&#039; command followed by a keyword. For example, to find commands related to &amp;quot;copy&amp;quot;, you would type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apropos copy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return a list of man pages related to the keyword &amp;quot;copy&amp;quot;.&lt;br /&gt;
Conclusion&lt;br /&gt;
&lt;br /&gt;
Man pages are a vital resource for users and administrators of Ubuntu 22.04, providing in-depth information on how to use and understand the system&#039;s various components. Understanding how to read and navigate man pages can greatly enhance your proficiency with the system.&lt;br /&gt;
&lt;br /&gt;
Please note that man pages can sometimes be quite technical and may not be the easiest resource for beginners. Other resources, such as online tutorials, guides, and community forums, can often provide more accessible explanations and examples.&lt;br /&gt;
&lt;br /&gt;
==Find the License of Man Pages==&lt;br /&gt;
&lt;br /&gt;
The man pages in Ubuntu also use a variety of licenses, depending on the specific software and authors&#039; preferences. As mentioned in my previous response, common licenses used for man pages in Ubuntu distributions include the GNU General Public License (GPL), GNU Lesser General Public License (LGPL), BSD License, MIT License, and Apache License.&lt;br /&gt;
&lt;br /&gt;
To find the specific license for a particular man page in Ubuntu 20.04, you can look at the copyright information typically found at the bottom of the man page or consult the package documentation. Additionally, you can check the &#039;&#039;&#039;/usr/share/doc/&amp;lt;package_name&amp;gt;/copyright&#039;&#039;&#039;  file, where &#039;&#039;&#039;&amp;lt;package_name&amp;gt;&#039;&#039;&#039; is the name of the package you are interested in.&lt;br /&gt;
&lt;br /&gt;
Please note that some man pages may use other licenses or have custom licensing terms specified by the authors. Always refer to the documentation and copyright information for the specific man page or software package to determine its licensing terms.&lt;br /&gt;
&lt;br /&gt;
===find the location of a specific man page===&lt;br /&gt;
&lt;br /&gt;
To find the location of a specific man page, you can use the &#039;&#039;&#039;manpath&#039;&#039;&#039; command to display the search path for man pages, and the &#039;&#039;&#039;man -w &amp;lt;command&amp;gt;&#039;&#039;&#039; command to find the location of a specific man page. Replace &#039;&#039;&#039;&amp;lt;command&amp;gt;&#039;&#039;&#039; with the command or topic you are looking for. For example:&lt;br /&gt;
&lt;br /&gt;
:* The &#039;&#039;&#039;manpath&#039;&#039;&#039; command will show the directories where man pages are stored&lt;br /&gt;
&amp;lt;code&amp;gt;manpath&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* The &#039;&#039;&#039;man -w &amp;lt;package&amp;gt;&#039;&#039;&#039; command will display the location of the &#039;&#039;&#039;&amp;lt;package&amp;gt;&#039;&#039;&#039; command&#039;s man page. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
:&amp;lt;code&amp;gt;man -w ls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will display the location of the &#039;&#039;&#039;ls&#039;&#039;&#039; command&#039;s man page. The output will show the full path to the man page file, such as &#039;&#039;&#039;/usr/share/man/man1/ls.1.gz&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please note that man pages are usually compressed using gzip, so the file extensions will often be .gz. To read the man page, use the man command, as it automatically decompresses the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man ls&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The License of the &#039;&#039;&#039;ls&#039;&#039;&#039; man page is &#039;&#039;&#039;GPLv3+&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
The &amp;quot;GPL-3+&amp;quot; means that the man page is licensed under the GNU General Public License version 3 or any later version.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
COPYRIGHT&lt;br /&gt;
       Copyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3 or later &amp;lt;https://gnu.org/licenses/gpl.html&amp;gt;.&lt;br /&gt;
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example of finding the license of the &#039;&#039;&#039;mc&#039;&#039;&#039; man page==&lt;br /&gt;
&lt;br /&gt;
: The &#039;&#039;&#039;mc&#039;&#039;&#039; &amp;quot;&#039;&#039;midnight commander&#039;&#039;&amp;quot; package is not installed on ubuntu by default:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install mc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
: Check the &#039;&#039;&#039;man mc&#039;&#039;&#039; page for license of the &#039;&#039;&#039;man&#039;&#039;&#039; for &#039;&#039;&#039;mc&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;man mc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LICENSE&lt;br /&gt;
       This program is distributed under the terms of the GNU General Public License as published by the Free Software Foundation. See the built-in help for details on the License and the  lack  of&lt;br /&gt;
       warranty.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The easiest way to find the license of a man page is to look for the license or copyright information within the man page itself, as you&#039;ve done with the &#039;mc&#039; man page. In some cases, the man page may not include the license information, and you will need to look for the copyright information in the package documentation instead.&lt;br /&gt;
&lt;br /&gt;
To find the package documentation, you can check the &#039;&#039;&#039;/usr/share/doc/&amp;lt;package_name&amp;gt;/copyright&#039;&#039;&#039; file, where &#039;&#039;&#039;&amp;lt;package_name&amp;gt;&#039;&#039;&#039; is the name of the package you are interested in. For the &#039;mc&#039; package, you can find the copyright file using the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cat /usr/share/doc/mc/copyright&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display the copyright and license information for the &#039;mc&#039; package, which should also cover the associated man page.&lt;br /&gt;
&lt;br /&gt;
In the case of the &#039;mc&#039; man page, the license information is already provided in the man page itself, stating that the program is distributed under the terms of the GNU General Public License.&lt;br /&gt;
&lt;br /&gt;
===OutPut from &amp;lt;code&amp;gt;cat /usr/share/doc/mc/copyright&amp;lt;/code&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/&lt;br /&gt;
Upstream-Name: Midnight Commander&lt;br /&gt;
Source: http://www.midnight-commander.org/downloads&lt;br /&gt;
Copyright: 1996-2021 Free Software Foundation&lt;br /&gt;
License: GPL-3+&lt;br /&gt;
Comment:&lt;br /&gt;
 This package was debianized on Tue Apr 1 14:32:15 1997 by&lt;br /&gt;
 Paul Seelig &amp;lt;pseelig@mail.uni-mainz.de&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Files: *&lt;br /&gt;
Copyright: 1991-1992,1994-2021 Free Software Foundation&lt;br /&gt;
    1996      andrey joukov &amp;lt;2:5020/337.13@fidonet.org&amp;gt;&lt;br /&gt;
    2002      ARJ Software Russia&lt;br /&gt;
    2003      Alexander Serkov &amp;lt;serkov@ukrpost.net&amp;gt;&lt;br /&gt;
    1992-1998 Andrew Tridgell&lt;br /&gt;
    1995      Ian Jackson &amp;lt;iwj10@cus.cam.ac.uk&amp;gt;&lt;br /&gt;
    2008      Jacques Pelletier &amp;lt;jpelletier@ieee.org&amp;gt;&lt;br /&gt;
    1996-1997 Joseph M. Hinkle &amp;lt;jhinkle@rockisland.com&amp;gt;&lt;br /&gt;
    1998      John H Terpstra &amp;lt;jht@aquasoft.com.au&amp;gt;&lt;br /&gt;
    1990-1998 Karl Auer&lt;br /&gt;
    2005-2006 Leonard den Ottolander &amp;lt;leonard den ottolander nl&amp;gt;&lt;br /&gt;
    1996-1998 Luke Kenneth Casson Leighton&lt;br /&gt;
    1995-1996 Miguel de Icaza&lt;br /&gt;
    2000-2001 Oskar Liljeblad &amp;lt;osk@hem.passagen.se&amp;gt;&lt;br /&gt;
    1996      Paul Sheer&lt;br /&gt;
    2003      Pavel Roskin&lt;br /&gt;
    2002      Petr Kozelka &amp;lt;pkozelka@email.cz&amp;gt;&lt;br /&gt;
    1999      Piotr Roszatycki &amp;lt;dexter@debian.org&amp;gt;&lt;br /&gt;
    1995-1998 Samba-Team&lt;br /&gt;
    2001      Walery Studennikov &amp;lt;despair@sama.ru&amp;gt;&lt;br /&gt;
    1997-1998 the University of Minnesota&lt;br /&gt;
License: GPL-3+&lt;br /&gt;
Comment:&lt;br /&gt;
 See list of authors and contributors in file AUTHORS&lt;br /&gt;
 Note that all these authors assigned the copyright to FSF.&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
    doc/doxygen-include.am&lt;br /&gt;
    m4.include/dx_doxygen.m4&lt;br /&gt;
Copyright:&lt;br /&gt;
    2004,2007 Oren Ben-Kiki&lt;br /&gt;
License: Apache-2.0&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
    misc/syntax/nemerle.syntax&lt;br /&gt;
Copyright:&lt;br /&gt;
    2004      the University of Wroclaw&lt;br /&gt;
License: BSD-3-Clause&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
    misc/syntax/meson.syntax&lt;br /&gt;
Copyright:&lt;br /&gt;
    2018 Vitold S&lt;br /&gt;
License: Expat&lt;br /&gt;
&lt;br /&gt;
Files: debian/*&lt;br /&gt;
Copyright:&lt;br /&gt;
    2002-2004  Adam Byrtek &amp;lt;alpha@debian.org&amp;gt;&lt;br /&gt;
    2011       Andreas Tille &amp;lt;tille@debian.org&amp;gt;&lt;br /&gt;
    2002       Colin Watson &amp;lt;cjwatson@debian.org&amp;gt;&lt;br /&gt;
    2008-2015  Denis Briand &amp;lt;debian@denis-briand.fr&amp;gt;&lt;br /&gt;
    2012-2021  Dmitry Smirnov &amp;lt;onlyjob@debian.org&amp;gt;&lt;br /&gt;
    1997       Fernando Alegre &amp;lt;alegre@debian.org&amp;gt;&lt;br /&gt;
    2004-2007  Ludovic Drolez &amp;lt;ldrolez@debian.org&amp;gt;&lt;br /&gt;
    1999-2001  Martin Bialasinski &amp;lt;martinb@debian.org&amp;gt;&lt;br /&gt;
    1999       Martin Bialasinski &amp;lt;mc@internet-treff.uni-koeln.de&amp;gt;&lt;br /&gt;
    1998-1999  Michael Bramer &amp;lt;grisu@debian.org&amp;gt;&lt;br /&gt;
    2008-2009  Patrick Winnertz &amp;lt;winnie@debian.org&amp;gt;&lt;br /&gt;
    1998       Paul Seelig &amp;lt;pseelig@goofy.zdv.uni-mainz.de&amp;gt;&lt;br /&gt;
    2004-2007  Stefano Melchior &amp;lt;stefano.melchior@openlabs.it&amp;gt;&lt;br /&gt;
    1997       Vincent Renardias &amp;lt;vincent@waw.com&amp;gt;&lt;br /&gt;
    2008-2010  Yury V. Zaytsev &amp;lt;yury@shurup.com&amp;gt;&lt;br /&gt;
License: GPL-2+&lt;br /&gt;
&lt;br /&gt;
Files: src/vfs/smbfs/helpers/*&lt;br /&gt;
Copyright: 2011       Free Software Foundation&lt;br /&gt;
           1992-1998  Andrew Tridgell&lt;br /&gt;
           1995-1998  Samba-Team&lt;br /&gt;
           1998       John H Terpstra &amp;lt;jht@aquasoft.com.au&amp;gt;&lt;br /&gt;
License: GPL-3+&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
    m4.include/gnulib/fsusage.m4&lt;br /&gt;
    m4.include/gnulib/sys_types_h.m4&lt;br /&gt;
    m4.include/gnulib/windows-stat-inodes.m4&lt;br /&gt;
Copyright: 1997-2018 Free Software Foundation, Inc.&lt;br /&gt;
License: FSFULLR&lt;br /&gt;
 This file is free software; the Free Software Foundation&lt;br /&gt;
 gives unlimited permission to copy and/or distribute it,&lt;br /&gt;
 with or without modifications, as long as this notice is preserved.&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
    m4.include/ax_gcc_func_attribute.m4&lt;br /&gt;
Copyright: 2013 Gabriele Svelto &amp;lt;gabriele.svelto@gmail.com&amp;gt;&lt;br /&gt;
License: FSF-Install&lt;br /&gt;
 Copying and distribution of this file, with or without modification, are&lt;br /&gt;
 permitted in any medium without royalty provided the copyright notice and&lt;br /&gt;
 this notice are preserved. This file is offered as-is, without any&lt;br /&gt;
 warranty.&lt;br /&gt;
&lt;br /&gt;
License: Apache-2.0&lt;br /&gt;
 Licensed to the Apache Software Foundation (ASF) under one or more&lt;br /&gt;
 contributor license agreements.  See the NOTICE file distributed with&lt;br /&gt;
 this work for additional information regarding copyright ownership.&lt;br /&gt;
 The ASF licenses this file to You under the Apache License, Version 2.0&lt;br /&gt;
 (the &amp;quot;License&amp;quot;); you may not use this file except in compliance with&lt;br /&gt;
 the License.  You may obtain a copy of the License at&lt;br /&gt;
 .&lt;br /&gt;
 http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 .&lt;br /&gt;
 Unless required by applicable law or agreed to in writing, software&lt;br /&gt;
 distributed under the License is distributed on an &amp;quot;AS IS&amp;quot; BASIS,&lt;br /&gt;
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;br /&gt;
 See the License for the specific language governing permissions and&lt;br /&gt;
 limitations under the License.&lt;br /&gt;
 ․&lt;br /&gt;
 On Debian systems, the complete text of the Apache License,&lt;br /&gt;
 Version 2.0 can be found in &amp;quot;/usr/share/common-licenses/Apache-2.0&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
License: BSD-3-Clause&lt;br /&gt;
 Redistribution and use in source and binary forms, with or without&lt;br /&gt;
 modification, are permitted provided that the following conditions&lt;br /&gt;
 are met:&lt;br /&gt;
    1. Redistributions of source code must retain the above copyright&lt;br /&gt;
       notice, this list of conditions and the following disclaimer.&lt;br /&gt;
    2. Redistributions in binary form must reproduce the above copyright&lt;br /&gt;
       notice, this list of conditions and the following disclaimer in the&lt;br /&gt;
       documentation and/or other materials provided with the distribution.&lt;br /&gt;
    3. The name of the University may not be used to endorse or promote&lt;br /&gt;
       products derived from this software without specific prior&lt;br /&gt;
       written permission.&lt;br /&gt;
 .&lt;br /&gt;
 THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY ``AS IS&#039;&#039; AND ANY EXPRESS OR&lt;br /&gt;
 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES&lt;br /&gt;
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN&lt;br /&gt;
 NO EVENT SHALL THE UNIVERSITY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,&lt;br /&gt;
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED&lt;br /&gt;
 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR&lt;br /&gt;
 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF&lt;br /&gt;
 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING&lt;br /&gt;
 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS&lt;br /&gt;
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
&lt;br /&gt;
License: Expat&lt;br /&gt;
 Permission is hereby granted, free of charge, to any person obtaining a copy&lt;br /&gt;
 of this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal&lt;br /&gt;
 in the Software without restriction, including without limitation the rights&lt;br /&gt;
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell&lt;br /&gt;
 copies of the Software, and to permit persons to whom the Software is&lt;br /&gt;
 furnished to do so, subject to the following conditions:&lt;br /&gt;
 ․&lt;br /&gt;
  The above copyright notice and this permission notice shall be included in all&lt;br /&gt;
  copies or substantial portions of the Software.&lt;br /&gt;
 ․&lt;br /&gt;
 THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
 SOFTWARE.&lt;br /&gt;
&lt;br /&gt;
License: GPL-2+&lt;br /&gt;
 This program is free software; you can redistribute it and/or modify&lt;br /&gt;
 it under the terms of the GNU General Public License as published by&lt;br /&gt;
 the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
 (at your option) any later version.&lt;br /&gt;
 ․&lt;br /&gt;
 This program is distributed in the hope that it will be useful,&lt;br /&gt;
 but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 GNU General Public License for more details.&lt;br /&gt;
 ․&lt;br /&gt;
 On Debian systems, the complete text of the GNU General Public&lt;br /&gt;
 License Version 2 can be found in &amp;quot;/usr/share/common-licenses/GPL-2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
License: GPL-3+&lt;br /&gt;
 This program is free software: you can redistribute it and/or modify&lt;br /&gt;
 it under the terms of the GNU General Public License as published by&lt;br /&gt;
 the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
 (at your option) any later version.&lt;br /&gt;
 ․&lt;br /&gt;
 This program is distributed in the hope that it will be useful,&lt;br /&gt;
 but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
 GNU General Public License for more details.&lt;br /&gt;
 ․&lt;br /&gt;
 On Debian systems, the complete text of the GNU General Public&lt;br /&gt;
 License Version 3 can be found in &amp;quot;/usr/share/common-licenses/GPL-3&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on the information from the &#039;&#039;&#039;/usr/share/doc/mc/copyright&#039;&#039;&#039; file, the license for the Midnight Commander man page would be &#039;&#039;&#039;&amp;quot;GPL-3+&amp;quot;&#039;&#039;&#039;, as indicated in the following section of the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Files: *&lt;br /&gt;
Copyright: 1991-1992,1994-2021 Free Software Foundation&lt;br /&gt;
...&lt;br /&gt;
License: GPL-3+&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;GPL-3+&amp;quot; means that the man page is licensed under the GNU General Public License version 3 or any later version.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Export a &#039;man&#039; page==&lt;br /&gt;
&lt;br /&gt;
To export a man page in a readable format for copy and paste, you can use the man command with the &#039;&#039;&#039;-P&#039;&#039;&#039; flag to output the content to a specific pager, such as cat. &lt;br /&gt;
&lt;br /&gt;
To export a man page in a readable format for copy and paste, you can use the man command with the -P flag to output the content to a specific pager, such as cat. Alternatively, you can use man with the col command to remove any formatting characters.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-P&#039;&#039;&#039; flag in the man command allows you to specify a pager to view the manual page. A pager is a program that helps you read and navigate through text, such as less (default pager), more, or cat. To use the man command with the &#039;&#039;&#039;-P&#039;&#039;&#039; flag, follow this syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man -P &amp;lt;pager&amp;gt; &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;&amp;lt;pager&amp;gt;&#039;&#039;&#039; with the pager you want to use (e.g., cat, less, more) and &#039;&#039;&#039;&amp;lt;command&amp;gt;&#039;&#039;&#039; with the command you want to view the manual page for.&lt;br /&gt;
&lt;br /&gt;
For example, if you want to view the ssh man page using the cat pager:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man -P cat ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will output the ssh man page without any pagination, making it easy to copy and paste the content. Keep in mind that using cat as the pager will output the entire man page at once, which might be overwhelming for very long pages. To navigate through the content, you may want to use less or more instead.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatively&#039;&#039;&#039;, you can use man with the &#039;&#039;&#039;col&#039;&#039;&#039; command to remove any formatting characters.&lt;br /&gt;
&lt;br /&gt;
For example, to view the ssh man page in a plain text format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man ssh | col -bx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to save the output to a file for easy copy and paste, you can redirect the output to a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;man ssh | col -bx &amp;gt; ssh_man_page.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can open the &#039;&#039;&#039;ssh_man_page.txt&#039;&#039;&#039; file with a text editor.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Yacy&amp;diff=435</id>
		<title>Ubuntu 22.04 Yacy</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Yacy&amp;diff=435"/>
		<updated>2023-05-16T11:44:06Z</updated>

		<summary type="html">&lt;p&gt;Noob: Noob moved page Yacy to Ubuntu 22.04 Yacy without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Installing Yacy on Ubuntu 22.04 Vultr VPS Server==&lt;br /&gt;
* Spin up ubuntu 22.04 2 vCPUs  4096.00 MB RAM  80 GB SSD Storage&lt;br /&gt;
* login&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apt-get update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt-get install openjdk-8-jre-headless nginx -y&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -pv /opt/yacy&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Find Latest version https://download.yacy.net/&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://download.yacy.net/yacy_v1.924_20210209_10069.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar xvf yacy_v1.924_20210209_10069.tar.gz -C /opt/yacy/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;bash /opt/yacy/yacy/startYACY.sh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;bash /opt/yacy/yacy/bin/passwd.sh $PASSWORD&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 80/tcp&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 443/tcp&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 8090/tcp&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/nginx/sites-available/default&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
##&lt;br /&gt;
# You should look at the following URL&#039;s in order to grasp a solid understanding&lt;br /&gt;
# of Nginx configuration files in order to fully unleash the power of Nginx.&lt;br /&gt;
# https://www.nginx.com/resources/wiki/start/&lt;br /&gt;
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/&lt;br /&gt;
# https://wiki.debian.org/Nginx/DirectoryStructure&lt;br /&gt;
#&lt;br /&gt;
# In most cases, administrators will remove this file from sites-enabled/ and&lt;br /&gt;
# leave it as reference inside of sites-available where it will continue to be&lt;br /&gt;
# updated by the nginx packaging team.&lt;br /&gt;
#&lt;br /&gt;
# This file will automatically load configuration files provided by other&lt;br /&gt;
# applications, such as Drupal or Wordpress. These applications will be made&lt;br /&gt;
# available underneath a path with that package name, such as /drupal8.&lt;br /&gt;
#&lt;br /&gt;
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.&lt;br /&gt;
##&lt;br /&gt;
&lt;br /&gt;
# Default server configuration&lt;br /&gt;
#&lt;br /&gt;
server {&lt;br /&gt;
	listen 80 default_server;&lt;br /&gt;
	listen [::]:80 default_server;&lt;br /&gt;
&lt;br /&gt;
	# SSL configuration&lt;br /&gt;
	#&lt;br /&gt;
	# listen 443 ssl default_server;&lt;br /&gt;
	# listen [::]:443 ssl default_server;&lt;br /&gt;
	#&lt;br /&gt;
	# Note: You should disable gzip for SSL traffic.&lt;br /&gt;
	# See: https://bugs.debian.org/773332&lt;br /&gt;
	#&lt;br /&gt;
	# Read up on ssl_ciphers to ensure a secure configuration.&lt;br /&gt;
	# See: https://bugs.debian.org/765782&lt;br /&gt;
	#&lt;br /&gt;
	# Self signed certs generated by the ssl-cert package&lt;br /&gt;
	# Don&#039;t use them in a production server!&lt;br /&gt;
	#&lt;br /&gt;
	# include snippets/snakeoil.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	# Add index.php to the list if you are using PHP&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
&lt;br /&gt;
	server_name _;&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		# First attempt to serve request as file, then&lt;br /&gt;
		# as directory, then fall back to displaying a 404.&lt;br /&gt;
		#try_files $uri $uri/ =404;&lt;br /&gt;
		proxy_pass http://127.0.0.1:8090;&lt;br /&gt;
		proxy_redirect off;&lt;br /&gt;
  		proxy_set_header   Host             $host;&lt;br /&gt;
 		proxy_set_header   X-Real-IP        $remote_addr;&lt;br /&gt;
  		proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;&lt;br /&gt;
  		client_max_body_size       10m;&lt;br /&gt;
  		client_body_buffer_size    128k;&lt;br /&gt;
  		proxy_connect_timeout      3s;&lt;br /&gt;
  		proxy_send_timeout         10s;&lt;br /&gt;
  		proxy_read_timeout         10s;&lt;br /&gt;
  		proxy_buffer_size          4k;&lt;br /&gt;
  		proxy_buffers              4 32k;&lt;br /&gt;
  		proxy_busy_buffers_size    64k;&lt;br /&gt;
  		proxy_temp_file_write_size 64k;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	# pass PHP scripts to FastCGI server&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ \.php$ {&lt;br /&gt;
	#	include snippets/fastcgi-php.conf;&lt;br /&gt;
	#&lt;br /&gt;
	#	# With php-fpm (or other unix sockets):&lt;br /&gt;
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;&lt;br /&gt;
	#	# With php-cgi (or other tcp sockets):&lt;br /&gt;
	#	fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
	# deny access to .htaccess files, if Apache&#039;s document root&lt;br /&gt;
	# concurs with nginx&#039;s one&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ /\.ht {&lt;br /&gt;
	#	deny all;&lt;br /&gt;
	#}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Virtual Host configuration for example.com&lt;br /&gt;
#&lt;br /&gt;
# You can move that to a different file under sites-available/ and symlink that&lt;br /&gt;
# to sites-enabled/ to enable it.&lt;br /&gt;
#&lt;br /&gt;
#server {&lt;br /&gt;
#	listen 80;&lt;br /&gt;
#	listen [::]:80;&lt;br /&gt;
#&lt;br /&gt;
#	server_name example.com;&lt;br /&gt;
#&lt;br /&gt;
#	root /var/www/example.com;&lt;br /&gt;
#	index index.html;&lt;br /&gt;
#&lt;br /&gt;
#	location / {&lt;br /&gt;
#		try_files $uri $uri/ =404;&lt;br /&gt;
#	}&lt;br /&gt;
#}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Domain and https&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;snap install certbot --classic&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After DNS points to server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;certbot --nginx -d yacy.completenoobs.com&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Now can visit https://yacy.completenoobs.com and site working :)&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===systemd===&lt;br /&gt;
Will start YACY at when server reboots.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/systemd/system/yacy.service&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description =Start yacy&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=forking&lt;br /&gt;
ExecStartPre=/bin/sleep 15&lt;br /&gt;
ExecStart=/opt/yacy/yacy/startYACY.sh&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl enable yacy&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_Square_root&amp;diff=434</id>
		<title>DICTIONARY Square root</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_Square_root&amp;diff=434"/>
		<updated>2023-05-16T11:42:47Z</updated>

		<summary type="html">&lt;p&gt;Noob: Noob moved page Square root to DICTIONARY Square root without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The square root of a number is a value that, when multiplied by itself, gives the original number. In mathematical terms, the square root of a number x is denoted as √x or x^(1/2). For example, the square root of 9 is 3 because 3 * 3 = 9.&lt;br /&gt;
&lt;br /&gt;
In this tutorial, we will cover the concept of square roots, different methods to find the square root of a number, examples, and exam-style questions with answers.&lt;br /&gt;
Methods to Find the Square Root&lt;br /&gt;
&lt;br /&gt;
==1. Prime Factorization==&lt;br /&gt;
&lt;br /&gt;
To find the square root of a number using prime factorization, follow these steps:&lt;br /&gt;
&lt;br /&gt;
:*    Find the prime factors of the given number.&lt;br /&gt;
:*    Pair the prime factors in groups of two identical factors.&lt;br /&gt;
:*    Multiply one factor from each pair to find the square root.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Find the square root of 36.&lt;br /&gt;
&lt;br /&gt;
:*    Prime factors of 36: 2 * 2 * 3 * 3&lt;br /&gt;
:*    Pair the prime factors: (2 * 2) * (3 * 3)&lt;br /&gt;
:*    Multiply one factor from each pair: 2 * 3 = 6&lt;br /&gt;
&lt;br /&gt;
So, the square root of 36 is 6.&lt;br /&gt;
&lt;br /&gt;
==2. Long Division Method==&lt;br /&gt;
&lt;br /&gt;
The long division method is a technique used to find the square root of a number with decimal places.&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Find the square root of 50.&lt;br /&gt;
&lt;br /&gt;
:*    Pair the digits from the right: (50)&lt;br /&gt;
:*    Find the largest number whose square is less than or equal to 50: 7 (7 * 7 = 49)&lt;br /&gt;
:*    Subtract the result from 50: 50 - 49 = 1&lt;br /&gt;
:*    Bring down the next pair of digits (if any) and repeat the process.&lt;br /&gt;
&lt;br /&gt;
So, the square root of 50 is approximately 7.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Finding the square root of 50 using the long division method:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:* Step 1: Write the number 50 and separate the digits into pairs starting from the right. Since there are no decimal places, we only have one pair (50).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
50&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 2: Find the largest number whose square is less than or equal to the first pair (50). In this case, the largest number is 7, as 7 * 7 = 49, which is less than or equal to 50. Write 7 above the pair and write 49 below the pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  7&lt;br /&gt;
-------&lt;br /&gt;
| 50&lt;br /&gt;
  49&lt;br /&gt;
-------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Step 3: Subtract 49 from 50 and write the remainder below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  7&lt;br /&gt;
-------&lt;br /&gt;
| 50&lt;br /&gt;
  49&lt;br /&gt;
-------&lt;br /&gt;
   1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Step 4: Since there are no more digits to bring down, we can proceed to calculate the decimal places. Add a decimal point to the quotient (7), and add a pair of zeros to the remainder. Bring down the pair of zeros.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  7.&lt;br /&gt;
-------&lt;br /&gt;
| 50.00&lt;br /&gt;
  49&lt;br /&gt;
-------&lt;br /&gt;
   1 00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Step 5: Double the quotient (7) and write it to the left of the remainder. Treat this doubled value as a single entity (in this case, 14). Find a digit (x) that, when combined with the doubled value (14), creates a number (14x) that can be multiplied by x to get a product less than or equal to the remainder (100). In this case, x = 1, as 141 * 1 = 141, which is less than or equal to 100. Write the 1 in the quotient after the decimal point and write 141 below the 100.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  7.1&lt;br /&gt;
-------&lt;br /&gt;
| 50.00&lt;br /&gt;
  49&lt;br /&gt;
-------&lt;br /&gt;
   1 00&lt;br /&gt;
    141&lt;br /&gt;
-------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Step 6: Subtract 141 from 100 and write the remainder below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  7.1&lt;br /&gt;
-------&lt;br /&gt;
| 50.00&lt;br /&gt;
  49&lt;br /&gt;
-------&lt;br /&gt;
   1 00&lt;br /&gt;
    141&lt;br /&gt;
-------&lt;br /&gt;
     59&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Step 7: Bring down the next pair of zeros (if necessary) and continue the process to find more decimal places. In this example, we will stop at one decimal place.&lt;br /&gt;
&lt;br /&gt;
So, the square root of 50 is approximately 7.1 using the long division method. You can continue this process to find more decimal places if needed.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Finding the square root of 33 using the long division method:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:* Step 1: Write the number 33 and separate the digits into pairs starting from the right. Since there are no decimal places, we only have one pair (33).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
33&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 2: Find the largest number whose square is less than or equal to the first pair (33). In this case, the largest number is 5, as 5 * 5 = 25, which is less than or equal to 33. Write 5 above the pair and write 25 below the pair.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5&lt;br /&gt;
-------&lt;br /&gt;
| 33&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 3: Subtract 25 from 33 and write the remainder below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5&lt;br /&gt;
-------&lt;br /&gt;
| 33&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 4: Since there are no more digits to bring down, we can proceed to calculate the decimal places. Add a decimal point to the quotient (5), and add a pair of zeros to the remainder. Bring down the pair of zeros.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 5: Double the quotient (5) and write it to the left of the remainder. Treat this doubled value as a single entity (in this case, 10). Find a digit (x) that, when combined with the doubled value (10), creates a number (10x) that can be multiplied by x to get a product less than or equal to the remainder (800). In this case, x = 7, as 107 * 7 = 749, which is less than or equal to 800. Write the 7 in the quotient after the decimal point and write 749 below the 800.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.7&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 6: Subtract 749 from 800 and write the remainder below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.7&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 7: Bring down the next pair of zeros and continue the process to find more decimal places. In this example, we will find 2 more decimal places.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.7&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51 00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 8: Double the quotient without the decimal (57) and write it to the left of the remainder. Treat this doubled value as a single entity (in this case, 114). Find a digit (x) that, when combined with the doubled value (114), creates a number (114x) that can be multiplied by x to get a product less than or equal to the remainder (5100). In this case, x = 4, as 1144 * 4 = 4576, which is less than or equal to 5100. Write the 4 in the quotient after the 7 and write 4576 below the 5100.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.74&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51 00&lt;br /&gt;
        4576&lt;br /&gt;
-------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* 9: Subtract 4576 from 5100 and write the remainder below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.74&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51 00&lt;br /&gt;
        4576&lt;br /&gt;
-------&lt;br /&gt;
         524&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 10: Bring down the next pair of zeros and continue the process to find more decimal places. In this example, we will find 1 more decimal place.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.74&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51 00&lt;br /&gt;
        4576&lt;br /&gt;
-------&lt;br /&gt;
         524 00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 11: Double the quotient without the decimal (574) and write it to the left of the remainder. Treat this doubled value as a single entity (in this case, 1148). Find a digit (x) that, when combined with the doubled value (1148), creates a number (1148x) that can be multiplied by x to get a product less than or equal to the remainder (52400). In this case, x = 4, as 11484 * 4 = 45936, which is less than or equal to 52400. Write the 4 in the quotient after the second 4 and write 45936 below the 52400.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.744&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51 00&lt;br /&gt;
        4576&lt;br /&gt;
-------&lt;br /&gt;
         524 00&lt;br /&gt;
           45936&lt;br /&gt;
-------&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:* Step 12: Subtract 45936 from 52400 and write the remainder below.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  5.744&lt;br /&gt;
-------&lt;br /&gt;
| 33.00&lt;br /&gt;
  25&lt;br /&gt;
-------&lt;br /&gt;
   8 00&lt;br /&gt;
     749&lt;br /&gt;
-------&lt;br /&gt;
      51 00&lt;br /&gt;
        4576&lt;br /&gt;
-------&lt;br /&gt;
         524 00&lt;br /&gt;
           45936&lt;br /&gt;
-------&lt;br /&gt;
            6464&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we have calculated the square root of 33 with three decimal places (5.744).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=MAN_Ubuntu_22.04_ssh&amp;diff=433</id>
		<title>MAN Ubuntu 22.04 ssh</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=MAN_Ubuntu_22.04_ssh&amp;diff=433"/>
		<updated>2023-05-16T11:39:20Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot; {{:LICENCE_HEADER_BSD3}}   The following content is pulled in from the &amp;#039;&amp;#039;&amp;#039;man ssh&amp;#039;&amp;#039;&amp;#039; in ubuntu 22.04, we believe it is under the BSD-3 License, if we are wrong, please correct us.   ==SSH(1)== BSD General Commands Manual                                                                               SSH(1)  ===NAME=== :     ssh — OpenSSH remote login client  ===SYNOPSIS=== :     &amp;#039;&amp;#039;&amp;#039;ssh&amp;#039;&amp;#039;&amp;#039; [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec]...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; {{:LICENCE_HEADER_BSD3}} &lt;br /&gt;
&lt;br /&gt;
The following content is pulled in from the &#039;&#039;&#039;man ssh&#039;&#039;&#039; in ubuntu 22.04, we believe it is under the BSD-3 License, if we are wrong, please correct us.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==SSH(1)==&lt;br /&gt;
BSD General Commands Manual                                                                               SSH(1)&lt;br /&gt;
&lt;br /&gt;
===NAME===&lt;br /&gt;
:     ssh — OpenSSH remote login client&lt;br /&gt;
&lt;br /&gt;
===SYNOPSIS===&lt;br /&gt;
:     &#039;&#039;&#039;ssh&#039;&#039;&#039; [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file]&lt;br /&gt;
         [-J destination] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]&lt;br /&gt;
         destination [command [argument ...]]&lt;br /&gt;
&lt;br /&gt;
===DESCRIPTION===&lt;br /&gt;
:     ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine.  It is intended to provide secure encrypted communications between two untrusted hosts over an insecure network.  X11 connections, arbitrary TCP ports and UNIX-domain sockets can also be forwarded over the secure channel.&lt;br /&gt;
&lt;br /&gt;
:     ssh connects and logs into the specified destination, which may be specified as either [user@]hostname or a URI of the form ssh://[user@]hostname[:port].  The user must prove their identity to the remote machine using one of several methods (see below).&lt;br /&gt;
&lt;br /&gt;
:     If a command is specified, it will be executed on the remote host instead of a login shell.  A complete command line may be specified as command, or it may have additional arguments.  If supplied, the arguments will be appended to the command, separated by spaces, before it is sent to the server to be executed.&lt;br /&gt;
&lt;br /&gt;
===Options===&lt;br /&gt;
&lt;br /&gt;
The options are as follows:&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-4&#039;&#039;&#039;      Forces ssh to use IPv4 addresses only.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-6&#039;&#039;&#039;      Forces ssh to use IPv6 addresses only.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-A&#039;&#039;&#039;      Enables forwarding of connections from an authentication agent such as ssh-agent(1).  This can also be specified on a per-host basis in a configuration file.&lt;br /&gt;
&lt;br /&gt;
:             Agent forwarding should be enabled with caution.  Users with the ability to bypass file permissions on the remote host (for the agent&#039;s UNIX-domain socket) can access the local agent through the forwarded connection.  An attacker cannot obtain key material from the agent, however they can perform operations on the keys that enable them to authenticate using the identities loaded into the agent.  A safer alternative may be to use a jump host (see -J).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-a&#039;&#039;&#039;      Disables forwarding of the authentication agent connection.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-B bind_interface&#039;&#039;&#039;&lt;br /&gt;
:             Bind to the address of bind_interface before attempting to connect to the destination host.  This is only useful on systems with more than one address.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-b bind_address&#039;&#039;&#039;&lt;br /&gt;
:             Use bind_address on the local machine as the source address of the connection.  Only useful on systems with more than one address.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-C&#039;&#039;&#039;      Requests compression of all data (including stdin, stdout, stderr, and data for forwarded X11, TCP and UNIX-domain connections).  The compression algorithm is the same used by gzip(1).&lt;br /&gt;
:             Compression is desirable on modem lines and other slow connections, but will only slow down things on fast networks.  The default value can be set on a host-by-host basis in the configuration files; see the Compression option.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-c cipher_spec&#039;&#039;&#039;&lt;br /&gt;
:             Selects the cipher specification for encrypting the session.  cipher_spec is a comma-separated list of ciphers listed in order of preference.  See the Ciphers keyword in ssh_config(5)for more information.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-D [bind_address:]port&#039;&#039;&#039;&lt;br /&gt;
:             Specifies a local “dynamic” application-level port forwarding.  This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address.&lt;br /&gt;
:             Whenever a connection is made to this port, the connection is forwarded over the secure channel, and the application protocol is then used to determine where to connect to from the remote machine.  Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.  Only root can forward privileged ports.  Dynamic port forwardings can also be specified in the configuration file.&lt;br /&gt;
&lt;br /&gt;
:          IPv6 addresses can be specified by enclosing the address in square brackets.  Only the superuser can forward privileged ports.  By default, the local port is bound in accordance with the GatewayPorts setting.  However, an explicit bind_address may be used to bind the connection to a specific address.  The bind_address of “localhost” indicates that the listening port be bound for local use only, while an empty address or ‘*’ indicates that the port should be available from all interfaces.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-E log_file&#039;&#039;&#039;&lt;br /&gt;
:             Append debug logs to log_file instead of standard error.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-e escape_char&#039;&#039;&#039;&lt;br /&gt;
:             Sets the escape character for sessions with a pty (default: ‘~’).  The escape character is only recognized at the beginning of a line.  The escape character followed by a dot (‘.’) closes the connection; followed by control-Z suspends the connection; and followed by itself sends the escape character once.  Setting the character to “none” disables any escapes and makes the session fully transparent.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-F configfile&#039;&#039;&#039;&lt;br /&gt;
:             Specifies an alternative per-user configuration file.  If a configuration file is given on the command line, the system-wide configuration file (/etc/ssh/ssh_config) will be ignored.&lt;br /&gt;
:             The default for the per-user configuration file is &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;.  If set to “none”, no configuration files will be read.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-f&#039;&#039;&#039;      Requests ssh to go to background just before command execution.  This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background.  This implies &#039;&#039;&#039;-n&#039;&#039;&#039;.  The recommended way to start X11 programs at a remote site is with something like &#039;&#039;&#039;ssh -f host xterm&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:             If the ExitOnForwardFailure configuration option is set to “yes”, then a client started with -f will wait for all remote port forwards to be successfully established before placing it self in the background.  Refer to the description of forkAfterAuthentication in ssh_config(5) for details.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-G&#039;&#039;&#039;      Causes ssh to print its configuration after evaluating Host and Match blocks and exit.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-g&#039;&#039;&#039;      Allows remote hosts to connect to local forwarded ports.  If used on a multiplexed connection, then this option must be specified on the master process.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-I pkcs11&#039;&#039;&#039;&lt;br /&gt;
:             Specify the PKCS#11 shared library ssh should use to communicate with a PKCS#11 token providing keys for user authentication.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-i identity_file&#039;&#039;&#039;&lt;br /&gt;
:             Selects a file from which the identity (private key) for public key authentication is read.  You can also specify a public key file to use the corresponding private key that is loaded in ssh-agent(1) when the private key file is not present locally.  The default is ~/.ssh/id_rsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ecdsa_sk, ~/.ssh/id_ed25519, ~/.ssh/id_ed25519_sk and ~/.ssh/id_dsa.  Identity files may also be specified on a per-host basis in the configuration file.  It is possible to have multiple -i options (and multiple identities specified in configuration files).  If no certificates have been explicitly specified by the CertificateFile directive, ssh will also try to load certificate information from the filename obtained by appending -cert.pub to identity filenames.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-J destination&#039;&#039;&#039;&lt;br /&gt;
:             Connect to the target host by first making a ssh connection to the jump host described by destination and then establishing a TCP forwarding to the ultimate destination from there.&lt;br /&gt;
:             Multiple jump hops may be specified separated by comma characters.  This is a shortcut to specify a ProxyJump configuration directive.  Note that configuration directives supplied on the command-line generally apply to the destination host and not any specified jump hosts.  Use ~/.ssh/config to specify configuration for jump hosts.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-K&#039;&#039;&#039;      Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI credentials to the server.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-k&#039;&#039;&#039;      Disables forwarding (delegation) of GSSAPI credentials to the server.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-L [bind_address:]port:host:hostport&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-L [bind_address:]port:remote_socket&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-L local_socket:host:hostport&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-L local_socket:remote_socket&#039;&#039;&#039;&lt;br /&gt;
:             Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side.  This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a Unix socket.  Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to either host port hostport, or the Unix socket remote_socket, from the remote machine.&lt;br /&gt;
&lt;br /&gt;
:             Port forwardings can also be specified in the configuration file.  Only the superuser can forward privileged ports.  IPv6 addresses can be specified by enclosing the address in square brackets.&lt;br /&gt;
&lt;br /&gt;
:             By default, the local port is bound in accordance with the GatewayPorts setting.  However, an explicit bind_address may be used to bind the connection to a specific address.  The bind_address of “localhost” indicates that the listening port be bound for local use only, while an empty address or ‘*’ indicates that the port should be available from all interfaces.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-l login_name&#039;&#039;&#039;&lt;br /&gt;
:             Specifies the user to log in as on the remote machine.  This also may be specified on a per-host basis in the configuration file.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-M&#039;&#039;&#039;      Places the ssh client into “master” mode for connection sharing.  Multiple -M options places ssh into “master” mode but with confirmation required using ssh-askpass(1) before each operation that changes the multiplexing state (e.g. opening a new session).  Refer to the description of ControlMaster in ssh_config(5) for details.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-m mac_spec&#039;&#039;&#039;&lt;br /&gt;
:             A comma-separated list of MAC (message authentication code) algorithms, specified in order of preference.  See the MACs keyword for more information.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-N&#039;&#039;&#039;      Do not execute a remote command.  This is useful for just forwarding ports.  Refer to the description of SessionType in ssh_config(5) for details.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-n&#039;&#039;&#039;      Redirects stdin from /dev/null (actually, prevents reading from stdin).  This must be used when ssh is run in the background.  A common trick is to use this to run X11 programs on a remote machine.  For example, ssh -n shadows.cs.hut.fi emacs &amp;amp; will start an emacs on shadows.cs.hut.fi, and the X11 connection will be automatically forwarded over an encrypted channel.  The ssh program will be put in the background.  (This does not work if ssh needs to ask for a password or passphrase; see also the -f option.)  Refer to the description of StdinNull in ssh_config(5) for details.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-O ctl_cmd&#039;&#039;&#039;&lt;br /&gt;
:             Control an active connection multiplexing master process.  When the -O option is specified, the ctl_cmd argument is interpreted and passed to the master process.  Valid commands are:&lt;br /&gt;
:* “check” (check that the master process is running)&lt;br /&gt;
:* “forward” (request forwardings without command execution)&lt;br /&gt;
:* “cancel” (cancel forwardings), “exit” (request the master to exit)&lt;br /&gt;
:* “stop” (request the master to stop accepting further multiplexing requests).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-o option&#039;&#039;&#039;&lt;br /&gt;
:             Can be used to give options in the format used in the configuration file.  This is useful for specifying options for which there is no separate command-line flag.  For full details of the options listed below, and their possible values, see ssh_config(5).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                   AddKeysToAgent&lt;br /&gt;
                   AddressFamily&lt;br /&gt;
                   BatchMode&lt;br /&gt;
                   BindAddress&lt;br /&gt;
                   CanonicalDomains&lt;br /&gt;
                   CanonicalizeFallbackLocal&lt;br /&gt;
                   CanonicalizeHostname&lt;br /&gt;
                   CanonicalizeMaxDots&lt;br /&gt;
                   CanonicalizePermittedCNAMEs&lt;br /&gt;
                   CASignatureAlgorithms&lt;br /&gt;
                   CertificateFile&lt;br /&gt;
                   CheckHostIP&lt;br /&gt;
                   Ciphers&lt;br /&gt;
                   ClearAllForwardings&lt;br /&gt;
                   Compression&lt;br /&gt;
                   ConnectionAttempts&lt;br /&gt;
                   ConnectTimeout&lt;br /&gt;
                   ControlMaster&lt;br /&gt;
                   ControlPath&lt;br /&gt;
                   ControlPersist&lt;br /&gt;
                   DynamicForward&lt;br /&gt;
                   EscapeChar&lt;br /&gt;
                   ExitOnForwardFailure&lt;br /&gt;
                   FingerprintHash&lt;br /&gt;
                   ForkAfterAuthentication&lt;br /&gt;
                   ForwardAgent&lt;br /&gt;
                   ForwardX11&lt;br /&gt;
                   ForwardX11Timeout&lt;br /&gt;
                   ForwardX11Trusted&lt;br /&gt;
                   GatewayPorts&lt;br /&gt;
                   GlobalKnownHostsFile&lt;br /&gt;
                   GSSAPIAuthentication&lt;br /&gt;
                   GSSAPIKeyExchange&lt;br /&gt;
                   GSSAPIClientIdentity&lt;br /&gt;
                   GSSAPIDelegateCredentials&lt;br /&gt;
                   GSSAPIKexAlgorithms&lt;br /&gt;
                   GSSAPIRenewalForcesRekey&lt;br /&gt;
                   GSSAPIServerIdentity&lt;br /&gt;
                   GSSAPITrustDns&lt;br /&gt;
                   HashKnownHosts&lt;br /&gt;
                   Host&lt;br /&gt;
                   HostbasedAcceptedAlgorithms&lt;br /&gt;
                   HostbasedAuthentication&lt;br /&gt;
                   HostKeyAlgorithms&lt;br /&gt;
                   HostKeyAlias&lt;br /&gt;
                   Hostname&lt;br /&gt;
                   IdentitiesOnly&lt;br /&gt;
                   IdentityAgent&lt;br /&gt;
                   IdentityFile&lt;br /&gt;
                   IPQoS&lt;br /&gt;
                   KbdInteractiveAuthentication&lt;br /&gt;
                   KbdInteractiveDevices&lt;br /&gt;
                   KexAlgorithms&lt;br /&gt;
                   KnownHostsCommand&lt;br /&gt;
                   LocalCommand&lt;br /&gt;
                   LocalForward&lt;br /&gt;
                   LogLevel&lt;br /&gt;
                   MACs&lt;br /&gt;
                   Match&lt;br /&gt;
                   NoHostAuthenticationForLocalhost&lt;br /&gt;
                   NumberOfPasswordPrompts&lt;br /&gt;
                   PasswordAuthentication&lt;br /&gt;
                   PermitLocalCommand&lt;br /&gt;
                   PermitRemoteOpen&lt;br /&gt;
                   PKCS11Provider&lt;br /&gt;
                   Port&lt;br /&gt;
                   PreferredAuthentications&lt;br /&gt;
                   ProxyCommand&lt;br /&gt;
                   ProxyJump&lt;br /&gt;
                   ProxyUseFdpass&lt;br /&gt;
                   PubkeyAcceptedAlgorithms&lt;br /&gt;
                   PubkeyAuthentication&lt;br /&gt;
                   RekeyLimit&lt;br /&gt;
                   RemoteCommand&lt;br /&gt;
                   RemoteForward&lt;br /&gt;
                   RequestTTY&lt;br /&gt;
                   SendEnv&lt;br /&gt;
                   ServerAliveInterval&lt;br /&gt;
                   ServerAliveCountMax&lt;br /&gt;
                   SessionType&lt;br /&gt;
                   SetEnv&lt;br /&gt;
                   StdinNull&lt;br /&gt;
                   StreamLocalBindMask&lt;br /&gt;
                   StreamLocalBindUnlink&lt;br /&gt;
                   StrictHostKeyChecking&lt;br /&gt;
                   TCPKeepAlive&lt;br /&gt;
                   Tunnel&lt;br /&gt;
                   TunnelDevice&lt;br /&gt;
                   UpdateHostKeys&lt;br /&gt;
                   User&lt;br /&gt;
                   UserKnownHostsFile&lt;br /&gt;
                   VerifyHostKeyDNS&lt;br /&gt;
                   VisualHostKey&lt;br /&gt;
                   XAuthLocation&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:     &#039;&#039;&#039;-p port&#039;&#039;&#039;&lt;br /&gt;
:             Port to connect to on the remote host.  This can be specified on a per-host basis in the configuration file.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-Q query_option&#039;&#039;&#039;&lt;br /&gt;
:             Queries for the algorithms supported by one of the following features: cipher (supported symmetric ciphers), cipher-auth (supported symmetric ciphers that support authenticated encryption), help (supported query terms for use with the -Q flag), mac (supported message integrity codes), kex (key exchange algorithms), kex-gss (GSSAPI key exchange algorithms), key (key types), key-cert (certificate key types), key-plain (non-certificate key types), key-sig (all key types and signature algorithms), protocol-version (supported SSH protocol versions), and sig (supported signature algorithms).  Alternatively, any keyword from ssh_config(5) or sshd_config(5) that takes an algorithm list may be used as an alias for the corresponding query_option.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-q&#039;&#039;&#039;      Quiet mode.  Causes most warning and diagnostic messages to be suppressed.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-R [bind_address:]port:host:hostport&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-R [bind_address:]port:local_socket&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-R remote_socket:host:hostport&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-R remote_socket:local_socket&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;-R [bind_address:]port&#039;&#039;&#039;&lt;br /&gt;
:             Specifies that connections to the given TCP port or Unix socket on the remote (server) host are to be forwarded to the local side.&lt;br /&gt;
&lt;br /&gt;
:             This works by allocating a socket to listen to either a TCP port or to a Unix socket on the remote side.  Whenever a connection is made to this port or Unix socket, the connection is forwarded over the secure channel, and a connection is made from the local machine to either an explicit destination specified by host port hostport, or local_socket, or, if no explicit destination was specified, ssh will act as a SOCKS 4/5 proxy and forward connections to the destinations requested by the remote SOCKS client.&lt;br /&gt;
&lt;br /&gt;
:             Port forwardings can also be specified in the configuration file.  Privileged ports can be forwarded only when logging in as root on the remote machine.  IPv6 addresses can be specified by enclosing the address in square brackets.&lt;br /&gt;
&lt;br /&gt;
:             By default, TCP listening sockets on the server will be bound to the loopback interface only.  This may be overridden by specifying a bind_address.  An empty bind_address, or the address ‘*’, indicates that the remote socket should listen on all interfaces.  Specifying a remote bind_address will only succeed if the server&#039;s GatewayPorts option is enabled (see sshd_config(5)).&lt;br /&gt;
&lt;br /&gt;
:             If the port argument is ‘0’, the listen port will be dynamically allocated on the server and reported to the client at run time.  When used together with -O forward the allocated port will be printed to the standard output.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-S ctl_path&#039;&#039;&#039;&lt;br /&gt;
:             Specifies the location of a control socket for connection sharing, or the string “none” to disable connection sharing.  Refer to the description of ControlPath and ControlMaster in ssh_config(5) for details.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-s&#039;&#039;&#039;      May be used to request invocation of a subsystem on the remote system.  Subsystems facilitate the use of SSH as a secure transport for other applications (e.g. sftp(1)).  The subsystem is specified as the remote command.  Refer to the description of SessionType in ssh_config(5) for details.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-T&#039;&#039;&#039;      Disable pseudo-terminal allocation.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-t&#039;&#039;&#039;      Force pseudo-terminal allocation.  This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services.&lt;br /&gt;
:             Multiple &#039;&#039;&#039;-t&#039;&#039;&#039; options force tty allocation, even if ssh has no local tty.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-V&#039;&#039;&#039;      Display the version number and exit.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-v&#039;&#039;&#039;      Verbose mode.  Causes ssh to print debugging messages about its progress.  This is helpful in debugging connection, authentication, and configuration problems.  Multiple -v options increase the verbosity.  The maximum is 3.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-W host:port&#039;&#039;&#039;&lt;br /&gt;
:             Requests that standard input and output on the client be forwarded to host on port over the secure channel.  Implies -N, -T, ExitOnForwardFailure and ClearAllForwardings, though these can be overridden in the configuration file or using -o command line options.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-w local_tun[:remote_tun]&#039;&#039;&#039;&lt;br /&gt;
:             Requests tunnel device forwarding with the specified tun(4) devices between the client (local_tun) and the server (remote_tun).&lt;br /&gt;
&lt;br /&gt;
:             The devices may be specified by numerical ID or the keyword “any”, which uses the next available tunnel device.  If remote_tun is not specified, it defaults to “any”.  See also the Tunnel and TunnelDevice directives in ssh_config(5).&lt;br /&gt;
&lt;br /&gt;
:             If the Tunnel directive is unset, it will be set to the default tunnel mode, which is “point-to-point”.  If a different Tunnel forwarding mode it desired, then it should be specified before -w.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-X&#039;&#039;&#039;      Enables X11 forwarding.  This can also be specified on a per-host basis in a configuration file.&lt;br /&gt;
&lt;br /&gt;
:             X11 forwarding should be enabled with caution.  Users with the ability to bypass file permissions on the remote host (for the user&#039;s X authorization database) can access the local X11 display through the forwarded connection.  An attacker may then be able to perform activities such as keystroke monitoring.&lt;br /&gt;
&lt;br /&gt;
:             For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default.  Refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information.&lt;br /&gt;
&lt;br /&gt;
:             (Debian-specific: X11 forwarding is not subjected to X11 SECURITY extension restrictions by default, because too many programs currently crash in this mode.  Set the ForwardX11Trusted option to “no” to restore the upstream behaviour.  This may change in future depending on client-side improvements.)&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-x&#039;&#039;&#039;      Disables X11 forwarding.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-Y&#039;&#039;&#039;      Enables trusted X11 forwarding.  Trusted X11 forwardings are not subjected to the X11 SECURITY extension controls.&lt;br /&gt;
&lt;br /&gt;
:             (Debian-specific: In the default configuration, this option is equivalent to -X, since ForwardX11Trusted defaults to “yes” as described above.  Set the ForwardX11Trusted option to “no” to restore the upstream behaviour.  This may change in future depending on client-side improvements.)&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;-y&#039;&#039;&#039;      Send log information using the syslog(3) system module.  By default this information is sent to stderr.&lt;br /&gt;
&lt;br /&gt;
:     ssh may additionally obtain configuration data from a per-user configuration file and a system-wide configuration file.  The file format and configuration options are described in ssh_config(5).&lt;br /&gt;
&lt;br /&gt;
===AUTHENTICATION===&lt;br /&gt;
:     The OpenSSH SSH client supports SSH protocol 2.&lt;br /&gt;
&lt;br /&gt;
:     The methods available for authentication are: &#039;&#039;&#039;GSSAPI-based&#039;&#039;&#039; authentication, &#039;&#039;&#039;host-based&#039;&#039;&#039; authentication, &#039;&#039;&#039;public key&#039;&#039;&#039; authentication, &#039;&#039;&#039;keyboard-interactive&#039;&#039;&#039; authentication, and &#039;&#039;&#039;password&#039;&#039;&#039; authentication.  Authentication methods are tried in the order specified above, though PreferredAuthentications can be used to change the default order.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;Host-based authentication&#039;&#039;&#039; works as follows: If the machine the user logs in from is listed in &#039;&#039;&#039;/etc/hosts.equiv&#039;&#039;&#039; or &#039;&#039;&#039;/etc/ssh/shosts.equiv&#039;&#039;&#039; on the remote machine, the user is non-root and the user names are the same on both sides, or if the files &#039;&#039;&#039;~/.rhosts&#039;&#039;&#039; or &#039;&#039;&#039;~/.shosts &#039;&#039;&#039;exist in the user&#039;s home directory on the remote machine and contain a line containing the name of the client machine and the name of the user on that machine, the user is considered for login.  Additionally, the server must be able to verify the client&#039;s host key (see the description of &#039;&#039;&#039;/etc/ssh/ssh_known_hosts&#039;&#039;&#039; and &#039;&#039;&#039;~/.ssh/known_hosts&#039;&#039;&#039;, below) for login to be permitted.  This authentication method closes security holes due to IP spoofing, DNS spoofing, and routing spoofing.&lt;br /&gt;
:     [Note to the administrator: &#039;&#039;&#039;/etc/hosts.equiv&#039;&#039;&#039;, &#039;&#039;&#039;~/.rhosts&#039;&#039;&#039;, and the &#039;&#039;&#039;rlogin/rsh&#039;&#039;&#039; protocol in general, are inherently insecure and should be disabled if security is desired.]&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;Public key authentication&#039;&#039;&#039; works as follows: The scheme is based on public-key cryptography, using cryptosystems where encryption and decryption are done using separate keys, and it is unfeasible to derive the decryption key from the encryption key.  The idea is that each user creates a &#039;&#039;&#039;public/private key pair&#039;&#039;&#039; for authentication purposes.  The server knows the public key, and only the user knows the private key.  ssh implements public key authentication protocol automatically, using one of the &#039;&#039;&#039;DSA&#039;&#039;&#039;, &#039;&#039;&#039;ECDSA&#039;&#039;&#039;, &#039;&#039;&#039;Ed25519&#039;&#039;&#039; or &#039;&#039;&#039;RSA&#039;&#039;&#039; algorithms.  The HISTORY section of ssl(8) (on non-OpenBSD systems, see http://www.openbsd.org/cgi-bin/man.cgi?query=ssl&amp;amp;sektion=8#HISTORY) contains a brief discussion of the &#039;&#039;&#039;DSA&#039;&#039;&#039; and &#039;&#039;&#039;RSA&#039;&#039;&#039; algorithms.&lt;br /&gt;
&lt;br /&gt;
:     The file &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; lists the public keys that are permitted for logging in.  When the user logs in, the ssh program tells the server which key pair it would like to use for authentication.  The client proves that it has access to the private key and the server checks that the corresponding public key is authorized to accept the account.&lt;br /&gt;
&lt;br /&gt;
:     The server may inform the client of errors that prevented public key authentication from succeeding after authentication completes using a different method.  These may be viewed by increasing the LogLevel to DEBUG or higher (e.g. by using the -v flag).&lt;br /&gt;
&lt;br /&gt;
:     The user creates their key pair by running ssh-keygen(1).  This stores the private key in &#039;&#039;&#039;~/.ssh/id_dsa&#039;&#039;&#039; (DSA), &#039;&#039;&#039;~/.ssh/id_ecdsa&#039;&#039;&#039; (ECDSA), &#039;&#039;&#039;~/.ssh/id_ecdsa_sk&#039;&#039;&#039; (authenticator-hosted ECDSA),  &#039;&#039;&#039;~/.ssh/id_ed25519&#039;&#039;&#039; (Ed25519), &#039;&#039;&#039;~/.ssh/id_ed25519_sk&#039;&#039;&#039; (authenticator-hosted Ed25519), or &#039;&#039;&#039;~/.ssh/id_rsa&#039;&#039;&#039; (RSA) and stores the public key in &#039;&#039;&#039;~/.ssh/id_dsa.pub&#039;&#039;&#039; (DSA), &#039;&#039;&#039;~/.ssh/id_ecdsa.pub&#039;&#039;&#039; (ECDSA), &#039;&#039;&#039;~/.ssh/id_ecdsa_sk.pub&#039;&#039;&#039; (authenticator-hosted ECDSA), &#039;&#039;&#039;~/.ssh/id_ed25519.pub&#039;&#039;&#039; (Ed25519), &#039;&#039;&#039;~/.ssh/id_ed25519_sk.pub&#039;&#039;&#039; (authenticator-hosted Ed25519), or &#039;&#039;&#039;~/.ssh/id_rsa.pub&#039;&#039;&#039; (RSA) in the user&#039;s home directory.  The user should then copy the public key to &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; in their home directory on the remote machine.  The authorized_keys file corresponds to the conventional &#039;&#039;&#039;~/.rhosts&#039;&#039;&#039; file, and has one key per line, though the lines can be very long.  After this, the user can log in without giving the password.&lt;br /&gt;
&lt;br /&gt;
:     A variation on public key authentication is available in the form of certificate authentication: instead of a set of public/private keys, signed certificates are used.  This has the advantage that a single trusted certification authority can be used in place of many public/private keys.  See the CERTIFICATES section of ssh-keygen(1) for more information.&lt;br /&gt;
&lt;br /&gt;
:     The most convenient way to use public key or certificate authentication may be with an authentication agent.  See ssh-agent(1) and (optionally) the AddKeysToAgent directive in ssh_config(5) for more information.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;Keyboard-interactive authentication&#039;&#039;&#039; works as follows: The server sends an arbitrary &amp;quot;challenge&amp;quot; text and prompts for a response, possibly multiple times.  Examples of keyboard-interactive authentication include BSD Authentication (see login.conf(5)) and PAM (some non-OpenBSD systems).&lt;br /&gt;
&lt;br /&gt;
:     Finally, if other authentication methods fail, ssh prompts the user for a password.  The password is sent to the remote host for checking; however, since all communications are encrypted, the password cannot be seen by someone listening on the network.&lt;br /&gt;
&lt;br /&gt;
:     ssh automatically maintains and checks a database containing identification for all hosts it has ever been used with.  Host keys are stored in ~/.ssh/known_hosts in the user&#039;s home directory.&lt;br /&gt;
:     Additionally, the file &#039;&#039;&#039;/etc/ssh/ssh_known_hosts&#039;&#039;&#039; is automatically checked for known hosts.  Any new hosts are automatically added to the user&#039;s file.  If a host&#039;s identification ever changes, ssh warns about this and disables password authentication to prevent server spoofing or man-in-the-middle attacks, which could otherwise be used to circumvent the encryption.  The &#039;&#039;&#039;StrictHostKeyChecking&#039;&#039;&#039; option can be used to control logins to machines whose host key is not known or has changed.&lt;br /&gt;
&lt;br /&gt;
:     When the user&#039;s identity has been accepted by the server, the server either executes the given command in a non-interactive session or, if no command has been specified, logs into the machine and gives the user a normal shell as an interactive session.  All communication with the remote command or shell will be automatically encrypted.&lt;br /&gt;
&lt;br /&gt;
:     If an interactive session is requested ssh by default will only request a pseudo-terminal (pty) for interactive sessions when the client has one.  The flags &#039;&#039;&#039;-T&#039;&#039;&#039; and &#039;&#039;&#039;-t&#039;&#039;&#039; can be used to override this behaviour.&lt;br /&gt;
&lt;br /&gt;
:     If a pseudo-terminal has been allocated the user may use the escape characters noted below.&lt;br /&gt;
&lt;br /&gt;
:     If no pseudo-terminal has been allocated, the session is transparent and can be used to reliably transfer binary data.  On most systems, setting the escape character to “none” will also make the session transparent even if a tty is used.&lt;br /&gt;
&lt;br /&gt;
:     The session terminates when the command or shell on the remote machine exits and all X11 and TCP connections have been closed.&lt;br /&gt;
&lt;br /&gt;
===ESCAPE CHARACTERS===&lt;br /&gt;
:     When a pseudo-terminal has been requested, ssh supports a number of functions through the use of an escape character.&lt;br /&gt;
&lt;br /&gt;
:     A single tilde character can be sent as ~~ or by following the tilde by a character other than those described below.  The escape character must always follow a newline to be interpreted as special.  The escape character can be changed in configuration files using the EscapeChar configuration directive or on the command line by the -e option.&lt;br /&gt;
&lt;br /&gt;
:     The supported escapes (assuming the default ‘~’) are:&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~.&#039;&#039;&#039;      Disconnect.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~^Z&#039;&#039;&#039;     Background ssh.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~#&#039;&#039;&#039;      List forwarded connections.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~&amp;amp;&#039;&#039;&#039;      Background ssh at logout when waiting for forwarded connection / X11 sessions to terminate.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~?&#039;&#039;&#039;      Display a list of escape characters.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~B&#039;&#039;&#039;      Send a BREAK to the remote system (only useful if the peer supports it).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~C&#039;&#039;&#039;      Open command line.  Currently this allows the addition of port forwardings using the -L, -R and -D options (see above).  It also allows the cancellation of existing port-forwardings with -KL[bind_address:]port for local, -KR[bind_address:]port for remote and -KD[bind_address:]port for dynamic port-forwardings.  !command allows the user to execute a local command if the &#039;&#039;&#039;PermitLocalCommand&#039;&#039;&#039; option is enabled in ssh_config(5).  Basic help is available, using the -h option.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~R&#039;&#039;&#039;      Request rekeying of the connection (only useful if the peer supports it).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~V&#039;&#039;&#039;      Decrease the verbosity (LogLevel) when errors are being written to stderr.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~v&#039;&#039;&#039;      Increase the verbosity (LogLevel) when errors are being written to stderr.&lt;br /&gt;
&lt;br /&gt;
===TCP FORWARDING===&lt;br /&gt;
:     Forwarding of arbitrary TCP connections over a secure channel can be specified either on the command line or in a configuration file.  One possible application of TCP forwarding is a secure connection to a mail server; another is going through firewalls.&lt;br /&gt;
&lt;br /&gt;
:     In the example below, we look at encrypting communication for an IRC client, even though the IRC server it connects to does not directly support encrypted communication.  This works as follows: the user connects to the remote host using ssh, specifying the ports to be used to forward the connection.  After that it is possible to start the program locally, and ssh will encrypt and forward the connection to the remote server.&lt;br /&gt;
&lt;br /&gt;
:     The following example tunnels an IRC session from the client to an IRC server at “server.example.com”, joining channel “#users”, nickname “pinky”, using the standard IRC port, 6667:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -f -L 6667:localhost:6667 server.example.com sleep 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;irc -c &#039;#users&#039; pinky IRC/127.0.0.1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     The -f option backgrounds ssh and the remote command “sleep 10” is specified to allow an amount of time (10 seconds, in the example) to start the program which is going to use the tunnel.  If no connections are made within the time specified, ssh will exit.&lt;br /&gt;
&lt;br /&gt;
===X11 FORWARDING===&lt;br /&gt;
:     If the ForwardX11 variable is set to “yes” (or see the description of the -X, -x, and -Y options above) and the user is using X11 (the DISPLAY environment variable is set), the connection to the X11 display is automatically forwarded to the remote side in such a way that any X11 programs started from the shell (or command) will go through the encrypted channel, and the connection to the real X server will be made from the local machine.  The user should not manually set DISPLAY.  Forwarding of X11 connections can be configured on the command line or in configuration files.&lt;br /&gt;
&lt;br /&gt;
:     The DISPLAY value set by ssh will point to the server machine, but with a display number greater than zero.  This is normal, and happens because ssh creates a “proxy” X server on the server machine for forwarding the connections over the encrypted channel.&lt;br /&gt;
&lt;br /&gt;
:     ssh will also automatically set up &#039;&#039;&#039;Xauthority&#039;&#039;&#039; data on the server machine.  For this purpose, it will generate a random authorization cookie, store it in Xauthority on the server, and verify that any forwarded connections carry this cookie and replace it by the real cookie when the connection is opened.  The real authentication cookie is never sent to the server machine (and no cookies are sent in the plain).&lt;br /&gt;
&lt;br /&gt;
:     If the &#039;&#039;&#039;ForwardAgent&#039;&#039;&#039; variable is set to “yes” (or see the description of the -A and -a options above) and the user is using an authentication agent, the connection to the agent is automatically forwarded to the remote side.&lt;br /&gt;
&lt;br /&gt;
===VERIFYING HOST KEYS===&lt;br /&gt;
:     When connecting to a server for the first time, a fingerprint of the server&#039;s public key is presented to the user (unless the option &#039;&#039;&#039;StrictHostKeyChecking&#039;&#039;&#039; has been disabled).  Fingerprints can be determined using ssh-keygen(1):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     If the fingerprint is already known, it can be matched and the key can be accepted or rejected.  If only legacy (MD5) fingerprints for the server are available, the ssh-keygen(1) -E option may be used to downgrade the fingerprint algorithm to match.&lt;br /&gt;
&lt;br /&gt;
:     Because of the difficulty of comparing host keys just by looking at fingerprint strings, there is also support to compare host keys visually, using random art.  By setting the &#039;&#039;&#039;VisualHostKey&#039;&#039;&#039; option to “yes”, a small ASCII graphic gets displayed on every login to a server, no matter if the session itself is interactive or not.  By learning the pattern a known server produces, a user can easily find out that the host key has changed when a completely different pattern is displayed.  Because these patterns are not unambiguous however, a pattern that looks similar to the pattern remembered only gives a good probability that the host key is the same, not guaranteed proof.&lt;br /&gt;
&lt;br /&gt;
:     To get a listing of the fingerprints along with their random art for all known hosts, the following command line can be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -lv -f ~/.ssh/known_hosts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     If the fingerprint is unknown, an alternative method of verification is available: SSH fingerprints verified by DNS.  An additional resource record (RR), SSHFP, is added to a zonefile and the connecting client is able to match the fingerprint with that of the key presented.&lt;br /&gt;
&lt;br /&gt;
:     In this example, we are connecting a client to a server, “host.example.com”.  The SSHFP resource records should first be added to the zonefile for host.example.com:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -r host.example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     The output lines will have to be added to the zonefile.  To check that the zone is answering fingerprint queries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;dig -t SSHFP host.example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     Finally the client connects:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
           $ ssh -o &amp;quot;VerifyHostKeyDNS ask&amp;quot; host.example.com&lt;br /&gt;
           [...]&lt;br /&gt;
           Matching host key fingerprint found in DNS.&lt;br /&gt;
           Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     See the VerifyHostKeyDNS option in ssh_config(5) for more information.&lt;br /&gt;
&lt;br /&gt;
===SSH-BASED VIRTUAL PRIVATE NETWORKS===&lt;br /&gt;
:     ssh contains support for Virtual Private Network (VPN) tunnelling using the tun(4) network pseudo-device, allowing two networks to be joined securely.  The sshd_config(5) configuration option &#039;&#039;&#039;PermitTunnel&#039;&#039;&#039; controls whether the server supports this, and at what level (layer 2 or 3 traffic).&lt;br /&gt;
&lt;br /&gt;
:     The following example would connect client network 10.0.50.0/24 with remote network 10.0.99.0/24 using a point-to-point connection from 10.1.1.1 to 10.1.1.2, provided that the SSH server running on the gateway to the remote network, at 192.168.1.15, allows it.&lt;br /&gt;
&lt;br /&gt;
:     On the client:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -f -w 0:1 192.168.1.15 true&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ifconfig tun0 10.1.1.1 10.1.1.2 netmask 255.255.255.252&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;route add 10.0.99.0/24 10.1.1.2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     On the server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ifconfig tun1 10.1.1.2 10.1.1.1 netmask 255.255.255.252&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;route add 10.0.50.0/24 10.1.1.1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     Client access may be more finely tuned via the /root/.ssh/authorized_keys file (see below) and the PermitRootLogin server option.  The following entry would permit connections on tun(4) device 1 from user “jane” and on tun device 2 from user “john”, if &#039;&#039;&#039;PermitRootLogin&#039;&#039;&#039; is set to “forced-commands-only”:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       tunnel=&amp;quot;1&amp;quot;,command=&amp;quot;sh /etc/netstart tun1&amp;quot; ssh-rsa ... jane&lt;br /&gt;
       tunnel=&amp;quot;2&amp;quot;,command=&amp;quot;sh /etc/netstart tun2&amp;quot; ssh-rsa ... john&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:     Since an SSH-based setup entails a fair amount of overhead, it may be more suited to temporary setups, such as for wireless VPNs.  More permanent VPNs are better provided by tools such as ipsecctl(8) and isakmpd(8).&lt;br /&gt;
&lt;br /&gt;
===ENVIRONMENT===&lt;br /&gt;
:     ssh will normally set the following environment variables:&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;DISPLAY&#039;&#039;&#039;               The DISPLAY variable indicates the location of the X11 server.  It is automatically set by ssh to point to a value of the form “hostname:n”, where “hostname” indicates the host where the shell runs, and ‘n’ is an integer ≥ 1.  ssh uses this special value to forward X11 connections over the secure channel.  The user should normally not set DISPLAY explicitly, as that will render the X11 connection insecure (and will require the user to manually copy any required authorization cookies).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;HOME&#039;&#039;&#039;                  Set to the path of the user&#039;s home directory.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;LOGNAME&#039;&#039;&#039;               Synonym for USER; set for compatibility with systems that use this variable.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;MAIL&#039;&#039;&#039;                  Set to the path of the user&#039;s mailbox.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;PATH&#039;&#039;&#039;                  Set to the default PATH, as specified when compiling ssh.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_ASKPASS&#039;&#039;&#039;           If ssh needs a passphrase, it will read the passphrase from the current terminal if it was run from a terminal.  If ssh does not have a terminal associated with it but DISPLAY and SSH_ASKPASS are set, it will execute the program specified by SSH_ASKPASS and open an X11 window to read the passphrase.  This is particularly useful when calling ssh from a .xsession or related script.  (Note that on some machines it may be necessary to redirect the input from /dev/null to make this work.)&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_ASKPASS_REQUIRE&#039;&#039;&#039;   Allows further control over the use of an askpass program.  If this variable is set to “never” then ssh will never attempt to use one.  If it is set to “prefer”, then ssh will prefer to use the askpass program instead of the TTY when requesting passwords.  Finally, if the variable is set to “force”, then the askpass program will be used for all passphrase input regardless of whether DISPLAY is set.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_AUTH_SOCK&#039;&#039;&#039;         Identifies the path of a UNIX-domain socket used to communicate with the agent.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_CONNECTION&#039;&#039;&#039;        Identifies the client and server ends of the connection.  The variable contains four space-separated values: client IP address, client port number, server IP address, and server port number.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_ORIGINAL_COMMAND&#039;&#039;&#039;  This variable contains the original command line if a forced command is executed.  It can be used to extract the original arguments.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_TTY&#039;&#039;&#039;               This is set to the name of the tty (path to the device) associated with the current shell or command.  If the current session has no tty, this variable is not set.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_TUNNEL&#039;&#039;&#039;            Optionally set by sshd(8) to contain the interface names assigned if tunnel forwarding was requested by the client.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;SSH_USER_AUTH&#039;&#039;&#039;         Optionally set by sshd(8), this variable may contain a pathname to a file that lists the authentication methods successfully used when the session was established, including any public keys that were used.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;TZ&#039;&#039;&#039;                    This variable is set to indicate the present time zone if it was set when the daemon was started (i.e. the daemon passes the value on to new connections).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;USER&#039;&#039;&#039;                  Set to the name of the user logging in.&lt;br /&gt;
&lt;br /&gt;
:     Additionally, ssh reads &#039;&#039;&#039;~/.ssh/environment&#039;&#039;&#039;, and adds lines of the format “VARNAME=value” to the environment if the file exists and users are allowed to change their environment.  For more information, see the &#039;&#039;&#039;PermitUserEnvironment&#039;&#039;&#039; option in sshd_config(5).&lt;br /&gt;
&lt;br /&gt;
===FILES===&lt;br /&gt;
:     &#039;&#039;&#039;~/.rhosts&#039;&#039;&#039;&lt;br /&gt;
:             This file is used for host-based authentication (see above).  On some machines this file may need to be world-readable if the user&#039;s home directory is on an NFS partition, because sshd(8) reads it as root.  Additionally, this file must be owned by the user, and must not have write permissions for anyone else.  The recommended permission for most machines is read/write for the user, and not accessible by others.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.shosts&#039;&#039;&#039;&lt;br /&gt;
:             This file is used in exactly the same way as .rhosts, but allows host-based authentication without permitting login with rlogin/rsh.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/&#039;&#039;&#039;&lt;br /&gt;
:             This directory is the default location for all user-specific configuration and authentication information.  There is no general requirement to keep the entire contents of this directory secret, but the recommended permissions are read/write/execute for the user, and not accessible by others.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039;&lt;br /&gt;
:             Lists the public keys (DSA, ECDSA, Ed25519, RSA) that can be used for logging in as this user.  The format of this file is described in the sshd(8) manual page.  This file is not highly sensitive, but the recommended permissions are read/write for the user, and not accessible by others.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;&lt;br /&gt;
:             This is the per-user configuration file.  The file format and configuration options are described in ssh_config(5).  Because of the potential for abuse, this file must have strict permissions: read/write for the user, and not writable by others.  It may be group-writable provided that the group in question contains only the user.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/environment&#039;&#039;&#039;&lt;br /&gt;
:             Contains additional definitions for environment variables; see ENVIRONMENT, above.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_dsa&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ecdsa&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ecdsa_sk&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ed25519&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ed25519_sk&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_rsa&#039;&#039;&#039;&lt;br /&gt;
:             Contains the private key for authentication.  These files contain sensitive data and should be readable by the user but not accessible by others (read/write/execute).  ssh will simply ignore a private key file if it is accessible by others.  It is possible to specify a passphrase when generating the key which will be used to encrypt the sensitive part of this file using AES-128.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_dsa.pub&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ecdsa.pub&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ecdsa_sk.pub&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ed25519.pub&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_ed25519_sk.pub&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/id_rsa.pub&#039;&#039;&#039;&lt;br /&gt;
:             Contains the public key for authentication.  These files are not sensitive and can (but need not) be readable by anyone.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/known_hosts&#039;&#039;&#039;&lt;br /&gt;
:             Contains a list of host keys for all hosts the user has logged into that are not already in the systemwide list of known host keys.  See sshd(8) for further details of the format of this file.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;~/.ssh/rc&#039;&#039;&#039;&lt;br /&gt;
:             Commands in this file are executed by ssh when the user logs in, just before the user&#039;s shell (or command) is started.  See the sshd(8) manual page for more information.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;/etc/hosts.equiv&#039;&#039;&#039;&lt;br /&gt;
:             This file is for host-based authentication (see above).  It should only be writable by root.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/shosts.equiv&#039;&#039;&#039;&lt;br /&gt;
:             This file is used in exactly the same way as hosts.equiv, but allows host-based authentication without permitting login with rlogin/rsh.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_config&#039;&#039;&#039;&lt;br /&gt;
:             Systemwide configuration file.  The file format and configuration options are described in ssh_config(5).&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_host_key&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_host_dsa_key&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_host_ecdsa_key&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_host_ed25519_key&#039;&#039;&#039;&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_host_rsa_key&#039;&#039;&#039;&lt;br /&gt;
:             These files contain the private parts of the host keys and are used for host-based authentication.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/ssh_known_hosts&#039;&#039;&#039;&lt;br /&gt;
:             Systemwide list of known host keys.  This file should be prepared by the system administrator to contain the public host keys of all machines in the organization.  It should be world-readable.  See sshd(8) for further details of the format of this file.&lt;br /&gt;
&lt;br /&gt;
:     &#039;&#039;&#039;/etc/ssh/sshrc&#039;&#039;&#039;&lt;br /&gt;
:             Commands in this file are executed by ssh when the user logs in, just before the user&#039;s shell (or command) is started.  See the sshd(8) manual page for more information.&lt;br /&gt;
&lt;br /&gt;
===EXIT STATUS===&lt;br /&gt;
:     ssh exits with the exit status of the remote command or with 255 if an error occurred.&lt;br /&gt;
&lt;br /&gt;
===SEE ALSO===&lt;br /&gt;
:     scp(1), sftp(1), ssh-add(1), ssh-agent(1), ssh-argv0(1), ssh-keygen(1), ssh-keyscan(1), tun(4), ssh_config(5), ssh-keysign(8), sshd(8)&lt;br /&gt;
&lt;br /&gt;
===STANDARDS===&lt;br /&gt;
*     S. Lehtinen and C. Lonvick, The Secure Shell (SSH) Protocol Assigned Numbers, RFC 4250, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     T. Ylonen and C. Lonvick, The Secure Shell (SSH) Protocol Architecture, RFC 4251, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     T. Ylonen and C. Lonvick, The Secure Shell (SSH) Authentication Protocol, RFC 4252, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     T. Ylonen and C. Lonvick, The Secure Shell (SSH) Transport Layer Protocol, RFC 4253, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     T. Ylonen and C. Lonvick, The Secure Shell (SSH) Connection Protocol, RFC 4254, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     J. Schlyter and W. Griffin, Using DNS to Securely Publish Secure Shell (SSH) Key Fingerprints, RFC 4255, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     F. Cusack and M. Forssen, Generic Message Exchange Authentication for the Secure Shell Protocol (SSH), RFC 4256, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     J. Galbraith and P. Remaker, The Secure Shell (SSH) Session Channel Break Extension, RFC 4335, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     M. Bellare, T. Kohno, and C. Namprempre, The Secure Shell (SSH) Transport Layer Encryption Modes, RFC 4344, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     B. Harris, Improved Arcfour Modes for the Secure Shell (SSH) Transport Layer Protocol, RFC 4345, January 2006.&lt;br /&gt;
&lt;br /&gt;
*     M. Friedl, N. Provos, and W. Simpson, Diffie-Hellman Group Exchange for the Secure Shell (SSH) Transport Layer Protocol, RFC 4419, March 2006.&lt;br /&gt;
&lt;br /&gt;
*     J. Galbraith and R. Thayer, The Secure Shell (SSH) Public Key File Format, RFC 4716, November 2006.&lt;br /&gt;
&lt;br /&gt;
*     D. Stebila and J. Green, Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer, RFC 5656, December 2009.&lt;br /&gt;
&lt;br /&gt;
*     A. Perrig and D. Song, Hash Visualization: a New Technique to improve Real-World Security, 1999, International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC &#039;99).&lt;br /&gt;
&lt;br /&gt;
===AUTHORS===&lt;br /&gt;
:     OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen.  Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH.  Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0.&lt;br /&gt;
&lt;br /&gt;
BSD                                                                                        February 6, 2022                                                                                       BSD&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=432</id>
		<title>Ubuntu 22.04 SSH Guide</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSH_Guide&amp;diff=432"/>
		<updated>2023-05-16T11:38:05Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;==Understanding SSH==  &amp;#039;&amp;#039;&amp;#039;SSH&amp;#039;&amp;#039;&amp;#039; is a protocol that uses encryption to secure data transmitted between a client and a server. &amp;lt;br&amp;gt; It enables users to execute commands, transfer files, and manage remote systems through an encrypted channel. &amp;lt;br&amp;gt; SSH is widely used by system administrators for managing servers, network devices, and other remote systems.  ==Installing SSH==  To start using SSH, you&amp;#039;ll need to install and configure both the server and client components.  *...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Understanding SSH==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SSH&#039;&#039;&#039; is a protocol that uses encryption to secure data transmitted between a client and a server. &amp;lt;br&amp;gt;&lt;br /&gt;
It enables users to execute commands, transfer files, and manage remote systems through an encrypted channel. &amp;lt;br&amp;gt;&lt;br /&gt;
SSH is widely used by system administrators for managing servers, network devices, and other remote systems.&lt;br /&gt;
&lt;br /&gt;
==Installing SSH==&lt;br /&gt;
&lt;br /&gt;
To start using SSH, you&#039;ll need to install and configure both the server and client components.&lt;br /&gt;
&lt;br /&gt;
* OpenSSH-Server&lt;br /&gt;
** Is required to allow &#039;&#039;&#039;ssh&#039;&#039;&#039; connections&lt;br /&gt;
* OpenSSH-Client&lt;br /&gt;
** Is used to login/connect to OpenSSH-Server&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Desktop, the &#039;&#039;&#039;openssh client&#039;&#039;&#039; will be preinstalled, allowing you to connect to a server which is running &#039;&#039;&#039;openssh-server&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you are using Ubuntu Server, both the &#039;&#039;&#039;ssh client&#039;&#039;&#039; and &#039;&#039;&#039;openssh server&#039;&#039;&#039; are preinstalled by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing OpenSSH Server===&lt;br /&gt;
On Ubuntu distributions, you can install the OpenSSH server by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install openssh-server&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the SSH server status with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl status ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Installing OpenSSH Client===&lt;br /&gt;
&lt;br /&gt;
The OpenSSH client is usually pre-installed on most Linux and macOS systems. &amp;lt;br&amp;gt;For Windows, you can install the OpenSSH client by following the instructions on the official website:&amp;lt;br&amp;gt; https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse&lt;br /&gt;
&lt;br /&gt;
==Basic SSH Commands and Usage==&lt;br /&gt;
=== Connecting to a remote server===&lt;br /&gt;
Connecting to a remote server using SSH is a fundamental task when managing remote systems. Here&#039;s how to connect to a remote server using the command-line interface.&lt;br /&gt;
&lt;br /&gt;
Install an SSH client: Ensure you have an SSH client installed on your local machine. Most Unix-based systems, including Linux and macOS, have an SSH client pre-installed. For Windows, you can use the built-in OpenSSH client (available in Windows 10 and later) or a third-party client like PuTTY.&lt;br /&gt;
&lt;br /&gt;
====Gather connection information====&lt;br /&gt;
To connect to a remote server, you&#039;ll need the following information:&lt;br /&gt;
* The remote server&#039;s IP address or hostname&lt;br /&gt;
* The SSH port number (default is 22)&lt;br /&gt;
* Your username on the remote server&lt;br /&gt;
* The password for the user on remote server.&lt;br /&gt;
&lt;br /&gt;
====Connect using SSH====&lt;br /&gt;
Open a terminal or command prompt on your local machine and use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;username&#039;&#039;&#039; with your username on the remote server, &#039;&#039;&#039;hostname_or_IP&#039;&#039;&#039; with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
If OpenSSH-Server is running/listening on a port other than the default port &#039;&#039;&#039;22&#039;&#039;&#039; include the port with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag.&lt;br /&gt;
&lt;br /&gt;
For example (If port 2222):&lt;br /&gt;
&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh john@example.com -p 2222&amp;lt;/code&amp;gt;&lt;br /&gt;
Or&lt;br /&gt;
: &amp;lt;code&amp;gt;ssh -p 2222 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Connecting to a Remote Server =====&lt;br /&gt;
&lt;br /&gt;
In this example, we connect to a remote Ubuntu VPS with the following credentials:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Username: root&lt;br /&gt;
    IP address: 12.34.56.78&lt;br /&gt;
    Password: password2simple&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Use the following command to connect to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted to enter the password. Type password2simple and press Enter. This demonstrates how simple it can be to log into a remote computer with root access.&lt;br /&gt;
&lt;br /&gt;
* If your Server is hosting SSHD on a port other than default &#039;port 22&#039; include port number with the &#039;&#039;&#039;-p&#039;&#039;&#039; flag&lt;br /&gt;
Example with port 2222:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -p 2222 root@12.34.56.78&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Authenticate====&lt;br /&gt;
When connecting for the first time, you&#039;ll see a prompt asking you to confirm the remote server&#039;s fingerprint. Verify the fingerprint and type &amp;quot;yes&amp;quot; to proceed. Next, you&#039;ll be prompted for your password. Enter your password to complete the authentication process.&lt;br /&gt;
&lt;br /&gt;
Once authenticated, you&#039;ll have access to the remote server&#039;s command line. You can now execute commands and manage the remote server as if you were working on it directly.&lt;br /&gt;
&lt;br /&gt;
Remember that you can use key-based authentication (with a private-public key pair) instead of a password for a more secure and convenient connection method.&lt;br /&gt;
== Using SSH config file==&lt;br /&gt;
&lt;br /&gt;
An SSH config file allows you to define and manage multiple SSH connections, simplifying the process of connecting to remote servers. By creating an SSH config file, you can define custom options, such as port numbers, usernames, and key files, for each connection. The SSH config file is typically located in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory and named config.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to create and use an SSH config file:&lt;br /&gt;
&lt;br /&gt;
:*    Create the SSH config file: If it doesn&#039;t exist, create the config file in the &#039;&#039;&#039;~/.ssh&#039;&#039;&#039; directory using a text editor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Define a connection: To define a connection, you&#039;ll need to specify a Host entry followed by any options you want to apply to that connection. Here&#039;s an example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server1&lt;br /&gt;
  HostName example.com&lt;br /&gt;
  User your_username&lt;br /&gt;
  Port 2222&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this example, we&#039;ve defined a connection called server1 with the following options:&lt;br /&gt;
&lt;br /&gt;
:*    HostName: The hostname or IP address of the remote server (example.com in this case).&lt;br /&gt;
:*    User: The username to use when connecting to the remote server (replace your_username with your actual username).&lt;br /&gt;
:*    Port: The port number to use for the SSH connection (2222 in this example).&lt;br /&gt;
:*    IdentityFile: The path to the private key file to use for authentication (replace ~/.ssh/id_rsa_server1 with the path to your private key file).&lt;br /&gt;
&lt;br /&gt;
You can define multiple connections in the same config file by creating separate Host entries:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server2&lt;br /&gt;
  HostName 192.168.1.100&lt;br /&gt;
  User another_username&lt;br /&gt;
  Port 22&lt;br /&gt;
  IdentityFile ~/.ssh/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Connect using the SSH config file: To connect to a remote server using the defined connection, simply use the ssh command followed by the Host entry:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, SSH will automatically use the options defined in the config file for server1, such as the hostname, username, port number, and identity file.&lt;br /&gt;
&lt;br /&gt;
By using an SSH config file, you can simplify the process of managing multiple SSH connections and customize the options for each connection.&lt;br /&gt;
&lt;br /&gt;
==Key-based Authentication==&lt;br /&gt;
=== Generating SSH key pairs===&lt;br /&gt;
&lt;br /&gt;
SSH key pairs consist of a private key and a public key. They provide a secure, passwordless authentication method for connecting to remote servers. The private key remains on your local machine, while the public key is added to the remote server&#039;s authorized keys. Here&#039;s how to generate an SSH key pair:&lt;br /&gt;
&lt;br /&gt;
Open a terminal: On Unix-based systems (Linux and macOS), open a terminal. On Windows, open PowerShell or the Command Prompt.&lt;br /&gt;
&lt;br /&gt;
Generate the key pair: Use the ssh-keygen command to create a new SSH key pair. The following command generates a 4096-bit RSA key pair:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also generate other types of keys, such as Ed25519, by changing the -t option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t ed25519&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Specify the key&#039;s location: When prompted, you can either accept the default location (~/.ssh/id_rsa for RSA keys, ~/.ssh/id_ed25519 for Ed25519 keys) or enter a custom path. It is recommended to use the default location unless you have a specific reason to change it.&lt;br /&gt;
&lt;br /&gt;
Set a passphrase (optional): You can choose to protect your private key with a passphrase. If you do, you&#039;ll need to enter the passphrase every time you use the key. This adds an extra layer of security, but can be less convenient for automation or scripting. To set a passphrase, enter it when prompted; otherwise, leave the field blank&lt;br /&gt;
&lt;br /&gt;
====Selecting file name and path for keys====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option in the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command is used to specify the output file for the generated key pair. In your example, &#039;&#039;&#039;ssh-keygen -t rsa -b 4096 -f .ssh/nuc&#039;&#039;&#039;, the command is generating an RSA key pair with a key length of 4096 bits, and the output files will be saved in the &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory with the base name &#039;&#039;&#039;nuc&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the options used in this command:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-f .ssh/nuc&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;.ssh/nuc&#039;&#039;&#039; and the public key in &#039;&#039;&#039;.ssh/nuc.pub&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Create keys with no passphase====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -t rsa -b 4096 -N &amp;quot;&amp;quot; -C &amp;quot;MYSERVER&amp;quot; -f ~/.ssh/serverkey&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;-t rsa&#039;&#039;&#039;: Specifies the key type, in this case, RSA.&lt;br /&gt;
:*    &#039;&#039;&#039;-b 4096&#039;&#039;&#039;: Specifies the key length, which is 4096 bits in this case. This length offers good security and is generally recommended.&lt;br /&gt;
:*    &#039;&#039;&#039;-N &amp;quot;&amp;quot;&#039;&#039;&#039;: Specifies an empty passphrase for the key pair. This means that the private key will not be encrypted, and no passphrase will be required when using it. This can be less secure, but more convenient for automated processes.&lt;br /&gt;
:*    &#039;&#039;&#039;-C &amp;quot;MYSERVER&amp;quot;&#039;&#039;&#039;: Adds a comment to the generated key pair. In this case, the comment is &amp;quot;MYSERVER&amp;quot;. Comments are useful for identifying keys when you have multiple keys in your ~/.ssh directory or on a remote server.&lt;br /&gt;
:*    &#039;&#039;&#039;-f ~/.ssh/serverkey&#039;&#039;&#039;: Specifies the file where the key pair will be saved. The private key will be saved as &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039;, and the public key will be saved as &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After running this command, you&#039;ll have a new key pair with the private key in &#039;&#039;&#039;~/.ssh/serverkey&#039;&#039;&#039; and the public key in &#039;&#039;&#039;~/.ssh/serverkey.pub&#039;&#039;&#039;. The private key will have an empty passphrase and a comment &amp;quot;MYSERVER&amp;quot; for easier identification.&lt;br /&gt;
&lt;br /&gt;
====Remove the passphrase from an existing SSH private key====&lt;br /&gt;
&lt;br /&gt;
To remove the passphrase from an existing SSH private key, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, which is used for changing the passphrase. Follow these steps:&lt;br /&gt;
&lt;br /&gt;
:*    Make a backup of your private key file, just in case something goes wrong during the process. You can do this by running the following command, replacing &#039;&#039;&#039;&amp;lt;your_private_key&amp;gt;&#039;&#039;&#039; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
::**     &#039;&#039;&#039;-p&#039;&#039;&#039;: Indicates that you want to change the passphrase of an existing private key.&lt;br /&gt;
::**    &#039;&#039;&#039;-f &amp;lt;your_private_key&amp;gt;&#039;&#039;&#039;: Specifies the private key file whose passphrase you want to change.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    You will be prompted to enter the old passphrase for the private key. Type it in and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Since you want to remove the passphrase, leave this field empty and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the empty passphrase. Press Enter again to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has its passphrase removed. Keep in mind that this makes the private key less secure, as anyone with access to the file can use it without needing to know the passphrase.&lt;br /&gt;
&lt;br /&gt;
====Add/Change a passphrase to an existing SSH Key====&lt;br /&gt;
&lt;br /&gt;
To add a passphrase to an existing SSH private key that doesn&#039;t have one, you can use the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the &#039;&#039;&#039;-p&#039;&#039;&#039; option, just like when you change or remove a passphrase. Here are the steps:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;Make a backup of your private key file&#039;&#039;&#039;, just in case something goes wrong during the process. You can do this by running the following command, replacing &amp;lt;your_private_key&amp;gt; with the filename of your private key:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp &amp;lt;your_private_key&amp;gt; &amp;lt;your_private_key&amp;gt;.backup&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Run the &#039;&#039;&#039;ssh-keygen&#039;&#039;&#039; command with the -p option, specifying the private key file using the &#039;&#039;&#039;-f&#039;&#039;&#039; option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-keygen -p -f &amp;lt;your_private_key&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*   You will be prompted to enter the old passphrase for the private key. Since your private key doesn&#039;t currently have a passphrase, just press Enter to proceed.&lt;br /&gt;
&lt;br /&gt;
:*    Next, you&#039;ll be prompted to enter a new passphrase. Type in the passphrase you want to set for the private key and press Enter.&lt;br /&gt;
&lt;br /&gt;
:*    You&#039;ll be asked to confirm the new passphrase. Type it again and press Enter to confirm.&lt;br /&gt;
&lt;br /&gt;
Your private key now has a passphrase added to it. This provides an extra layer of security, as anyone using the key will need to know the passphrase to access it. Keep in mind that you should use a strong passphrase to ensure better security.&lt;br /&gt;
&lt;br /&gt;
=== Copying public keys to the remote server===&lt;br /&gt;
After generating an SSH key pair, you&#039;ll need to copy the public key to the remote server to enable key-based authentication. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
====Using ssh-copy-id====&lt;br /&gt;
&lt;br /&gt;
Use the &#039;&#039;&#039;ssh-copy-id&#039;&#039;&#039; command (Linux and macOS): On Unix-based systems, you can use the ssh-copy-id command to copy your public key to the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace ~/.ssh/id_rsa.pub with the path to your public key file (e.g., ~/.ssh/id_ed25519.pub for Ed25519 keys), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
====Manually copy the public key====&lt;br /&gt;
&lt;br /&gt;
Manually copy the public key (Windows and alternative method): If you don&#039;t have access to the ssh-copy-id command or prefer to do it manually, you can:&lt;br /&gt;
&lt;br /&gt;
:* Open your public key file (e.g., id_rsa.pub or id_ed25519.pub) with a text editor and copy its content.&amp;gt;&lt;br /&gt;
:* Log in to the remote server via SSH.&amp;lt;br&amp;gt;&lt;br /&gt;
:* Create the ~/.ssh directory if it doesn&#039;t exist:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Edit or create the ~/.ssh/authorized_keys file using a text editor (e.g., nano, vim, or emacs), and paste the content of your public key at the end of the file. Save and close the file.&lt;br /&gt;
&lt;br /&gt;
Set the correct file permissions: To ensure the security of your SSH setup, it&#039;s essential to set the proper file permissions on your local machine and the remote server:&lt;br /&gt;
&lt;br /&gt;
:* On your local machine:&lt;br /&gt;
:**       Private key (id_rsa or id_ed25519): -rw------- (600)&lt;br /&gt;
:**       Public key (id_rsa.pub or id_ed25519.pub): -rw-r--r-- (644)&lt;br /&gt;
&lt;br /&gt;
:*    On the remote server:&lt;br /&gt;
:**        ~/.ssh directory: drwx------ (700)&lt;br /&gt;
:**        ~/.ssh/authorized_keys file: -rw------- (600)&lt;br /&gt;
&lt;br /&gt;
To set the permissions on your local machine, use the chmod command:&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
chmod 644 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On the remote server, use the following commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
chmod 700 ~/.ssh&lt;br /&gt;
chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Once you&#039;ve copied your public key to the remote server and set the correct file permissions, you should be able to connect using key-based authentication without the need for a password.&lt;br /&gt;
&lt;br /&gt;
=== Disabling password authentication (optional)===&lt;br /&gt;
Disabling password authentication enhances the security of your SSH server by requiring key-based authentication for all connections. You can disable password authentication for specific users or for all users. To do so, follow these steps:&lt;br /&gt;
&lt;br /&gt;
:* Connect to the remote server: Log in to the remote server via SSH using your username and the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:* Edit the SSH configuration file: Open the SSH server configuration file (usually located at /etc/ssh/sshd_config) with a text editor such as nano, vim, or emacs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for all users: Find the line containing &amp;quot;PasswordAuthentication&amp;quot; and set its value to &amp;quot;no&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol.&lt;br /&gt;
&lt;br /&gt;
:* Disabling password authentication for a specific user: To disable password authentication only for a particular user, you can use a &amp;quot;Match User&amp;quot; block at the end of the sshd_config file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User username&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Replace username with the actual username for which you want to disable password authentication.&lt;br /&gt;
&lt;br /&gt;
:*    Save and exit the file: Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, password authentication will be disabled for the specified user(s), and only key-based authentication will be allowed. Remember that if you disable password authentication, you must have a working SSH key pair set up to access the server, or you may be locked out.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Configuring the SSH server==&lt;br /&gt;
&lt;br /&gt;
Edit the SSH server configuration file located at &amp;lt;b&amp;gt;/etc/ssh/sshd_config&amp;lt;/b&amp;gt; to set your desired settings. You can modify options like the listening port, allowing root login, and more.&lt;br /&gt;
&lt;br /&gt;
===Common sshd_config Options===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file is located at &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; on most Linux systems. This file contains various options and settings that determine the behavior of the OpenSSH server. Each option is followed by its value, and lines starting with a &amp;lt;b&amp;gt;#&amp;lt;/b&amp;gt; are considered comments.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an overview of some common options in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
===Port===&lt;br /&gt;
&lt;br /&gt;
Specifies the port number that the SSH server listens on.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Port 22&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AddressFamily===&lt;br /&gt;
&lt;br /&gt;
Determines the IP address family (IPv4, IPv6, or both) used by the SSH server.&lt;br /&gt;
&lt;br /&gt;
* To specify that the SSH server should only listen for incoming IPv4 connections:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Or, if you want the SSH server to only listen for incoming IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;inet6&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily inet6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to allow both IPv4 and IPv6 connections, set the &#039;AddressFamily&#039; directive to &#039;any&#039;:&lt;br /&gt;
&amp;lt;code&amp;gt;AddressFamily any&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ListenAddress===&lt;br /&gt;
Specifies the IP address(es) the SSH server listens on. By default, it listens on all available addresses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ListenAddress 192.168.1.10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Protocol===&lt;br /&gt;
Defines the SSH protocol version. It&#039;s recommended to use only protocol 2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Protocol 2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PermitRootLogin===&lt;br /&gt;
Controls whether root login is allowed. It&#039;s generally advised to disable root login or set it to &amp;quot;without-password&amp;quot; to allow only key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitRootLogin no&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===PasswordAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables password-based authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PasswordAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PubkeyAuthentication===&lt;br /&gt;
&lt;br /&gt;
Enables or disables public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PubkeyAuthentication yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AuthorizedKeysFile===&lt;br /&gt;
Specifies the location of the authorized keys file for public key authentication.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;AuthorizedKeysFile .ssh/authorized_keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LogLevel===&lt;br /&gt;
Sets the logging level for the SSH server.&lt;br /&gt;
&lt;br /&gt;
The LogLevel option in &#039;&#039;&#039;sshd_config&#039;&#039;&#039; controls the amount of information that SSH daemon (sshd) logs.&lt;br /&gt;
&lt;br /&gt;
There are different log levels that can be set with this option, each providing a different level of detail:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;QUIET&#039;&#039;&#039;: Disables all logging.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;FATAL&#039;&#039;&#039;: Only logs fatal errors.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;ERROR&#039;&#039;&#039;: Logs error messages.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;INFO&#039;&#039;&#039;: Logs informational messages such as login attempts.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;VERBOSE&#039;&#039;&#039;: Logs more detailed information than INFO, including shell commands executed.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DEBUG&#039;&#039;&#039;: Logs detailed debugging information, including raw protocol details.&lt;br /&gt;
&lt;br /&gt;
The default log level is &#039;&#039;&#039;INFO&#039;&#039;&#039;, which is usually sufficient for most purposes. However, if you need to troubleshoot SSH connections or monitor user activity, setting a higher log level may be helpful.&lt;br /&gt;
&lt;br /&gt;
To change the &#039;&#039;&#039;LogLevel&#039;&#039;&#039; in &#039;&#039;&#039;sshd_config&#039;&#039;&#039;, you can edit the file &#039;&#039;&#039;/etc/ssh/sshd_config&#039;&#039;&#039; (or the appropriate configuration file for your system), and add or modify the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel &amp;lt;log_level&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &amp;lt;log_level&amp;gt; is one of the log levels listed above.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LogLevel INFO&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== LoginGraceTime===&lt;br /&gt;
&lt;br /&gt;
Defines the time allowed for a user to successfully log in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;LoginGraceTime 2m&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MaxAuthTries===&lt;br /&gt;
&lt;br /&gt;
Limits the number of authentication attempts allowed per connection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxAuthTries 6&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MaxSessions===&lt;br /&gt;
&lt;br /&gt;
Specifies the maximum number of simultaneous sessions allowed per network connection.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;MaxSessions 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== AllowUsers, DenyUsers, AllowGroups, DenyGroups===&lt;br /&gt;
&lt;br /&gt;
These options control which users and groups are allowed or denied access to the SSH server. They provide a way to manage access control based on usernames and group membership.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;: Specifies a list of users allowed to access the SSH server. Other users will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowUsers user1 user2 user3&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;: Specifies a list of users denied access to the SSH server. Other users will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyUsers user4 user5&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;: Specifies a list of groups whose members are allowed to access the SSH server. Users not belonging to these groups will be denied access.&lt;br /&gt;
&amp;lt;code&amp;gt;AllowGroups group1 group2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;: Specifies a list of groups whose members are denied access to the SSH server. Users not belonging to these groups will be allowed access.&lt;br /&gt;
&amp;lt;code&amp;gt;DenyGroups group3 group4&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the order in which these options are applied is &#039;&#039;&#039;DenyUsers&#039;&#039;&#039;, &#039;&#039;&#039;AllowUsers&#039;&#039;&#039;, &#039;&#039;&#039;DenyGroups&#039;&#039;&#039;, and finally &#039;&#039;&#039;AllowGroups&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Banner===&lt;br /&gt;
&lt;br /&gt;
The Banner option allows you to display a message or warning to users before they log in to the SSH server. This is often used to display legal notices, security warnings, or other important information.&lt;br /&gt;
&lt;br /&gt;
To enable the banner, set the Banner option to the path of a text file containing the message you want to display:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Banner /etc/ssh/banner.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create the /etc/ssh/banner.txt file and add your desired message. The content of this file will be displayed to users before they log in.&lt;br /&gt;
&lt;br /&gt;
==Advanced sshd_config Options==&lt;br /&gt;
=== PermitTunnel===&lt;br /&gt;
The PermitTunnel option enables or disables the use of SSH tunneling. Tunnels can be used to forward ports or create VPN-like connections between the client and the server. &lt;br /&gt;
* There are four possible values for this option:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;yes&amp;quot;&#039;&#039;&#039;: Allows all types of tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;point-to-point&amp;quot;&#039;&#039;&#039;: Allows only point-to-point (Layer 3) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;ethernet&amp;quot;&#039;&#039;&#039;: Allows only Ethernet (Layer 2) tunnels.&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;&amp;quot;no&amp;quot;&#039;&#039;&#039;: Disables tunneling (default).&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable tunneling, set the PermitTunnel option in the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PermitTunnel yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Keep in mind that enabling tunnels may expose your server to additional security risks. Only enable this option if you understand the implications and have a specific use case that requires it.&lt;br /&gt;
&lt;br /&gt;
=== ChrootDirectory===&lt;br /&gt;
The ChrootDirectory option allows you to restrict a user or a group to a specific directory (known as a chroot jail) when they log in via SSH. This can enhance security by isolating users and limiting their access to only the necessary parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
To set up a chroot jail, follow these steps:&lt;br /&gt;
&lt;br /&gt;
Create a directory that will serve as the chroot jail. For example, let&#039;s create a directory for user1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo mkdir /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change the ownership of the directory to the user and their primary group:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo chown user1:user1 /home/user1/chroot&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ChrootDirectory for user1:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ChrootDirectory /home/user1/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, they will be restricted to the /home/user1/chroot directory and won&#039;t be able to access other parts of the filesystem.&lt;br /&gt;
&lt;br /&gt;
Note that the chroot jail should be owned by root and not writable by the user. If you need to provide write access to specific directories, create subdirectories inside the chroot jail and set appropriate permissions for those. Also, some features like SFTP may require additional configuration within the chroot jail.&lt;br /&gt;
&lt;br /&gt;
===ForceCommand===&lt;br /&gt;
The ForceCommand option allows you to specify a command that will be executed when a user logs in via SSH, regardless of the command requested by the user. This can be useful for limiting the actions a user can perform or for automatically running specific tasks upon login.&lt;br /&gt;
&lt;br /&gt;
To use the ForceCommand option, follow these steps:&lt;br /&gt;
&lt;br /&gt;
In the sshd_config file, add a Match block at the end of the file to specify the ForceCommand for a specific user or group. For example, to force user1 to execute the command /usr/bin/my-command upon login:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  ForceCommand /usr/bin/my-command&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server to apply the changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, when user1 logs in via SSH, the /usr/bin/my-command will be executed automatically, and they will not be able to run any other command.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that using ForceCommand may limit the user&#039;s ability to interact with the server or transfer files via SFTP. Make sure to test and verify the functionality for your specific use case.&lt;br /&gt;
&lt;br /&gt;
=== Match Blocks===&lt;br /&gt;
&lt;br /&gt;
Match blocks in the sshd_config file allow you to apply specific configuration options based on certain criteria, such as the user, group, address, or host. This enables you to create custom rules and settings for different users, groups, or connections.&lt;br /&gt;
&lt;br /&gt;
Match block syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match criteria&lt;br /&gt;
  Option value&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here are some examples of Match blocks and their usage:&lt;br /&gt;
&lt;br /&gt;
Apply settings only for a specific user:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
  AllowTcpForwarding yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication and enables TCP forwarding only for user1.&lt;br /&gt;
&lt;br /&gt;
Apply settings for multiple users:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1,user2&lt;br /&gt;
  ChrootDirectory /home/%u/chroot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration sets the chroot directory for both user1 and user2.&lt;br /&gt;
&lt;br /&gt;
Apply settings for a specific group:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Group group1&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration enables password authentication only for members of group1.&lt;br /&gt;
&lt;br /&gt;
Apply settings based on the client&#039;s IP address:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication no&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This configuration disables password authentication for clients connecting from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Combine multiple criteria:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Match User user1 Address 192.168.1.0/24&lt;br /&gt;
  PasswordAuthentication yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This configuration enables password authentication only for user1 when they connect from the 192.168.1.0/24 subnet.&lt;br /&gt;
&lt;br /&gt;
Remember to restart the SSH server after making changes to the sshd_config file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Match blocks offer flexibility in customizing your SSH server&#039;s configuration based on various criteria. Use them wisely to enhance security and optimize your server&#039;s settings.&lt;br /&gt;
&lt;br /&gt;
==Best Practices and Tips &#039;&#039;&#039;sshd_config&#039;&#039;&#039;==&lt;br /&gt;
When configuring your &#039;&#039;&#039;sshd_config&#039;&#039;&#039; file, it&#039;s essential to follow best practices to ensure the security and stability of your SSH server. Here are some recommendations and tips:&lt;br /&gt;
&lt;br /&gt;
:*   Keep the server up-to-date: Always update your SSH server software and the underlying operating system to ensure you have the latest security patches and features.&lt;br /&gt;
&lt;br /&gt;
:*    Use strong authentication: Enable key-based authentication (PubkeyAuthentication) and consider disabling password authentication (PasswordAuthentication) to reduce the risk of brute-force attacks.&lt;br /&gt;
&lt;br /&gt;
:*    Limit root access: Set &amp;quot;PermitRootLogin&amp;quot; to &amp;quot;no&amp;quot; or &amp;quot;without-password&amp;quot; to prevent direct root login or require key-based authentication for root.&lt;br /&gt;
&lt;br /&gt;
:*    Use non-standard ports: Change the default SSH port (22) to a non-standard port to reduce the exposure to automated scans and attacks. Keep in mind this is security through obscurity and should be combined with other security measures.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Restrict user access&#039;&#039;&#039;: Use &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; and &amp;quot;DenyGroups&amp;quot; options to control which users and groups can access the SSH server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Monitor logs&#039;&#039;&#039;: Regularly check your SSH server logs for any suspicious activity or failed login attempts. Adjust the &amp;quot;LogLevel&amp;quot; setting in sshd_config as needed.&lt;br /&gt;
* Default Log Path Ubuntu 22.04: &#039;&#039;&#039;/var/log/auth.log&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use chroot jails&#039;&#039;&#039;: Isolate users by creating chroot jails using the &amp;quot;ChrootDirectory&amp;quot; option, especially when providing SFTP access or when users don&#039;t require full access to the server.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Configure connection settings&#039;&#039;&#039;: Set appropriate values for &amp;quot;LoginGraceTime&amp;quot; and &amp;quot;MaxAuthTries&amp;quot; to limit the time allowed for successful login and the number of authentication attempts per connection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use a strong firewall&#039;&#039;&#039;: Configure your server&#039;s firewall to only allow SSH connections from trusted IP addresses or networks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Regularly review and audit&#039;&#039;&#039;: Periodically review your sshd_config settings and make adjustments as necessary. Keep up-to-date with SSH security best practices and recommendations.&lt;br /&gt;
&lt;br /&gt;
By following these best practices and tips, you can enhance the security and performance of your SSH server, protecting it from unauthorized access and potential attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting sshd_config Issues===&lt;br /&gt;
&lt;br /&gt;
When encountering problems with your SSH server configuration, it&#039;s important to know how to diagnose and resolve issues. Here are some common problems and troubleshooting steps:&lt;br /&gt;
&lt;br /&gt;
Check syntax and configuration errors: If the SSH server is not starting or not functioning as expected, check the sshd_config file for any syntax or configuration errors. Use the following command to test the configuration file for errors:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sshd -t&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If there are any issues, the command will provide error messages with information on what needs to be fixed.&lt;br /&gt;
&lt;br /&gt;
Review log files: Inspect the SSH server log files for any error messages or relevant information. The location of the log files may vary depending on your system, but common locations are /var/log/auth.log or /var/log/secure. Tail the log file while attempting to connect to get real-time information:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo tail -f /var/log/auth.log&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart the SSH server&lt;br /&gt;
&lt;br /&gt;
Check firewall settings: Ensure that the server&#039;s firewall is allowing SSH connections on the correct port. If you changed the default SSH port, update your firewall rules accordingly.&lt;br /&gt;
&lt;br /&gt;
Verify user permissions: If a specific user is unable to connect, check the user&#039;s permissions, home directory, and the settings in the sshd_config file, such as &amp;quot;AllowUsers,&amp;quot; &amp;quot;DenyUsers,&amp;quot; &amp;quot;AllowGroups,&amp;quot; or &amp;quot;DenyGroups.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SSH server from a client, use the verbose mode to get more detailed information about the connection process. This can help identify any issues with authentication or configuration. Run the following command to enable verbose mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -v user@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;quot;user@example.com&amp;quot; with the appropriate username and server address. You can increase the verbosity level by adding more &amp;quot;v&amp;quot; characters (e.g., -vv or -vvv) if needed.&lt;br /&gt;
&lt;br /&gt;
Check file permissions: Ensure that the file permissions for the user&#039;s home directory, the .ssh directory, and the authorized_keys file are set correctly. The user&#039;s home directory should not be writable by other users, the .ssh directory should have permissions set to 700 (drwx------), and the authorized_keys file should have permissions set to 600 (-rw-------).&lt;br /&gt;
&lt;br /&gt;
Test network connectivity: If you&#039;re unable to connect to the SSH server, verify that you can reach the server on the network. Use tools like ping, traceroute, or telnet to check the connection to the server and the specific SSH port.&lt;br /&gt;
&lt;br /&gt;
By following these troubleshooting steps, you should be able to diagnose and resolve most issues related to the sshd_config file and the SSH server configuration. Remember to carefully review the settings in your sshd_config file and consult the server logs for additional information when encountering problems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====After making changes, restart the SSH server:====&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running commands on a remote server==&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve connected to a remote server using SSH, you can execute commands on the remote machine just as you would on your local system. However, you can also run commands on a remote server without establishing an interactive SSH session. &lt;br /&gt;
&lt;br /&gt;
This can be useful for automation, scripting, or quick tasks. Here&#039;s how to do it:&lt;br /&gt;
&lt;br /&gt;
Use the SSH command: To run a command on a remote server without entering an interactive session, use the following syntax:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh username@hostname_or_IP -p port &#039;command&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, port with the SSH port number (if different from the default 22), and command with the command you want to execute.&lt;br /&gt;
&lt;br /&gt;
For example, to list the contents of the remote server&#039;s home directory, you can use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 22 &#039;ls -la&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Handling multiple commands===&lt;br /&gt;
If you need to execute multiple commands, you can chain them together using a &#039;&#039;&#039;semicolon&#039;&#039;&#039; or &#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
The semicolon allows you to run multiple commands sequentially, while the &amp;amp;&amp;amp; operator runs the next command only if the previous command was successful.&lt;br /&gt;
&lt;br /&gt;
For example, to update the package list and then upgrade the packages on a remote Ubuntu server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh john@example.com -p 2222 &#039;sudo apt-get update; sudo apt-get upgrade -y&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Command output:&lt;br /&gt;
The output of the command will be displayed in your local terminal, just as if you were running the command on your local machine. Using key-based authentication&lt;br /&gt;
&lt;br /&gt;
==Transferring files with SCP==&lt;br /&gt;
&lt;br /&gt;
The Secure Copy Protocol (SCP) is a useful tool for transferring files between your local machine and a remote server using SSH. SCP ensures that the data is encrypted during transit, providing a secure and efficient way to transfer files.&lt;br /&gt;
&lt;br /&gt;
===Install an SCP client=== &lt;br /&gt;
&lt;br /&gt;
Most Unix-based systems, including Linux and macOS, have an SCP client pre-installed. For Windows, you can use the built-in SCP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from your local machine to a remote server===&lt;br /&gt;
&lt;br /&gt;
To copy a file from your local machine to a remote server, use the following command:&lt;br /&gt;
* Note the use of the upper case &#039;&#039;&#039;-P&#039;&#039;&#039; for ports with &#039;&#039;&#039;scp&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port local_file_path username@hostname_or_IP:remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), local_file_path with the path to the file on your local machine, username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, and remote_file_path with the desired location on the remote server.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 22 /home/john/documents/report.pdf john@example.com:/home/john/reports/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the local machine to the &amp;quot;reports&amp;quot; directory on the remote server.&lt;br /&gt;
&lt;br /&gt;
===Transfer a file from a remote server to your local machine===&lt;br /&gt;
To copy a file from a remote server to your local machine, use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P port username@hostname_or_IP:remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, hostname_or_IP with the server&#039;s hostname or IP address, remote_file_path with the path to the file on the remote server, and local_file_path with the desired location on your local machine.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -P 2222 john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
: Or&lt;br /&gt;
&amp;lt;code&amp;gt;scp john@example.com:/home/john/reports/report.pdf /home/john/documents/&amp;lt;/code&amp;gt;-&lt;br /&gt;
&lt;br /&gt;
This command will copy the &amp;quot;report.pdf&amp;quot; file from the remote server&#039;s &amp;quot;reports&amp;quot; directory to the &amp;quot;documents&amp;quot; directory on your local machine.&lt;br /&gt;
&lt;br /&gt;
===Transferring directories=== &lt;br /&gt;
&lt;br /&gt;
To transfer an entire directory, use the &#039;&#039;&#039;-r&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port local_directory_path username@hostname_or_IP:remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, to copy a directory from the remote server to your local machine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -r -P port username@hostname_or_IP:remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using SCP is a convenient and secure way to transfer files between your local machine and a remote server. It leverages the security of the SSH protocol to ensure that your data remains encrypted during transit.&lt;br /&gt;
&lt;br /&gt;
===Transferring from Remote Computer to Remote Computer===&lt;br /&gt;
&lt;br /&gt;
Copy the file &#039;&#039;&#039;stuff.txt&#039;&#039;&#039; from remote host &#039;&#039;&#039;12.34.56.67&#039;&#039;&#039; to host &#039;&#039;&#039;11.22.33.44&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.67:/home/user/Documents/stuff.txt name@11.22.33.44:/home/user/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;&#039;-3&#039;&#039;&#039; flag copies between two remote hosts &amp;quot;12.34.56.67&amp;quot; and &amp;quot;11.22.33.44&amp;quot; are transferred through the local host running the command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp -3 name@12.34.56.67:/home/user/Documents/stuff.txt \ name@11.22.33.44:/home/user/Documents/ &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Transferring multiple files===&lt;br /&gt;
&lt;br /&gt;
Send files foo.txt and bar.txt to remote.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp foo.txt bar.txt user@12.34.56.78:~/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from remote &amp;quot;Documents&amp;quot; directory to local &amp;quot;Documents&amp;quot; directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp user@11.22.33.44:/home/user/Documents/\{todo_list.txt,links.txt,stuff.txt\} /home/$USER/Documents/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Copy multiple files from the remote to local current directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;scp name@12.34.56.78:~/\{README.md,.bashrc\} . &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Transferring files with SFTP==&lt;br /&gt;
The SSH File Transfer Protocol (SFTP) is another method for transferring files securely between your local machine and a remote server. Unlike SCP, SFTP provides an interactive interface that allows you to navigate, upload, and download files more easily.&lt;br /&gt;
&lt;br /&gt;
Install an SFTP client: Most Unix-based systems, including Linux and macOS, have an SFTP client pre-installed. For Windows, you can use the built-in SFTP client included with the OpenSSH package (available in Windows 10 and later) or a third-party client like WinSCP or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Connect to a remote server: To start an SFTP session with a remote server, open a terminal or command prompt on your local machine and use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace port with the SSH port number (if different from the default 22), username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sftp -P 22 john@example.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Navigate the remote filesystem: Once connected, you can use commands similar to those available in a Unix shell to navigate the remote server&#039;s filesystem. Some common SFTP commands include:&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;ls&#039;&#039;&#039;: List files and directories&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;cd&#039;&#039;&#039;: Change the current directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;mkdir&#039;&#039;&#039;: Create a new directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rmdir&#039;&#039;&#039;: Remove an empty directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;get&#039;&#039;&#039;: Download a file from the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;put&#039;&#039;&#039;: Upload a file to the remote server&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rm&#039;&#039;&#039;: Remove a file&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;rename&#039;&#039;&#039;: Rename a file or directory&amp;lt;br&amp;gt;&lt;br /&gt;
: &#039;&#039;&#039;exit&#039;&#039;&#039;: Exit the SFTP session&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Transfer files: To transfer files, use the put command to upload a file from your local machine to the remote server, and the get command to download a file from the remote server to your local machine. For example:&lt;br /&gt;
&lt;br /&gt;
Upload a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put local_file_path remote_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get remote_file_path local_file_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_file_path and remote_file_path with the appropriate paths for the files you want to transfer.&lt;br /&gt;
&lt;br /&gt;
Transferring directories: To transfer entire directories, use the -r flag with the put and get commands:&lt;br /&gt;
&lt;br /&gt;
Upload a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;put -r local_directory_path remote_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Download a directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;get -r remote_directory_path local_directory_path&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Disconnect from the remote server: When you&#039;ve finished transferring files, type exit to close the SFTP session.&lt;br /&gt;
&lt;br /&gt;
SFTP offers a more user-friendly, interactive experience for transferring files compared to SCP. By utilizing the secure and encrypted SSH protocol, SFTP ensures that your data remains safe during transfer.&lt;br /&gt;
&lt;br /&gt;
==Advanced SSH Techniques==&lt;br /&gt;
=== Port forwarding and tunneling===&lt;br /&gt;
&lt;br /&gt;
SSH port forwarding and tunneling allow you to securely forward network traffic between your local machine and a remote server. This can be useful for accessing remote services, bypassing firewalls, or securely transmitting sensitive data.&lt;br /&gt;
&lt;br /&gt;
Local Port Forwarding: Local port forwarding creates a secure tunnel between your local machine and a remote server, allowing you to access remote services as if they were running on your local machine. To set up local port forwarding, use the -L flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -L local_port:remote_host:remote_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace local_port with an available port on your local machine, remote_host with the hostname or IP address of the remote server hosting the service, remote_port with the port number of the remote service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
Remote Port Forwarding: Remote port forwarding enables you to expose a local service running on your machine to a remote network. To set up remote port forwarding, use the -R flag with the SSH command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -R remote_port:local_host:local_port username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace remote_port with an available port on the remote server, local_host with the hostname or IP address of the local machine hosting the service, local_port with the port number of the local service, username with your username on the remote server, and hostname_or_IP with the server&#039;s hostname or IP address.&lt;br /&gt;
&lt;br /&gt;
:**Forwarding X, Sound, and Video on Ubuntu 22.04 with Ubuntu 22.04 LXC**: To forward X, sound, and video from a remote Ubuntu 22.04 server to your local Ubuntu 22.04 machine, you&#039;ll need to enable X11 forwarding and install the necessary packages.&lt;br /&gt;
&lt;br /&gt;
:*    Install required packages: On both your local machine and the remote server, install the x11-apps and pulseaudio packages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt update&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install x11-apps pulseaudio&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Enable X11 forwarding: To enable X11 forwarding, you&#039;ll need to edit the SSH server configuration file (/etc/ssh/sshd_config) on the remote server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nano /etc/ssh/sshd_config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find the line containing &amp;quot;X11Forwarding&amp;quot; and set its value to &amp;quot;yes&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;X11Forwarding yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the line is commented out (i.e., it starts with a &#039;#&#039;), remove the &#039;#&#039; symbol. Save your changes and exit the text editor.&lt;br /&gt;
&lt;br /&gt;
:*    Restart the SSH server: Apply the changes by restarting the SSH server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo systemctl restart ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Connect with X11 forwarding: From your local machine, use the -X flag to enable X11 forwarding when connecting to the remote server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh -X username@hostname_or_IP&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    Export PULSE_SERVER environment variable: On the remote server, export the PULSE_SERVER environment variable to forward sound:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;export PULSE_SERVER=tcp:localhost&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add this line to the remote user&#039;s ~/.bashrc or ~/.profile file to make the change permanent.&lt;br /&gt;
&lt;br /&gt;
:*    Run applications: Now, you can run graphical applications on the remote server, and they will be displayed on your local machine with sound and video forwarded.&lt;br /&gt;
&lt;br /&gt;
Please note that forwarding X, sound, and video might cause increased latency and reduced performance compared to running the applications locally.&lt;br /&gt;
&lt;br /&gt;
=== SSH agent forwarding===&lt;br /&gt;
SSH agent forwarding is a powerful feature that allows you to use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers. This is particularly useful when you need to access one remote server (Server B) through another remote server (Server A).&lt;br /&gt;
&lt;br /&gt;
====    Start the SSH agent on your local machine ====&lt;br /&gt;
&lt;br /&gt;
Before you enable SSH agent forwarding, you need to start the SSH agent on your local machine. Open a terminal and run the following command:&lt;br /&gt;
&lt;br /&gt;
:* For Linux and macOS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval &amp;quot;$(ssh-agent -s)&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Windows (Git Bash or Cygwin):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eval $(ssh-agent)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command starts the SSH agent and sets the required environment variables.&lt;br /&gt;
&lt;br /&gt;
====Add your SSH key to the agent====&lt;br /&gt;
&lt;br /&gt;
Next, add your private key to the SSH agent with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-add ~/.ssh/your_private_key&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_private_key&#039;&#039;&#039; with the filename of your private key. This might be &#039;&#039;&#039;id_rsa&#039;&#039;&#039;, &#039;&#039;&#039;id_ed25519&#039;&#039;&#039;, or another key file depending on your setup.&lt;br /&gt;
&lt;br /&gt;
====Configure SSH agent forwarding on your local machine====&lt;br /&gt;
&lt;br /&gt;
Edit your SSH config file to enable agent forwarding. The config file is usually located at &#039;&#039;&#039;~/.ssh/config&#039;&#039;&#039;. If the file doesn&#039;t exist, create it.&lt;br /&gt;
&lt;br /&gt;
Add the following lines to the config file: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Host server_a_alias&lt;br /&gt;
  HostName server_a_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_a&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&lt;br /&gt;
Host server_b_alias&lt;br /&gt;
  HostName server_b_ip_or_hostname&lt;br /&gt;
  User your_username_on_server_b&lt;br /&gt;
  ForwardAgent yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &lt;br /&gt;
:* &#039;&#039;&#039;server_a_alias&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039; server_a_ip_or_hostname&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_a&#039;&#039;&#039;&lt;br /&gt;
:* &#039;&#039;&#039;server_b_alias&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;server_b_ip_or_hostname&#039;&#039;&#039; &lt;br /&gt;
:* &#039;&#039;&#039;your_username_on_server_b&#039;&#039;&#039; &lt;br /&gt;
with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Make sure your public key is added to the remote servers====&lt;br /&gt;
&lt;br /&gt;
Before you can use SSH agent forwarding, you need to add your public key to the &#039;&#039;&#039;~/.ssh/authorized_keys&#039;&#039;&#039; file on both Server A and Server B. If you haven&#039;t done this already, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh-copy-id -i ~/.ssh/your_public_key user@server_ip_or_hostname&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &#039;&#039;&#039;your_public_key&#039;&#039;&#039;, &#039;&#039;&#039;user&#039;&#039;&#039;, and &#039;&#039;&#039;server_ip_or_hostname&#039;&#039;&#039; with the appropriate values.&lt;br /&gt;
&lt;br /&gt;
====Test SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
First, SSH into Server A:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_a_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from Server A, SSH into Server B:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ssh server_b_alias&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything is set up correctly, you should be able to access Server B without being prompted for a password.&lt;br /&gt;
&lt;br /&gt;
====Verify SSH agent forwarding====&lt;br /&gt;
&lt;br /&gt;
To make sure that SSH agent forwarding is working, you can check the value of the &#039;&#039;&#039;SSH_AUTH_SOCK&#039;&#039;&#039; environment variable on Server B.&lt;br /&gt;
&lt;br /&gt;
From Server B, run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;echo $SSH_AUTH_SOCK&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If SSH agent forwarding is working, this command should return a non-empty value.&lt;br /&gt;
&lt;br /&gt;
That&#039;s it! You&#039;ve successfully set up and tested SSH agent forwarding. Now you can use your local SSH keys to authenticate with remote servers without having to copy your private keys to those servers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Command Restriction===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file can be used to restrict the commands that a specific SSH key can execute. This is especially useful for security purposes, to limit the potential damage that could be done if a key is compromised.&lt;br /&gt;
&lt;br /&gt;
By including a &#039;&#039;&#039;command=&#039;&#039;&#039; directive in the &#039;&#039;&#039;authorized_keys&#039;&#039;&#039; file, you can specify the exact command that will be run when a client connects using the associated key. Any command provided by the client will be ignored, and the command specified in the authorized_keys file will be used instead.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
is set up to always execute the &#039;&#039;&#039;scp&#039;&#039;&#039; command (used for secure copy of files over SSH) to the specified directory, no matter what command was originally issued by the client. This is a good way to create a &amp;quot;write-only&amp;quot; drop box, for instance.&lt;br /&gt;
&lt;br /&gt;
However, the keyholder could potentially still execute arbitrary commands by carefully crafting the file names they upload, so additional precautions should be taken, such as using command= along with other directives like &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039;, &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039;, and &#039;&#039;&#039;no-pty&#039;&#039;&#039; to further limit what can be done with the key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;,no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This entry does the following:&lt;br /&gt;
&lt;br /&gt;
:*    The &#039;&#039;&#039;command=&#039;&#039;&#039; directive runs the specified command when a client connects using this key. In this case, the command is scp, which securely copies files to the /home/rscp/media/ directory.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-port-forwarding&#039;&#039;&#039; directive prevents the client from using SSH&#039;s port forwarding features, which could potentially be used to create a secure tunnel for other network traffic.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-X11-forwarding&#039;&#039;&#039; directive prevents the client from forwarding X11 graphical sessions, which could be used to run graphical applications over the SSH connection.&lt;br /&gt;
:*    The &#039;&#039;&#039;no-pty&#039;&#039;&#039; directive prevents the allocation of a pseudo-terminal, which means the client can&#039;t interact with a shell or run interactive commands.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039; part is the public key of the client. Replace this with the actual key.&lt;br /&gt;
&lt;br /&gt;
This configuration significantly limits the operations that can be performed with this key, providing an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
====SCP Only====&lt;br /&gt;
&lt;br /&gt;
Use Case Example: Have a Server hosting XML Dumps, and want to automate sending a file or directory from Server1 to Server2 using a script and ssh-key so i don&#039;t need to enter password. &lt;br /&gt;
&lt;br /&gt;
=====Create Account on Server=====&lt;br /&gt;
Create user account you are going to use:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;adduser rscp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make sure user has a &#039;&#039;&#039;.ssh&#039;&#039;&#039; directory to send public key to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make a Directory to transfer files to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: If you see error &amp;lt;code&amp;gt;scp: /home/rscp/media/test.txt: Permission denied&amp;lt;/code&amp;gt; If you created directory &#039;&#039;&#039;media&#039;&#039;&#039; when logged in as &#039;&#039;&#039;root&#039;&#039;&#039; then check directory permissions and if need [[Linux_Users_and_Groups#File_Ownership_and_Permissions|assign ownership to &#039;&#039;&#039;user&#039;&#039;&#039; account.]]&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;code&amp;gt;chown rscp:rscp /home/rscp/media&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Ubuntu_22.04_SSH_Guide#Copying_public_keys_to_the_remote_server|Send your public key to server]]&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If from remote server you are sending a Directory include the &#039;&#039;&#039;-r&#039;&#039;&#039; flag in command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After public_key/authorized_key is on server, edit authorized_keys and at the start before ssh-rsa &amp;lt;KEY&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
command=&amp;quot;/usr/bin/scp -t -r /home/rscp/media/&amp;quot;  ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This entry in the authorized_keys file uses the command option to restrict the SSH command that can be run with the associated SSH key. The command option specifies that the scp command should be used to transfer files to the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory on the server.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a breakdown of the entry:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;command=&amp;quot;/usr/bin/scp -t /home/rscp/&amp;quot;&#039;&#039;&#039;: This specifies that the scp command should be used as the SSH command for this key, with the &#039;&#039;&#039;-t&#039;&#039;&#039; option to specify that the remote end is a file (in this case, a directory), and the destination directory on the server is /home/rscp/. This means that the user can only use the SSH key to transfer files to the /home/rscp/ directory on the server.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...&#039;&#039;&#039;: This is the public key associated with the private key that is used for authentication.&lt;br /&gt;
&lt;br /&gt;
By using the command option in this way, you can restrict the actions that the user can perform with the SSH key, which can help to improve security. In this case, the user can only transfer files to the specified directory on the server using the scp command.&lt;br /&gt;
&lt;br /&gt;
======Tip - transfer file to a path your USER does not have permissions for======&lt;br /&gt;
&lt;br /&gt;
You can write a shell script to check the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory every minute using a while loop and the sleep command. If any files are found in the directory, the script can move them to the &#039;&#039;&#039;/var/www/media&#039;&#039;&#039; directory using the mv command. Here&#039;s an example script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
while true&lt;br /&gt;
do&lt;br /&gt;
  if [ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]; then&lt;br /&gt;
    mv /home/rscp/media/* /var/www/media/&lt;br /&gt;
  fi&lt;br /&gt;
  sleep 60&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this script, the while loop runs indefinitely (&#039;&#039;&#039;while true&#039;&#039;&#039;) and sleeps for 60 seconds at the end of each iteration (&#039;&#039;&#039;sleep 60&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;if&#039;&#039;&#039; statement checks if the &#039;&#039;&#039;/home/rscp/media&#039;&#039;&#039; directory is not empty (&#039;&#039;&#039;[ &amp;quot;$(ls -A /home/rscp/media/)&amp;quot; ]&#039;&#039;&#039;). If it is not empty, the &#039;&#039;&#039;mv&#039;&#039;&#039; command is used to move all files and directories from the &#039;&#039;&#039;/home/rscp/media/&#039;&#039;&#039; directory to the &#039;&#039;&#039;/var/www/media/&#039;&#039;&#039; directory.&lt;br /&gt;
&lt;br /&gt;
Save this script to a file (e.g. &#039;&#039;&#039;move-files.sh&#039;&#039;&#039;) and make it executable using the &#039;&#039;&#039;chmod +x move-files.sh&#039;&#039;&#039; command. You can then run the script using &#039;&#039;&#039;./move-files.sh &amp;amp;&#039;&#039;&#039; to start it in the background and allow it to run indefinitely. The &amp;amp; symbol is used to run the script in the background so that you can continue using the terminal.&lt;br /&gt;
&lt;br /&gt;
Note that running this script indefinitely can consume system resources, so you may want to consider setting up a scheduled task (e.g. using &#039;&#039;&#039;[[Cron_ubuntu_22.04|cron]]&#039;&#039;&#039;) to run the script at a specific interval instead of running it indefinitely.&lt;br /&gt;
&lt;br /&gt;
==Tilde &#039;&#039;&#039;~&#039;&#039;&#039; the escape character==&lt;br /&gt;
&lt;br /&gt;
The tilde (~) character has a special meaning in the context of SSH. When using SSH, you can use the tilde character followed by a control sequence to perform certain actions. These are called &amp;quot;tilde escape sequences&amp;quot; or &amp;quot;tilde commands.&amp;quot; They are useful for managing your SSH connections.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to use tilde escape sequences when connected to a remote server via SSH:&lt;br /&gt;
&lt;br /&gt;
:*    Make sure you are at the beginning of a new line in your terminal. Press &#039;&#039;&#039;Enter&#039;&#039;&#039; if you are not.&lt;br /&gt;
&lt;br /&gt;
:*    Type the tilde (~) character, followed by the appropriate control sequence. Note that you should not press &#039;&#039;&#039;Enter&#039;&#039;&#039; after typing the tilde character, but rather type the control sequence directly after it.&lt;br /&gt;
&lt;br /&gt;
Here are some common tilde escape sequences:&lt;br /&gt;
&lt;br /&gt;
:    &#039;&#039;&#039;~.&#039;&#039;&#039; : Close the SSH connection. This can be helpful if the connection is frozen or unresponsive.&lt;br /&gt;
:    &#039;&#039;&#039;~^Z&#039;&#039;&#039; : Suspend the SSH connection and return to your local shell. You can later resume the connection using the fg command.&lt;br /&gt;
:    &#039;&#039;&#039;~#&#039;&#039;&#039; : List all forwarded connections (both local and remote) that are active in the current SSH session.&lt;br /&gt;
:    &#039;&#039;&#039;~&amp;amp;&#039;&#039;&#039; : Run the SSH session in the background. This is useful if you want to perform other tasks on your local machine without closing the SSH connection.&lt;br /&gt;
:    &#039;&#039;&#039;~~&#039;&#039;&#039; : Send a literal tilde character to the remote system. This is useful if you need to type a tilde character in the remote system without triggering an escape sequence.&lt;br /&gt;
&lt;br /&gt;
Remember that these escape sequences only work if they are entered at the beginning of a new line in your terminal. If you&#039;re typing them in the middle of a command or text, they won&#039;t be recognized as special control sequences.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting and Best Practices==&lt;br /&gt;
&lt;br /&gt;
In this section, we&#039;ll cover some common issues and best practices related to SSH connections, including managing a large number of SSH keys.&lt;br /&gt;
&lt;br /&gt;
===Too many authentication attempts===&lt;br /&gt;
&lt;br /&gt;
When connecting to an SSH server, you might encounter the &amp;quot;Too many authentication attempts&amp;quot; error. This is often caused by having too many private keys in your ~/.ssh directory. By default, SSH tries each key until it finds the correct one, but many servers limit the number of authentication attempts.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;: To resolve this issue, you can create a separate directory for your keys and configure the SSH config file to use the appropriate key for each connection.&lt;br /&gt;
&lt;br /&gt;
:*    Create a new directory for your keys:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir ~/.ssh/keys&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:* Move your private key files to the new directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mv ~/.ssh/id_rsa_* ~/.ssh/keys/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update your SSH config file to specify the correct key for each connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    Host server1&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server1&lt;br /&gt;
&lt;br /&gt;
    Host server2&lt;br /&gt;
      ...&lt;br /&gt;
      IdentityFile ~/.ssh/keys/id_rsa_server2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permission issues=== &lt;br /&gt;
&lt;br /&gt;
SSH is very strict about file and directory permissions. Ensure that your ~/.ssh directory and its contents have the correct permissions:&lt;br /&gt;
&lt;br /&gt;
:*    The ~/.ssh directory should have permissions set to 700:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 700 ~/.ssh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Private key files should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/id_rsa&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ~/.ssh/config file should have permissions set to 600:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chmod 600 ~/.ssh/config&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:*    &amp;lt;b&amp;gt;Best practices&amp;lt;/b&amp;gt;: Follow these best practices to maintain secure and efficient SSH connections:&lt;br /&gt;
&lt;br /&gt;
:*    Use SSH key pairs instead of passwords for authentication, as they provide better security.&lt;br /&gt;
:*    Regularly update your SSH keys to maintain their security.&lt;br /&gt;
:*    Use strong, unique passphrases to protect your private keys.&lt;br /&gt;
:*    Disable password authentication and root login on your SSH server to reduce the risk of brute-force attacks.&lt;br /&gt;
:*    Regularly update your SSH server software to ensure you&#039;re running the latest security patches.&lt;br /&gt;
:*    Use non-standard port numbers for your SSH server to make it less likely to be targeted by automated attacks.&lt;br /&gt;
:*    Implement multi-factor authentication (MFA) for your SSH connections, if possible.&lt;br /&gt;
:*    Regularly review and remove any unnecessary authorized keys from the ~/.ssh/authorized_keys file on your servers.&lt;br /&gt;
:*    Use the Match directive in the sshd_config file to apply custom rules and settings for different users, groups, or connections.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=430</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=430"/>
		<updated>2023-05-11T20:11:31Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Site is Currently under going some changes&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Page links might be broken while we restructure page titles and content, before carrying on with content creation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Welcome to CompleteNoobs=&lt;br /&gt;
&#039;&#039;A community-driven resource for computer science enthusiasts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: At present, direct signups are disabled due to bot activity. To create an account on the wiki, please request an account and message user CompleteNoobs on Reddit. Your patience is appreciated as we may not be online all the time.&lt;br /&gt;
&lt;br /&gt;
==We All Start as Noobs==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Greetings, fellow Noobs.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs is currently in its concept stage, and we are learning as we go. Use the resources provided at your own risk.&lt;br /&gt;
&lt;br /&gt;
Our mission is to make computer science free, open, and reproducible for hobbyists, sysadmins, teachers, students, and anyone interested in the field. CompleteNoobs is a platform to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips acquired along the way, under a Libre License that ensures the following freedoms:&lt;br /&gt;
&lt;br /&gt;
:*    Read&lt;br /&gt;
:*    Edit/Modify&lt;br /&gt;
:*    Copy&lt;br /&gt;
:*    Share freely&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Content licensed under &#039;&#039;&#039;CC BY-NC-SA&#039;&#039;&#039; can be hosted on the non-commercial fork: https://www.completenoobz.com&lt;br /&gt;
&lt;br /&gt;
The only proprietary aspects of this site are the domain and the trademark &#039;CompleteNoobs&#039;. All content is available for download as an XML file at https://xml.completenoobs.com and is Libre licensed for everyone to use.&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmPyUVTQa7gk8kueAnjNDtEReKZ8NnwvFLWv66aCVrq4dy&lt;br /&gt;
&lt;br /&gt;
==Get Involved==&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project, download it, and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
:* [[Host_Your_Own_Mediawiki_Online|Host Your Own Mediawiki Online]]&lt;br /&gt;
&lt;br /&gt;
:* [[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
===Feed Back Received===&lt;br /&gt;
&lt;br /&gt;
*    Clearly indicate the terminal where commands should be entered&lt;br /&gt;
*    Break down content into smaller sections or modules&lt;br /&gt;
*    Provide timestamps in videos for each executed command or step&lt;br /&gt;
*    Organize steps/modules using numbers, and sub-steps within modules using letters (a, b, c, etc.)&lt;br /&gt;
*    Create shorter, focused videos for each step to avoid excessive scrolling&lt;br /&gt;
*    Clarify the use of terminal editors and how to set the $EDITOR variable&lt;br /&gt;
*    Place the EDITOR section at the top of the page and link to nano and vi guide pages&lt;br /&gt;
*    Include instructions on how to verify the completion of each step correctly&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Title Syntax: Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&lt;br /&gt;
Due to varying configurations and builds of apps/programs across different OS versions, step-by-step tutorials can be challenging to follow. To improve navigation, adjust page titles to include both the OS version/name and the software used. This will account for changes across different versions.&lt;br /&gt;
&lt;br /&gt;
Example of a re-structured title: &amp;quot;Windows 10 Pro - Adobe Photoshop CC 2021 Tutorial&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If its a small change from each version, fork page to version and make small change.&amp;lt;br&amp;gt;&lt;br /&gt;
If no change, still fork page to new title!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Essential Links==&lt;br /&gt;
:*   [[Ubuntu_Cert_Draft|Ubuntu Cert Course &#039;&#039;&#039;DRAFTING&#039;&#039;&#039;]]&lt;br /&gt;
:*   [[Command_Line_Editors#Set_$EDITOR|Set $EDITOR]]&lt;br /&gt;
:*   [[Main_Index | Main Index Page]]&lt;br /&gt;
:*   [[Special:AllPages | All Pages]]&lt;br /&gt;
:*   [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
:*   [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
==Data-Heavy Content==&lt;br /&gt;
To maintain a lightweight XML file, data-heavy content such as pictures, audio, and video can be linked using IPFS and/or Zeronet hashes.&lt;br /&gt;
&lt;br /&gt;
[[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IPFS Browser Extensions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Firefox&#039;&#039;&#039;: https://addons.mozilla.org/en-GB/firefox/addon/ipfs-companion/&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Brave&#039;&#039;&#039;: brave://settings/ipfs and toggle on &amp;quot;IPFS Companion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Basic_Syntax#Youtube_extension_-_Embed_Video|Youtube Embedded Videos also work.]]&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS | Add a license to each page, as long as it adheres to the principles of free copying, modification, and distribution.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=429</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Main_Page&amp;diff=429"/>
		<updated>2023-05-11T19:57:50Z</updated>

		<summary type="html">&lt;p&gt;Noob: /* Feed Back Received */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=In Concept Mode=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;DISCLAIMER:&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
he content provided on completenoobs.com is for general informational and educational purposes only. The website owner and authors make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.&lt;br /&gt;
&lt;br /&gt;
In no event will the website owner or authors be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website.&lt;br /&gt;
&lt;br /&gt;
Through this website you are able to link to other websites which are not under the control of completenoobs.com. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them.&lt;br /&gt;
&lt;br /&gt;
Every effort is made to keep the website up and running smoothly. However, completenoobs.com takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Welcome to CompleteNoobs=&lt;br /&gt;
&#039;&#039;A community-driven resource for computer science enthusiasts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: At present, direct signups are disabled due to bot activity. To create an account on the wiki, please request an account and message user CompleteNoobs on Reddit. Your patience is appreciated as we may not be online all the time.&lt;br /&gt;
&lt;br /&gt;
==We All Start as Noobs==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Greetings, fellow Noobs.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
CompleteNoobs is currently in its concept stage, and we are learning as we go. Use the resources provided at your own risk.&lt;br /&gt;
&lt;br /&gt;
Our mission is to make computer science free, open, and reproducible for hobbyists, sysadmins, teachers, students, and anyone interested in the field. CompleteNoobs is a platform to share tutorials, documentation, walkthroughs, computer science courses, notes, and tips acquired along the way, under a Libre License that ensures the following freedoms:&lt;br /&gt;
&lt;br /&gt;
:*    Read&lt;br /&gt;
:*    Edit/Modify&lt;br /&gt;
:*    Copy&lt;br /&gt;
:*    Share freely&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Content licensed under &#039;&#039;&#039;CC BY-NC-SA&#039;&#039;&#039; can be hosted on the non-commercial fork: https://www.completenoobz.com&lt;br /&gt;
&lt;br /&gt;
The only proprietary aspects of this site are the domain and the trademark &#039;CompleteNoobs&#039;. All content is available for download as an XML file at https://xml.completenoobs.com and is Libre licensed for everyone to use.&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmPyUVTQa7gk8kueAnjNDtEReKZ8NnwvFLWv66aCVrq4dy&lt;br /&gt;
&lt;br /&gt;
==Get Involved==&lt;br /&gt;
&lt;br /&gt;
We encourage users to fork this project, download it, and keep a copy on their desktop and/or server.&lt;br /&gt;
&lt;br /&gt;
:* [[Host_Your_Own_Mediawiki_Online|Host Your Own Mediawiki Online]]&lt;br /&gt;
&lt;br /&gt;
:* [[Local_CompleteNoobs_Wiki|Download CompleteNoobs Wiki to your personal computer]]&lt;br /&gt;
&lt;br /&gt;
===Feed Back Received===&lt;br /&gt;
&lt;br /&gt;
*    Clearly indicate the terminal where commands should be entered&lt;br /&gt;
*    Break down content into smaller sections or modules&lt;br /&gt;
*    Provide timestamps in videos for each executed command or step&lt;br /&gt;
*    Organize steps/modules using numbers, and sub-steps within modules using letters (a, b, c, etc.)&lt;br /&gt;
*    Create shorter, focused videos for each step to avoid excessive scrolling&lt;br /&gt;
*    Clarify the use of terminal editors and how to set the $EDITOR variable&lt;br /&gt;
*    Place the EDITOR section at the top of the page and link to nano and vi guide pages&lt;br /&gt;
*    Include instructions on how to verify the completion of each step correctly&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
Title Syntax: Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Title Re-structuring for Enhanced Clarity&lt;br /&gt;
&lt;br /&gt;
Due to varying configurations and builds of apps/programs across different OS versions, step-by-step tutorials can be challenging to follow. To improve navigation, adjust page titles to include both the OS version/name and the software used. This will account for changes across different versions.&lt;br /&gt;
&lt;br /&gt;
Example of a re-structured title: &amp;quot;Windows 10 Pro - Adobe Photoshop CC 2021 Tutorial&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If its a small change from each version, fork page to version and make small change.&amp;lt;br&amp;gt;&lt;br /&gt;
If no change, still fork page to new title!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Essential Links==&lt;br /&gt;
:*   [[Ubuntu_Cert_Draft|Ubuntu Cert Course &#039;&#039;&#039;DRAFTING&#039;&#039;&#039;]]&lt;br /&gt;
:*   [[Command_Line_Editors#Set_$EDITOR|Set $EDITOR]]&lt;br /&gt;
:*   [[Main_Index | Main Index Page]]&lt;br /&gt;
:*   [[Special:AllPages | All Pages]]&lt;br /&gt;
:*   [[Wiki_Basic_Syntax|Basic Wiki Syntax]]&lt;br /&gt;
:*   [[COMPLETENOOBS_FUNDING | Support us by using affiliate links or by giving us donations.]]&lt;br /&gt;
&lt;br /&gt;
==Data-Heavy Content==&lt;br /&gt;
To maintain a lightweight XML file, data-heavy content such as pictures, audio, and video can be linked using IPFS and/or Zeronet hashes.&lt;br /&gt;
&lt;br /&gt;
[[IPFS_Basics|IPFS Basics]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IPFS Browser Extensions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Firefox&#039;&#039;&#039;: https://addons.mozilla.org/en-GB/firefox/addon/ipfs-companion/&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Brave&#039;&#039;&#039;: brave://settings/ipfs and toggle on &amp;quot;IPFS Companion&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Basic_Syntax#Youtube_extension_-_Embed_Video|Youtube Embedded Videos also work.]]&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
&lt;br /&gt;
[[LICENCE_HEADERS | Add a license to each page, as long as it adheres to the principles of free copying, modification, and distribution.]]&lt;br /&gt;
&amp;lt;pre&amp;gt;{{:LICENCE_HEADER_CC0}}&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{:LICENCE_HEADER_CC0}}&lt;br /&gt;
&lt;br /&gt;
{{Special:ContributionScores/10/5}}&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSHFS&amp;diff=427</id>
		<title>Ubuntu 22.04 SSHFS</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_SSHFS&amp;diff=427"/>
		<updated>2023-05-11T19:48:47Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;==Introduction==  SSHFS (Secure SHell FileSystem) is a file system that allows you to mount a remote file system over a secure SSH connection. This allows you to access files and directories on a remote server as if they were local files on your own machine. This guide will walk you through the process of installing SSHFS on Ubuntu and using it to mount a remote file system.  ==Install SSHFS== &amp;lt;code&amp;gt;sudo apt-get install sshfs&amp;lt;/code&amp;gt;   ==Create a mount point==  You will n...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
SSHFS (Secure SHell FileSystem) is a file system that allows you to mount a remote file system over a secure SSH connection. This allows you to access files and directories on a remote server as if they were local files on your own machine. This guide will walk you through the process of installing SSHFS on Ubuntu and using it to mount a remote file system.&lt;br /&gt;
&lt;br /&gt;
==Install SSHFS==&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install sshfs&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Create a mount point==&lt;br /&gt;
&lt;br /&gt;
You will need to create a directory on your local machine that will be used as the mount point for the remote file system. You can create a directory in your home directory using the following command:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir ~/remote_mount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mount the remote file system==&lt;br /&gt;
&lt;br /&gt;
To mount the remote file system, you will need to use the &#039;&#039;&#039;sshfs&#039;&#039;&#039; command in the following format:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sshfs &amp;lt;username&amp;gt;@&amp;lt;remote_server&amp;gt;:&amp;lt;remote_directory&amp;gt; &amp;lt;local_mount_point&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;username&amp;gt; with your username on the remote server, &amp;lt;remote_server&amp;gt; with the IP address or hostname of the remote server, &amp;lt;remote_directory&amp;gt; with the directory you want to mount on the remote server, and &amp;lt;local_mount_point&amp;gt; with the local mount point you created in the previous step.&lt;br /&gt;
&lt;br /&gt;
For example, if you want to mount the directory /home/user/files on the remote server with the IP address 192.168.1.100 using your username user and the local mount point ~/remote_mount, you would run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sshfs user@192.168.1.100:/home/user/files ~/remote_mount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will be prompted for the password for the remote server.&lt;br /&gt;
&lt;br /&gt;
==Access the remote files==&lt;br /&gt;
Once you have mounted the remote file system, you can access the files and directories on the remote server as if they were local files on your own machine. You can use your file manager to browse the files, or you can use the terminal to navigate to the mount point and use standard command-line tools to work with the files.&lt;br /&gt;
&lt;br /&gt;
==IdentityFile - aka ssh-key==&lt;br /&gt;
&lt;br /&gt;
To use the IdentityFile option with SSHFS, you can add it to the command when you mount the remote file system.&lt;br /&gt;
&lt;br /&gt;
The IdentityFile option allows you to specify the path to the private key file that you want to use for authentication. This can be useful if you have multiple SSH keys, or if you want to use a specific key for a particular connection.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example of how you can use the IdentityFile option with SSHFS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sshfs -o IdentityFile=/path/to/private/key &amp;lt;username&amp;gt;@&amp;lt;remote_server&amp;gt;:&amp;lt;remote_directory&amp;gt; &amp;lt;local_mount_point&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace /path/to/private/key with the path to the private key file that you want to use, &amp;lt;username&amp;gt; with your username on the remote server, &amp;lt;remote_server&amp;gt; with the IP address or hostname of the remote server, &amp;lt;remote_directory&amp;gt; with the directory you want to mount on the remote server, and &amp;lt;local_mount_point&amp;gt; with the local mount point you created in the previous step.&lt;br /&gt;
&lt;br /&gt;
For example, if you have a private key file called mykey.pem in your home directory, and you want to use it to mount the directory /home/user/files on the remote server with the IP address 192.168.1.100 using your username user and the local mount point ~/remote_mount, you would run the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sshfs -o IdentityFile=$HOME/mykey.pem user@192.168.1.100:/home/user/files ~/remote_mount&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will mount the remote file system using the specified private key file for authentication.&lt;br /&gt;
&lt;br /&gt;
==Options to customize sshfs behavior==&lt;br /&gt;
&lt;br /&gt;
:*    allow_other: This option allows other users to access the mounted file system. By default, only the user who mounted the file system can access it. You can use this option by adding -o allow_other to the sshfs command.&lt;br /&gt;
&lt;br /&gt;
:*    default_permissions: This option enables the use of default file permissions when accessing the mounted file system. By default, all files and directories on the mounted file system are owned by the user who mounted it, and are not accessible by other users. You can use this option by adding -o default_permissions to the sshfs command.&lt;br /&gt;
&lt;br /&gt;
:*    reconnect: This option enables automatic reconnection to the remote server if the connection is lost. You can use this option by adding -o reconnect to the sshfs command.&lt;br /&gt;
&lt;br /&gt;
:*    cache: This option enables caching of file attributes and directory entries, which can improve performance. You can use this option by adding -o cache=yes to the sshfs command.&lt;br /&gt;
&lt;br /&gt;
:*    transform_symlinks: This option allows you to specify whether symbolic links should be resolved on the local or remote machine. You can use this option by adding -o transform_symlinks to the sshfs command.&lt;br /&gt;
&lt;br /&gt;
:*    ssh_command: This option allows you to specify a custom SSH command to use for the connection. You can use this option by adding -o ssh_command=&amp;quot;&amp;lt;command&amp;gt;&amp;quot; to the sshfs command, where &amp;lt;command&amp;gt; is the custom SSH command you want to use.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example of how you can use some of these options with SSHFS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sshfs -o allow_other,default_permissions,reconnect,cache=yes,transform_symlinks,ssh_command=&amp;quot;ssh -p 2222&amp;quot; &amp;lt;username&amp;gt;@&amp;lt;remote_server&amp;gt;:&amp;lt;remote_directory&amp;gt; &amp;lt;local_mount_point&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will mount the remote file system with the specified options, including allowing other users to access it, using default permissions, enabling automatic reconnection, caching file attributes and directory entries, transforming symbolic links, and using a custom SSH command to connect to the remote server on port 2222.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Unmount the remote file system==&lt;br /&gt;
&lt;br /&gt;
When you are finished working with the remote files, you can unmount the remote file system using the following command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fusermount -u &amp;lt;local_mount_point&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace &amp;lt;local_mount_point&amp;gt; with the local mount point you used to mount the remote file system.&lt;br /&gt;
&lt;br /&gt;
For example, to unmount the remote file system mounted at ~/remote_mount, you would run the following command:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;fusermount -u ~/remote_mount&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Nginx_File_Sharing_without_DNS&amp;diff=426</id>
		<title>Ubuntu 22.04 Nginx File Sharing without DNS</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Nginx_File_Sharing_without_DNS&amp;diff=426"/>
		<updated>2023-05-11T19:47:01Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;==No DNS using IP and SelfSigned Certs==  ===Update system=== &amp;lt;code&amp;gt;apt update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;   ===Install NGINX=== &amp;lt;code&amp;gt;apt install nginx -y&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;  You should now be able to see the &amp;lt;b&amp;gt;Welcome to nginx!&amp;lt;/b&amp;gt; site on your subdomain (or just use server ip address).&amp;lt;br&amp;gt; Only &amp;lt;b&amp;gt;http&amp;lt;/b&amp;gt; will work as we have not yet setup are &amp;lt;b&amp;gt;https&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;   ===Create keys for encrypted https connection===  Note: If you are just building a quick website to test this...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==No DNS using IP and SelfSigned Certs==&lt;br /&gt;
&lt;br /&gt;
===Update system===&lt;br /&gt;
&amp;lt;code&amp;gt;apt update &amp;amp;&amp;amp; apt upgrade -y&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Install NGINX===&lt;br /&gt;
&amp;lt;code&amp;gt;apt install nginx -y&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now be able to see the &amp;lt;b&amp;gt;Welcome to nginx!&amp;lt;/b&amp;gt; site on your subdomain (or just use server ip address).&amp;lt;br&amp;gt;&lt;br /&gt;
Only &amp;lt;b&amp;gt;http&amp;lt;/b&amp;gt; will work as we have not yet setup are &amp;lt;b&amp;gt;https&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Create keys for encrypted https connection===&lt;br /&gt;
&lt;br /&gt;
Note: If you are just building a quick website to test this out you can use &amp;lt;b&amp;gt;Blank&amp;lt;/b&amp;gt; (just press enter) for all fields and it will still work.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
quick explanation:&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
:*    &#039;&#039;&#039;openssl&#039;&#039;&#039;: This command invokes the OpenSSL tool, which is a software library that provides a variety of cryptographic functions and utilities.&lt;br /&gt;
:*    &#039;&#039;&#039;req&#039;&#039;&#039;: This is a subcommand of OpenSSL that is used for creating and managing X.509 certificate signing requests (CSRs) and self-signed certificates.&lt;br /&gt;
:*    -&#039;&#039;&#039;x509&#039;&#039;&#039;: This option specifies that the output should be a self-signed X.509 certificate rather than a CSR.&lt;br /&gt;
:*    &#039;&#039;&#039;-nodes&#039;&#039;&#039;: This option specifies that the private key should not be encrypted with a password, allowing for automatic startup of services that use SSL/TLS.&lt;br /&gt;
:*    -days 365: This option specifies the number of days that the certificate will be valid for before it expires.&lt;br /&gt;
:*    &#039;&#039;&#039;-newkey rsa:4096&#039;&#039;&#039;: This option generates a new RSA private key with a key length of 4096 bits, which provides a higher level of security than shorter key lengths.&lt;br /&gt;
:*    &#039;&#039;&#039;-keyout /etc/ssl/private/nginx-selfsigned.key&#039;&#039;&#039;: This option specifies the path and filename of the private key file that will be generated by OpenSSL.&lt;br /&gt;
:*    &#039;&#039;&#039;-out /etc/ssl/certs/nginx-selfsigned.crt&#039;&#039;&#039;: This option specifies the path and filename of the self-signed certificate file that will be generated by OpenSSL.&lt;br /&gt;
&lt;br /&gt;
Overall, this command generates a self-signed SSL/TLS certificate and private key that can be used to secure an Nginx web server. The certificate and key are saved to the specified locations for use in the Nginx server configuration. It&#039;s important to note that while self-signed certificates can provide some level of encryption for your web traffic, they do not provide any form of authentication or verification of identity, and should not be used in production environments where security is a top priority.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
/etc/ssl/private/nginx-selfsigned.key&amp;lt;br&amp;gt;&lt;br /&gt;
/etc/ssl/certs/nginx-selfsigned.crt&lt;br /&gt;
&lt;br /&gt;
===Create diffhelman===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
You can upgrade from 2048 to 4096 but it might take a while.&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/nginx/snippets/ssl-params.conf&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Nginx configuration directives related to SSL/TLS:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssl_protocols TLSv1.2;&lt;br /&gt;
#This directive specifies the SSL/TLS protocols that the server will use for secure connections. In this case, only TLS version 1.2 is allowed.&lt;br /&gt;
&lt;br /&gt;
ssl_prefer_server_ciphers on;&lt;br /&gt;
#This directive tells the server to prefer the ciphers specified by the server over those requested by the client.&lt;br /&gt;
&lt;br /&gt;
ssl_ciphers &#039;ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL !LOW !DSS !MD5 !RC4 !EXP !PSK !SRP !CAMELLIA !SEED&#039;;&lt;br /&gt;
#This directive specifies the SSL/TLS ciphers that the server will use for secure connections. These ciphers prioritize the use of elliptic curve cryptography (ECDHE) for key exchange and advanced encryption algorithms such as AES256 and CHACHA20-POLY1305 for encryption.&lt;br /&gt;
&lt;br /&gt;
ssl_ecdh_curve secp384r1;&lt;br /&gt;
#This directive specifies the elliptic curve Diffie-Hellman (ECDH) curve that the server will use for key exchange. In this case, the secp384r1 curve is used.&lt;br /&gt;
&lt;br /&gt;
ssl_session_cache shared:SSL:10m;&lt;br /&gt;
ssl_session_tickets off;&lt;br /&gt;
#These directives configure SSL session caching, which can improve performance by allowing the server to reuse SSL session parameters for multiple connections. The ssl_session_cache directive specifies the type of session cache to use, and the ssl_session_tickets directive specifies whether session tickets should be used.&lt;br /&gt;
&lt;br /&gt;
# need to turn ssl_stapling off for selfsigned or will get errors in /var/log/nginx/error.log&lt;br /&gt;
ssl_stapling off;&lt;br /&gt;
ssl_stapling_verify off;&lt;br /&gt;
#These directives configure OCSP stapling, which can improve security by allowing the server to provide proof of the SSL/TLS certificate&#039;s validity without requiring the client to contact the certificate authority. The ssl_stapling directive specifies whether stapling should be used, and the ssl_stapling_verify directive specifies whether the server should verify the OCSP response from the certificate authority.&lt;br /&gt;
&lt;br /&gt;
resolver 8.8.8.8 80.80.80.80 valid=300s;&lt;br /&gt;
resolver_timeout 5s;&lt;br /&gt;
#These directives configure DNS resolution for OCSP stapling. The resolver directive specifies the DNS servers to use for resolving OCSP requests, and the valid parameter specifies the duration for which DNS responses will be cached. The resolver_timeout directive specifies the timeout value for DNS resolution.&lt;br /&gt;
&lt;br /&gt;
add_header Strict-Transport-Security &amp;quot;max-age=63072000; includeSubdomains&amp;quot;;&lt;br /&gt;
add_header X-Frame-Options DENY;&lt;br /&gt;
add_header X-Content-Type-Options nosniff;&lt;br /&gt;
#These directives add security-related HTTP headers to responses sent by the server. The Strict-Transport-Security header specifies that SSL/TLS should always be used for connections to the server, and the X-Frame-Options and X-Content-Type-Options headers help protect against clickjacking and MIME sniffing attacks, respectively.&lt;br /&gt;
&lt;br /&gt;
ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
#This directive specifies the location of the Diffie-Hellman parameters file used for SSL/TLS key exchange. The ssl_dhparam directive is used to specify the path to the file that contains the Diffie-Hellman parameters.&lt;br /&gt;
&lt;br /&gt;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;&lt;br /&gt;
#  self-signed certificate file&lt;br /&gt;
&lt;br /&gt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;&lt;br /&gt;
# private key file &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Nginx====&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/nginx/sites-available/default&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;MAKE SURE TO CHANGE IP 12.34.56.78 to YOUR servers Public IP address&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
	listen 80 default_server;&lt;br /&gt;
	listen [::]:80 default_server;&lt;br /&gt;
	server_name 12.34.56.78; ## change ip to match your server ip&lt;br /&gt;
	return 302 https://$server_name$request_uri;&lt;br /&gt;
}&lt;br /&gt;
server {&lt;br /&gt;
&lt;br /&gt;
	# SSL configuration&lt;br /&gt;
	#&lt;br /&gt;
	listen 443 ssl default_server;&lt;br /&gt;
	listen [::]:443 ssl default_server;&lt;br /&gt;
&lt;br /&gt;
	include snippets/ssl-params.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	# Add index.php to the list if you are using PHP&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
&lt;br /&gt;
	server_name _;&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		# First attempt to serve request as file, then&lt;br /&gt;
		# as directory, then fall back to displaying a 404.&lt;br /&gt;
		try_files $uri $uri/ =404;&lt;br /&gt;
		# To allow browsing of directory &lt;br /&gt;
		autoindex on;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Restart Nginx====&lt;br /&gt;
&amp;lt;code&amp;gt; systemctl restart nginx&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Allow Nginx pass firewall====&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 80/tcp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ufw allow 443/tcp&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create a Directory to share store files====&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /var/www/html/files&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Create an html file====&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /var/www/html/index.html&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Files For Download&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href=&amp;quot;files&amp;quot;&amp;gt;Click here for are latest files&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Transfer Files to Sharing Directory==&lt;br /&gt;
NOTE: [[Scp_only|If you are receiving file from another server (setup server to send with script and ssh-keys), you may wish to create another account which can only receive &#039;&#039;&#039;scp&#039;&#039;&#039; to path]]&lt;br /&gt;
&lt;br /&gt;
===scp===&lt;br /&gt;
Check [[SCP_Examples|SCP_Examples]] for more examples:&amp;lt;br&amp;gt;&lt;br /&gt;
To send direct from MediaWiki server (Example file &#039;xmlDump-03-03-2023&#039;)&amp;lt;br&amp;gt;&lt;br /&gt;
Will be prompted to enter password:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;scp /path/to/file2send &amp;lt;user&amp;gt;@&amp;lt;server_address&amp;gt;:/var/www/html/files/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Example:&amp;lt;code&amp;gt;scp /path/to/file2send ubuntu@111.222.33.444:/var/www/html/files/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===sshfs===&lt;br /&gt;
[[Sshfs_ubuntu|Read the sshfs page for more info]]&amp;lt;br&amp;gt;&lt;br /&gt;
Can be useful if you are transferring a large number of files from your computer to server and want to use the GUI file explorer.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
NOTE:replace $USER with your user account (Example: mine is &#039;ubunix&#039; so i will replace &#039;$USER&#039; with &#039;ubunix&#039;) &amp;lt;br&amp;gt;&lt;br /&gt;
Install sshfs on your computer&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt install sshfs&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a Directory you are going to mount remote server directory to:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir /home/$USER/ServerMount&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sshfs -o allow_other,default_permissions &amp;lt;user&amp;gt;@&amp;lt;server_address&amp;gt;:/var/www/html/files/ /home/$USER/ServerMount/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
To umount use:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo umount /home/$USER/ServerMount&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===sftp===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Rsync===&lt;br /&gt;
&lt;br /&gt;
===syncthing===&lt;br /&gt;
&lt;br /&gt;
===FreeFileSync===&lt;br /&gt;
&lt;br /&gt;
===Seafile===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Require Username and Password to view website/files (Optional - Placed here for educational reasons)==&lt;br /&gt;
&amp;lt;code&amp;gt;apt install apache2-utils&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
In your &amp;lt;code&amp;gt;/etc/nginx/sites-available/default&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Append the lines(see before and after files to see where):&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth_basic &amp;quot;Hello Please Login&amp;quot;;&lt;br /&gt;
auth_basic_user_file /etc/nginx/.htpasswd;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/etc/nginx/sites-available/default&amp;lt;/code&amp;gt;: Before&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
##&lt;br /&gt;
# You should look at the following URL&#039;s in order to grasp a solid understanding&lt;br /&gt;
# of Nginx configuration files in order to fully unleash the power of Nginx.&lt;br /&gt;
# https://www.nginx.com/resources/wiki/start/&lt;br /&gt;
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/&lt;br /&gt;
# https://wiki.debian.org/Nginx/DirectoryStructure&lt;br /&gt;
#&lt;br /&gt;
# In most cases, administrators will remove this file from sites-enabled/ and&lt;br /&gt;
# leave it as reference inside of sites-available where it will continue to be&lt;br /&gt;
# updated by the nginx packaging team.&lt;br /&gt;
#&lt;br /&gt;
# This file will automatically load configuration files provided by other&lt;br /&gt;
# applications, such as Drupal or Wordpress. These applications will be made&lt;br /&gt;
# available underneath a path with that package name, such as /drupal8.&lt;br /&gt;
#&lt;br /&gt;
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.&lt;br /&gt;
##&lt;br /&gt;
&lt;br /&gt;
# Default server configuration&lt;br /&gt;
#&lt;br /&gt;
server {&lt;br /&gt;
	listen 80 default_server;&lt;br /&gt;
	listen [::]:80 default_server;&lt;br /&gt;
&lt;br /&gt;
	# SSL configuration&lt;br /&gt;
	#&lt;br /&gt;
	# listen 443 ssl default_server;&lt;br /&gt;
	# listen [::]:443 ssl default_server;&lt;br /&gt;
	#&lt;br /&gt;
	# Note: You should disable gzip for SSL traffic.&lt;br /&gt;
	# See: https://bugs.debian.org/773332&lt;br /&gt;
	#&lt;br /&gt;
	# Read up on ssl_ciphers to ensure a secure configuration.&lt;br /&gt;
	# See: https://bugs.debian.org/765782&lt;br /&gt;
	#&lt;br /&gt;
	# Self signed certs generated by the ssl-cert package&lt;br /&gt;
	# Don&#039;t use them in a production server!&lt;br /&gt;
	#&lt;br /&gt;
	# include snippets/snakeoil.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	# Add index.php to the list if you are using PHP&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
&lt;br /&gt;
	server_name _;&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		# First attempt to serve request as file, then&lt;br /&gt;
		# as directory, then fall back to displaying a 404.&lt;br /&gt;
		try_files $uri $uri/ =404;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	# pass PHP scripts to FastCGI server&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ \.php$ {&lt;br /&gt;
	#	include snippets/fastcgi-php.conf;&lt;br /&gt;
	#&lt;br /&gt;
	#	# With php-fpm (or other unix sockets):&lt;br /&gt;
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;&lt;br /&gt;
	#	# With php-cgi (or other tcp sockets):&lt;br /&gt;
	#	fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
	# deny access to .htaccess files, if Apache&#039;s document root&lt;br /&gt;
	# concurs with nginx&#039;s one&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ /\.ht {&lt;br /&gt;
	#	deny all;&lt;br /&gt;
	#}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Virtual Host configuration for example.com&lt;br /&gt;
#&lt;br /&gt;
# You can move that to a different file under sites-available/ and symlink that&lt;br /&gt;
# to sites-enabled/ to enable it.&lt;br /&gt;
#&lt;br /&gt;
#server {&lt;br /&gt;
#	listen 80;&lt;br /&gt;
#	listen [::]:80;&lt;br /&gt;
#&lt;br /&gt;
#	server_name example.com;&lt;br /&gt;
#&lt;br /&gt;
#	root /var/www/example.com;&lt;br /&gt;
#	index index.html;&lt;br /&gt;
#&lt;br /&gt;
#	location / {&lt;br /&gt;
#		try_files $uri $uri/ =404;&lt;br /&gt;
#	}&lt;br /&gt;
#}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
&lt;br /&gt;
	# SSL configuration&lt;br /&gt;
	#&lt;br /&gt;
	# listen 443 ssl default_server;&lt;br /&gt;
	# listen [::]:443 ssl default_server;&lt;br /&gt;
	#&lt;br /&gt;
	# Note: You should disable gzip for SSL traffic.&lt;br /&gt;
	# See: https://bugs.debian.org/773332&lt;br /&gt;
	#&lt;br /&gt;
	# Read up on ssl_ciphers to ensure a secure configuration.&lt;br /&gt;
	# See: https://bugs.debian.org/765782&lt;br /&gt;
	#&lt;br /&gt;
	# Self signed certs generated by the ssl-cert package&lt;br /&gt;
	# Don&#039;t use them in a production server!&lt;br /&gt;
	#&lt;br /&gt;
	# include snippets/snakeoil.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	# Add index.php to the list if you are using PHP&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
    server_name xml.completenoobs.com; # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		# First attempt to serve request as file, then&lt;br /&gt;
		# as directory, then fall back to displaying a 404.&lt;br /&gt;
		try_files $uri $uri/ =404;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	# pass PHP scripts to FastCGI server&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ \.php$ {&lt;br /&gt;
	#	include snippets/fastcgi-php.conf;&lt;br /&gt;
	#&lt;br /&gt;
	#	# With php-fpm (or other unix sockets):&lt;br /&gt;
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;&lt;br /&gt;
	#	# With php-cgi (or other tcp sockets):&lt;br /&gt;
	#	fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
	# deny access to .htaccess files, if Apache&#039;s document root&lt;br /&gt;
	# concurs with nginx&#039;s one&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ /\.ht {&lt;br /&gt;
	#	deny all;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    listen [::]:443 ssl ipv6only=on; # managed by Certbot&lt;br /&gt;
    listen 443 ssl; # managed by Certbot&lt;br /&gt;
    ssl_certificate /etc/letsencrypt/live/xml.completenoobs.com/fullchain.pem; # managed by Certbot&lt;br /&gt;
    ssl_certificate_key /etc/letsencrypt/live/xml.completenoobs.com/privkey.pem; # managed by Certbot&lt;br /&gt;
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&lt;br /&gt;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
server {&lt;br /&gt;
    if ($host = xml.completenoobs.com) {&lt;br /&gt;
        return 301 https://$host$request_uri;&lt;br /&gt;
    } # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	listen 80 ;&lt;br /&gt;
	listen [::]:80 ;&lt;br /&gt;
    server_name xml.completenoobs.com;&lt;br /&gt;
    return 404; # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/etc/nginx/sites-available/default&amp;lt;/code&amp;gt;: After&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
##&lt;br /&gt;
# You should look at the following URL&#039;s in order to grasp a solid understanding&lt;br /&gt;
# of Nginx configuration files in order to fully unleash the power of Nginx.&lt;br /&gt;
# https://www.nginx.com/resources/wiki/start/&lt;br /&gt;
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/&lt;br /&gt;
# https://wiki.debian.org/Nginx/DirectoryStructure&lt;br /&gt;
#&lt;br /&gt;
# In most cases, administrators will remove this file from sites-enabled/ and&lt;br /&gt;
# leave it as reference inside of sites-available where it will continue to be&lt;br /&gt;
# updated by the nginx packaging team.&lt;br /&gt;
#&lt;br /&gt;
# This file will automatically load configuration files provided by other&lt;br /&gt;
# applications, such as Drupal or Wordpress. These applications will be made&lt;br /&gt;
# available underneath a path with that package name, such as /drupal8.&lt;br /&gt;
#&lt;br /&gt;
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.&lt;br /&gt;
##&lt;br /&gt;
&lt;br /&gt;
# Default server configuration&lt;br /&gt;
#&lt;br /&gt;
server {&lt;br /&gt;
	listen 80 default_server;&lt;br /&gt;
	listen [::]:80 default_server;&lt;br /&gt;
&lt;br /&gt;
	# SSL configuration&lt;br /&gt;
	#&lt;br /&gt;
	# listen 443 ssl default_server;&lt;br /&gt;
	# listen [::]:443 ssl default_server;&lt;br /&gt;
	#&lt;br /&gt;
	# Note: You should disable gzip for SSL traffic.&lt;br /&gt;
	# See: https://bugs.debian.org/773332&lt;br /&gt;
	#&lt;br /&gt;
	# Read up on ssl_ciphers to ensure a secure configuration.&lt;br /&gt;
	# See: https://bugs.debian.org/765782&lt;br /&gt;
	#&lt;br /&gt;
	# Self signed certs generated by the ssl-cert package&lt;br /&gt;
	# Don&#039;t use them in a production server!&lt;br /&gt;
	#&lt;br /&gt;
	# include snippets/snakeoil.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	# Add index.php to the list if you are using PHP&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
&lt;br /&gt;
	server_name _;&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		# First attempt to serve request as file, then&lt;br /&gt;
		# as directory, then fall back to displaying a 404.&lt;br /&gt;
		try_files $uri $uri/ =404;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	# pass PHP scripts to FastCGI server&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ \.php$ {&lt;br /&gt;
	#	include snippets/fastcgi-php.conf;&lt;br /&gt;
	#&lt;br /&gt;
	#	# With php-fpm (or other unix sockets):&lt;br /&gt;
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;&lt;br /&gt;
	#	# With php-cgi (or other tcp sockets):&lt;br /&gt;
	#	fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
	# deny access to .htaccess files, if Apache&#039;s document root&lt;br /&gt;
	# concurs with nginx&#039;s one&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ /\.ht {&lt;br /&gt;
	#	deny all;&lt;br /&gt;
	#}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Virtual Host configuration for example.com&lt;br /&gt;
#&lt;br /&gt;
# You can move that to a different file under sites-available/ and symlink that&lt;br /&gt;
# to sites-enabled/ to enable it.&lt;br /&gt;
#&lt;br /&gt;
#server {&lt;br /&gt;
#	listen 80;&lt;br /&gt;
#	listen [::]:80;&lt;br /&gt;
#&lt;br /&gt;
#	server_name example.com;&lt;br /&gt;
#&lt;br /&gt;
#	root /var/www/example.com;&lt;br /&gt;
#	index index.html;&lt;br /&gt;
#&lt;br /&gt;
#	location / {&lt;br /&gt;
#		try_files $uri $uri/ =404;&lt;br /&gt;
#	}&lt;br /&gt;
#}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
&lt;br /&gt;
	# SSL configuration&lt;br /&gt;
	#&lt;br /&gt;
	# listen 443 ssl default_server;&lt;br /&gt;
	# listen [::]:443 ssl default_server;&lt;br /&gt;
	#&lt;br /&gt;
	# Note: You should disable gzip for SSL traffic.&lt;br /&gt;
	# See: https://bugs.debian.org/773332&lt;br /&gt;
	#&lt;br /&gt;
	# Read up on ssl_ciphers to ensure a secure configuration.&lt;br /&gt;
	# See: https://bugs.debian.org/765782&lt;br /&gt;
	#&lt;br /&gt;
	# Self signed certs generated by the ssl-cert package&lt;br /&gt;
	# Don&#039;t use them in a production server!&lt;br /&gt;
	#&lt;br /&gt;
	# include snippets/snakeoil.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	# Add index.php to the list if you are using PHP&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
    server_name xml.completenoobs.com; # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		# First attempt to serve request as file, then&lt;br /&gt;
		# as directory, then fall back to displaying a 404.&lt;br /&gt;
		try_files $uri $uri/ =404;&lt;br /&gt;
		# To allow browsing of directory&lt;br /&gt;
		autoindex on;&lt;br /&gt;
		auth_basic &amp;quot;Hello Please Login&amp;quot;;&lt;br /&gt;
		auth_basic_user_file /etc/nginx/.htpasswd;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	# pass PHP scripts to FastCGI server&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ \.php$ {&lt;br /&gt;
	#	include snippets/fastcgi-php.conf;&lt;br /&gt;
	#&lt;br /&gt;
	#	# With php-fpm (or other unix sockets):&lt;br /&gt;
	#	fastcgi_pass unix:/run/php/php7.4-fpm.sock;&lt;br /&gt;
	#	# With php-cgi (or other tcp sockets):&lt;br /&gt;
	#	fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
	# deny access to .htaccess files, if Apache&#039;s document root&lt;br /&gt;
	# concurs with nginx&#039;s one&lt;br /&gt;
	#&lt;br /&gt;
	#location ~ /\.ht {&lt;br /&gt;
	#	deny all;&lt;br /&gt;
	#}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    listen [::]:443 ssl ipv6only=on; # managed by Certbot&lt;br /&gt;
    listen 443 ssl; # managed by Certbot&lt;br /&gt;
    ssl_certificate /etc/letsencrypt/live/xml.completenoobs.com/fullchain.pem; # managed by Certbot&lt;br /&gt;
    ssl_certificate_key /etc/letsencrypt/live/xml.completenoobs.com/privkey.pem; # managed by Certbot&lt;br /&gt;
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot&lt;br /&gt;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
server {&lt;br /&gt;
    if ($host = xml.completenoobs.com) {&lt;br /&gt;
        return 301 https://$host$request_uri;&lt;br /&gt;
    } # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	listen 80 ;&lt;br /&gt;
	listen [::]:80 ;&lt;br /&gt;
    server_name xml.completenoobs.com;&lt;br /&gt;
    return 404; # managed by Certbot&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create a login Username and Password to view your website===&lt;br /&gt;
&lt;br /&gt;
Add user; change &amp;lt;b&amp;gt;user1&amp;lt;/b&amp;gt; to username of your choice; you will be prompted for password.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;htpasswd -c /etc/nginx/.htpasswd user1&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;b&amp;gt;-c&amp;lt;/b&amp;gt; flag is only needed the first time to create the file &amp;lt;b&amp;gt;/etc/nginx/.htpasswd&amp;lt;/b&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add second user; the same method is used to add has many users has you want.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;htpasswd /etc/nginx/.htpasswd user2&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
To update or change passwd for user, repeat command with username of account you wish to change; enter new password.&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;htpasswd /etc/nginx/.htpasswd user1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Restart Nginx:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart nginx&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
And try site.&lt;br /&gt;
&lt;br /&gt;
===Fail2Ban to Block IP&#039;s Which Enter Incorrect Username and/or Password===&lt;br /&gt;
Install Fail2Ban:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;apt install fail2ban&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/fail2ban/jail.local&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Note: Can append to the very bottom of the page.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Reject Connections that failed username password&lt;br /&gt;
_action_tcp_udp = %(banaction)s[name=%(__name__)s-tcp, protocol=&amp;quot;tcp&amp;quot;, port=&amp;quot;%(port)s&amp;quot;, blocktype=&amp;quot;REJECT --reject-with tcp-reset&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-tcp]&lt;br /&gt;
    %(banaction)s[name=%(__name__)s-udp, protocol=&amp;quot;udp&amp;quot;, port=&amp;quot;%(port)s&amp;quot;, blocktype=&amp;quot;REJECT --reject-with icmp-port-unreachable&amp;quot;, chain=&amp;quot;%(chain)s&amp;quot;, actname=%(banaction)s-udp]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
actionx = %(_action_tcp_udp)s&lt;br /&gt;
&lt;br /&gt;
[nginx-cup]&lt;br /&gt;
#the name in brackets above is what you use for status&lt;br /&gt;
#   fail2ban-client status nginx-cup&lt;br /&gt;
enabled = true&lt;br /&gt;
filter = nginx-correct-up&lt;br /&gt;
port = http,https&lt;br /&gt;
logpath = /var/log/nginx/error.log&lt;br /&gt;
findtime = 3m&lt;br /&gt;
bantime = 3m&lt;br /&gt;
maxretry = 3&lt;br /&gt;
#ignoreip = &amp;lt;your-ipaddress&amp;gt;&lt;br /&gt;
#Note: Can find your ipaddress using `curl ifconfig.me` or visit `whatismyip.com`&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/fail2ban/filter.d/nginx-correct-up.conf&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Definition]&lt;br /&gt;
failregex = client:\s&amp;lt;HOST&amp;gt;&lt;br /&gt;
ignoreregex =&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Check Fail2Ban for errors===&lt;br /&gt;
&amp;lt;code&amp;gt;fail2ban-client -d&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===restart nginx and fail2ban so updated setting can take effect===&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart fail2ban.service&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart nginx.service&amp;lt;/code&amp;gt;&amp;lt;br \&amp;gt;&lt;br /&gt;
And test.&lt;br /&gt;
&lt;br /&gt;
===Remove need for username and password===&lt;br /&gt;
Comment out (or delete) the following lines from your nginx config file:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/nginx/sites-available/default&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
auth_basic &amp;quot;Hello Please Login&amp;quot;;&lt;br /&gt;
auth_basic_user_file /etc/nginx/.htpasswd;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Can comment out lines by placing a &#039;#&#039; in front.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#auth_basic &amp;quot;Hello Please Login&amp;quot;;&lt;br /&gt;
#auth_basic_user_file /etc/nginx/.htpasswd;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Restart Nginx:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl restart nginx&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Script for Server==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# Update and upgrade packages&lt;br /&gt;
apt update &amp;amp;&amp;amp; apt upgrade -y&lt;br /&gt;
&lt;br /&gt;
# Install nginx and apache2-utils&lt;br /&gt;
apt install nginx apache2-utils -y&lt;br /&gt;
&lt;br /&gt;
# Set up UFW rules&lt;br /&gt;
ufw allow 80/tcp&lt;br /&gt;
ufw allow 443/tcp&lt;br /&gt;
&lt;br /&gt;
# Create self-signed SSL certificate&lt;br /&gt;
openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt&lt;br /&gt;
&lt;br /&gt;
# Generate Diffie-Hellman parameters&lt;br /&gt;
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048&lt;br /&gt;
&lt;br /&gt;
# Get server IP address&lt;br /&gt;
server_ip=$(curl -s ifconfig.me)&lt;br /&gt;
&lt;br /&gt;
# Create an SSL configuration snippet&lt;br /&gt;
cat &amp;gt; /etc/nginx/snippets/ssl-params.conf &amp;lt;&amp;lt;EOL&lt;br /&gt;
ssl_protocols TLSv1.2;&lt;br /&gt;
&lt;br /&gt;
ssl_ciphers &#039;ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL !LOW !DSS !MD5 !RC4 !EXP !PSK !SRP !CAMELLIA !SEED&#039;;&lt;br /&gt;
&lt;br /&gt;
ssl_ecdh_curve secp384r1;&lt;br /&gt;
&lt;br /&gt;
ssl_session_cache shared:SSL:10m;&lt;br /&gt;
ssl_session_tickets off;&lt;br /&gt;
&lt;br /&gt;
ssl_stapling off;&lt;br /&gt;
ssl_stapling_verify off;&lt;br /&gt;
&lt;br /&gt;
resolver 8.8.8.8 8.8.4.4 valid=300s;&lt;br /&gt;
resolver_timeout 5s;&lt;br /&gt;
&lt;br /&gt;
add_header Strict-Transport-Security &amp;quot;max-age=63072000; includeSubdomains&amp;quot;;&lt;br /&gt;
add_header X-Frame-Options DENY;&lt;br /&gt;
add_header X-Content-Type-Options nosniff;&lt;br /&gt;
&lt;br /&gt;
ssl_dhparam /etc/ssl/certs/dhparam.pem;&lt;br /&gt;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;&lt;br /&gt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;&lt;br /&gt;
EOL&lt;br /&gt;
&lt;br /&gt;
# Get username and password for basic authentication&lt;br /&gt;
read -p &amp;quot;Enter a username for basic authentication: &amp;quot; username&lt;br /&gt;
read -sp &amp;quot;Enter a password for basic authentication: &amp;quot; password&lt;br /&gt;
echo&lt;br /&gt;
&lt;br /&gt;
# Create .htpasswd file&lt;br /&gt;
htpasswd -cb /etc/nginx/.htpasswd &amp;quot;$username&amp;quot; &amp;quot;$password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Replace the default Nginx server configuration&lt;br /&gt;
cat &amp;gt; /etc/nginx/sites-available/default &amp;lt;&amp;lt;EOL&lt;br /&gt;
server {&lt;br /&gt;
	listen 80 default_server;&lt;br /&gt;
	listen [::]:80 default_server;&lt;br /&gt;
	server_name $server_ip;&lt;br /&gt;
	return 302 https://\$server_name\$request_uri;&lt;br /&gt;
}&lt;br /&gt;
server {&lt;br /&gt;
	listen 443 ssl default_server;&lt;br /&gt;
	listen [::]:443 ssl default_server;&lt;br /&gt;
&lt;br /&gt;
	include snippets/ssl-params.conf;&lt;br /&gt;
&lt;br /&gt;
	root /var/www/html;&lt;br /&gt;
&lt;br /&gt;
	index index.html index.htm index.nginx-debian.html;&lt;br /&gt;
&lt;br /&gt;
	server_name _;&lt;br /&gt;
&lt;br /&gt;
	auth_basic &amp;quot;Hello Please Login&amp;quot;;&lt;br /&gt;
	auth_basic_user_file /etc/nginx/.htpasswd;&lt;br /&gt;
&lt;br /&gt;
	location / {&lt;br /&gt;
		try_files \$uri \$uri/ =404;&lt;br /&gt;
		autoindex on;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
EOL&lt;br /&gt;
&lt;br /&gt;
# Update the server_name directive with the server_ip obtained from ifconfig.me&lt;br /&gt;
sed -i &amp;quot;s/\$server_ip/$server_ip/g&amp;quot; /etc/nginx/sites-available/default&lt;br /&gt;
&lt;br /&gt;
# Restart Nginx&lt;br /&gt;
systemctl restart nginx&lt;br /&gt;
&lt;br /&gt;
# Create directory for files&lt;br /&gt;
mkdir /var/www/html/files&lt;br /&gt;
&lt;br /&gt;
# Create index.html file&lt;br /&gt;
cat &amp;gt; /var/www/html/index.html &amp;lt;&amp;lt;EOL&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Files For Download&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;a href=&amp;quot;files&amp;quot;&amp;gt;Click here for our latest files&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
EOL&lt;br /&gt;
&lt;br /&gt;
# Inform the user of the server IP address&lt;br /&gt;
echo &amp;quot;You can visit your server at https://$server_ip&amp;quot;&lt;br /&gt;
echo &amp;quot;Transfer files to $server_ip:/var/www/html/files&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Compression&amp;diff=425</id>
		<title>Ubuntu 22.04 Compression</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Compression&amp;diff=425"/>
		<updated>2023-05-11T19:42:15Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Tar==&lt;br /&gt;
Tar is not a compression tool, but rather a file archiving utility commonly used on Linux systems. The tar command is used to create an archive of one or more files and directories, which can then be compressed using a compression tool like gzip, bzip2, xz, or zstd to reduce its size for storage or transfer purposes. Tar can also be used to extract files from an archive, or to list the contents of an archive without extracting it.&lt;br /&gt;
&lt;br /&gt;
There are several types of compression available on Linux, including:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;gzip&#039;&#039;&#039;: This is a widely used compression tool that uses the Lempel-Ziv algorithm. It is commonly used to compress individual files and is often used in combination with the tar command to create compressed archives.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;bzip2&#039;&#039;&#039;: This is another popular compression tool that uses the Burrows-Wheeler algorithm. It is often used for compressing larger files, as it typically achieves higher compression ratios than gzip.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;xz&#039;&#039;&#039;: This is a newer compression tool that uses the LZMA algorithm. It is often used to compress large files, as it can achieve very high compression ratios.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;lz4&#039;&#039;&#039;: This is a high-speed compression tool that is designed for use in real-time systems. It is often used for compressing data in network communications and storage systems.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;zstd&#039;&#039;&#039;: This is a relatively new compression tool that uses the Zstandard compression algorithm. It is designed to offer high compression ratios and fast compression and decompression speeds.&lt;br /&gt;
&lt;br /&gt;
In addition to these tools, there are also several other compression tools available on Linux, including compress, pack, and rar, among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Gzip tar compression===&lt;br /&gt;
&lt;br /&gt;
The tar command is a utility used on Linux systems to create and manage archives of files and directories. The -zcvf options are used to create a compressed archive of one or more files or directories using gzip compression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Syntax&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz file_or_directory&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf /path/store/archive.tar.gz /home/$USER/Documents/testDIR&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Options&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-z&#039;&#039;&#039; option is used to compress the archive using gzip. Without this option, the archive will not be compressed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-c&#039;&#039;&#039; option is used to create a new archive. Without this option, the command will attempt to extract files from an existing archive.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-v&#039;&#039;&#039; option is used to display the progress of the archive creation. Without this option, the command will run silently.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option is used to specify the filename of the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing a single file===&lt;br /&gt;
&lt;br /&gt;
To create a compressed archive of a single file, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf file_name.tar.gz file_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called file_name.tar.gz in the current directory, and include the contents of file_name in the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing a directory===&lt;br /&gt;
&lt;br /&gt;
To create a compressed archive of a directory and its contents, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf directory_name.tar.gz directory_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called directory_name.tar.gz in the current directory, and include the contents of directory_name and its subdirectories in the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing multiple files and directories===&lt;br /&gt;
&lt;br /&gt;
To create a compressed archive of multiple files and directories, you can list them all as arguments to the tar command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz file_or_directory_1 file_or_directory_2 ...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called archive_name.tar.gz in the current directory, and include the contents of all specified files and directories in the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing and excluding files or directories===&lt;br /&gt;
You can use the --exclude option to exclude specific files or directories from the archive. For example, to exclude a directory named exclude_dir from an archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz --exclude=exclude_dir file_or_directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called archive_name.tar.gz in the current directory, and include the contents of file_or_directory in the archive while excluding the exclude_dir directory.&lt;br /&gt;
&lt;br /&gt;
To exclude multiple files or directories using the --exclude option with the tar command, you can separate them with a space character. For example, to exclude two directories named exclude_dir1 and exclude_dir2 from an archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz --exclude=exclude_dir1 --exclude=exclude_dir2 file_or_directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called archive_name.tar.gz in the current directory, and include the contents of file_or_directory in the archive while excluding the exclude_dir1 and exclude_dir2 directories.&lt;br /&gt;
&lt;br /&gt;
===Preserve file permissions===&lt;br /&gt;
&lt;br /&gt;
To preserve file permissions when creating a compressed archive with tar, you can use the -p option. The -p option stands for &amp;quot;preserve permissions&amp;quot;, and it tells tar to include the file permissions (ownership, group, and mode) in the archive.&lt;br /&gt;
&lt;br /&gt;
So, to create a compressed archive of a file or directory and preserve its permissions, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvpf archive_name.tar.gz file_or_directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the -p option should be used with caution, as it can potentially create security vulnerabilities if you are extracting the archive as a privileged user. It&#039;s generally recommended to use the -p option only when necessary and with a clear understanding of its implications.&lt;br /&gt;
&lt;br /&gt;
Also note that if you are extracting the archive on a different system or with a different user account, the file permissions may not be preserved exactly as they were in the original system, depending on the destination file system and user account settings.&lt;br /&gt;
&lt;br /&gt;
===Gzip Tar Extraction===&lt;br /&gt;
&lt;br /&gt;
The basic syntax for extracting a tar archive compressed with gzip is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
The -z option is used to decompress the archive using gzip.&lt;br /&gt;
&lt;br /&gt;
The -x option is used to extract the contents of the archive.&lt;br /&gt;
&lt;br /&gt;
The -v option is used to display the progress of the extraction.&lt;br /&gt;
&lt;br /&gt;
The -f option is used to specify the filename of the archive.&lt;br /&gt;
&lt;br /&gt;
====View the contents of a &#039;&#039;&#039;gzip&#039;&#039;&#039; archive without extracting it using &#039;&#039;&#039;zcat&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The zcat command is similar to the cat command, but it is used specifically for viewing the contents of gzip compressed files.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example command to view the contents of a gzip archive without extracting it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zcat archive_name.tar.gz | less&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display the contents of the gzip archive in the less pager, allowing you to scroll through the contents of the archive without extracting it.&lt;br /&gt;
&lt;br /&gt;
If you want to search for a specific file or pattern within the archive, you can pipe the output of zcat to the grep command. Here&#039;s an example command to search for a file named file.txt within a gzip archive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zcat archive_name.tar.gz | grep file.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display any lines within the gzip archive that contain the string &amp;quot;file.txt&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Note that the zcat command is only used for viewing the contents of gzip compressed files. If you are working with a tar archive that has been compressed with gzip, you will need to use the tar command in conjunction with zcat to view the contents of the archive. Here&#039;s an example command to view the contents of a tar archive compressed with gzip without extracting it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zcat archive_name.tar.gz | tar tvf -&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display a listing of the files and directories within the tar archive, allowing you to see its contents without extracting it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Extracting a single file===&lt;br /&gt;
&lt;br /&gt;
To extract a single file from a compressed tar archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz path/to/file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the specified file from the compressed archive.&lt;br /&gt;
&lt;br /&gt;
===Extracting a directory===&lt;br /&gt;
&lt;br /&gt;
To extract a directory and its contents from a compressed tar archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz path/to/directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the specified directory and its contents from the compressed archive.&lt;br /&gt;
&lt;br /&gt;
===Extracting multiple files and directories===&lt;br /&gt;
&lt;br /&gt;
To extract multiple files and directories from a compressed tar archive, you can list them all as arguments to the tar command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz file_or_directory_1 file_or_directory_2 ...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the specified files and directories from the compressed archive.&lt;br /&gt;
&lt;br /&gt;
===Extracting to a specific directory===&lt;br /&gt;
&lt;br /&gt;
To extract the contents of a compressed tar archive to a specific directory, you can use the -C option followed by the directory path. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz -C /path/to/directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the contents of the compressed archive to the specified directory.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Compression&amp;diff=424</id>
		<title>Ubuntu 22.04 Compression</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_Compression&amp;diff=424"/>
		<updated>2023-05-11T19:41:22Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;Tar is not a compression tool, but rather a file archiving utility commonly used on Linux systems. The tar command is used to create an archive of one or more files and directories, which can then be compressed using a compression tool like gzip, bzip2, xz, or zstd to reduce its size for storage or transfer purposes. Tar can also be used to extract files from an archive, or to list the contents of an archive without extracting it.  There are several types of compression...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tar is not a compression tool, but rather a file archiving utility commonly used on Linux systems. The tar command is used to create an archive of one or more files and directories, which can then be compressed using a compression tool like gzip, bzip2, xz, or zstd to reduce its size for storage or transfer purposes. Tar can also be used to extract files from an archive, or to list the contents of an archive without extracting it.&lt;br /&gt;
&lt;br /&gt;
There are several types of compression available on Linux, including:&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;gzip&#039;&#039;&#039;: This is a widely used compression tool that uses the Lempel-Ziv algorithm. It is commonly used to compress individual files and is often used in combination with the tar command to create compressed archives.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;bzip2&#039;&#039;&#039;: This is another popular compression tool that uses the Burrows-Wheeler algorithm. It is often used for compressing larger files, as it typically achieves higher compression ratios than gzip.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;xz&#039;&#039;&#039;: This is a newer compression tool that uses the LZMA algorithm. It is often used to compress large files, as it can achieve very high compression ratios.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;lz4&#039;&#039;&#039;: This is a high-speed compression tool that is designed for use in real-time systems. It is often used for compressing data in network communications and storage systems.&lt;br /&gt;
&lt;br /&gt;
:*    &#039;&#039;&#039;zstd&#039;&#039;&#039;: This is a relatively new compression tool that uses the Zstandard compression algorithm. It is designed to offer high compression ratios and fast compression and decompression speeds.&lt;br /&gt;
&lt;br /&gt;
In addition to these tools, there are also several other compression tools available on Linux, including compress, pack, and rar, among others.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Gzip tar compression==&lt;br /&gt;
&lt;br /&gt;
The tar command is a utility used on Linux systems to create and manage archives of files and directories. The -zcvf options are used to create a compressed archive of one or more files or directories using gzip compression.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Syntax&#039;&#039;&#039; &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz file_or_directory&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf /path/store/archive.tar.gz /home/$USER/Documents/testDIR&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Options&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-z&#039;&#039;&#039; option is used to compress the archive using gzip. Without this option, the archive will not be compressed.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-c&#039;&#039;&#039; option is used to create a new archive. Without this option, the command will attempt to extract files from an existing archive.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-v&#039;&#039;&#039; option is used to display the progress of the archive creation. Without this option, the command will run silently.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;-f&#039;&#039;&#039; option is used to specify the filename of the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing a single file===&lt;br /&gt;
&lt;br /&gt;
To create a compressed archive of a single file, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf file_name.tar.gz file_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called file_name.tar.gz in the current directory, and include the contents of file_name in the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing a directory===&lt;br /&gt;
&lt;br /&gt;
To create a compressed archive of a directory and its contents, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf directory_name.tar.gz directory_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called directory_name.tar.gz in the current directory, and include the contents of directory_name and its subdirectories in the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing multiple files and directories===&lt;br /&gt;
&lt;br /&gt;
To create a compressed archive of multiple files and directories, you can list them all as arguments to the tar command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz file_or_directory_1 file_or_directory_2 ...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called archive_name.tar.gz in the current directory, and include the contents of all specified files and directories in the archive.&lt;br /&gt;
&lt;br /&gt;
===Compressing and excluding files or directories===&lt;br /&gt;
You can use the --exclude option to exclude specific files or directories from the archive. For example, to exclude a directory named exclude_dir from an archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz --exclude=exclude_dir file_or_directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called archive_name.tar.gz in the current directory, and include the contents of file_or_directory in the archive while excluding the exclude_dir directory.&lt;br /&gt;
&lt;br /&gt;
To exclude multiple files or directories using the --exclude option with the tar command, you can separate them with a space character. For example, to exclude two directories named exclude_dir1 and exclude_dir2 from an archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvf archive_name.tar.gz --exclude=exclude_dir1 --exclude=exclude_dir2 file_or_directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a new compressed archive called archive_name.tar.gz in the current directory, and include the contents of file_or_directory in the archive while excluding the exclude_dir1 and exclude_dir2 directories.&lt;br /&gt;
&lt;br /&gt;
===Preserve file permissions===&lt;br /&gt;
&lt;br /&gt;
To preserve file permissions when creating a compressed archive with tar, you can use the -p option. The -p option stands for &amp;quot;preserve permissions&amp;quot;, and it tells tar to include the file permissions (ownership, group, and mode) in the archive.&lt;br /&gt;
&lt;br /&gt;
So, to create a compressed archive of a file or directory and preserve its permissions, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zcvpf archive_name.tar.gz file_or_directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the -p option should be used with caution, as it can potentially create security vulnerabilities if you are extracting the archive as a privileged user. It&#039;s generally recommended to use the -p option only when necessary and with a clear understanding of its implications.&lt;br /&gt;
&lt;br /&gt;
Also note that if you are extracting the archive on a different system or with a different user account, the file permissions may not be preserved exactly as they were in the original system, depending on the destination file system and user account settings.&lt;br /&gt;
&lt;br /&gt;
==Gzip Tar Extraction==&lt;br /&gt;
&lt;br /&gt;
The basic syntax for extracting a tar archive compressed with gzip is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
The -z option is used to decompress the archive using gzip.&lt;br /&gt;
&lt;br /&gt;
The -x option is used to extract the contents of the archive.&lt;br /&gt;
&lt;br /&gt;
The -v option is used to display the progress of the extraction.&lt;br /&gt;
&lt;br /&gt;
The -f option is used to specify the filename of the archive.&lt;br /&gt;
&lt;br /&gt;
====View the contents of a &#039;&#039;&#039;gzip&#039;&#039;&#039; archive without extracting it using &#039;&#039;&#039;zcat&#039;&#039;&#039;====&lt;br /&gt;
&lt;br /&gt;
The zcat command is similar to the cat command, but it is used specifically for viewing the contents of gzip compressed files.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example command to view the contents of a gzip archive without extracting it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zcat archive_name.tar.gz | less&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display the contents of the gzip archive in the less pager, allowing you to scroll through the contents of the archive without extracting it.&lt;br /&gt;
&lt;br /&gt;
If you want to search for a specific file or pattern within the archive, you can pipe the output of zcat to the grep command. Here&#039;s an example command to search for a file named file.txt within a gzip archive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zcat archive_name.tar.gz | grep file.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display any lines within the gzip archive that contain the string &amp;quot;file.txt&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Note that the zcat command is only used for viewing the contents of gzip compressed files. If you are working with a tar archive that has been compressed with gzip, you will need to use the tar command in conjunction with zcat to view the contents of the archive. Here&#039;s an example command to view the contents of a tar archive compressed with gzip without extracting it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;zcat archive_name.tar.gz | tar tvf -&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This command will display a listing of the files and directories within the tar archive, allowing you to see its contents without extracting it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Extracting a single file===&lt;br /&gt;
&lt;br /&gt;
To extract a single file from a compressed tar archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz path/to/file&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the specified file from the compressed archive.&lt;br /&gt;
&lt;br /&gt;
===Extracting a directory===&lt;br /&gt;
&lt;br /&gt;
To extract a directory and its contents from a compressed tar archive, you can use the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz path/to/directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the specified directory and its contents from the compressed archive.&lt;br /&gt;
&lt;br /&gt;
===Extracting multiple files and directories===&lt;br /&gt;
&lt;br /&gt;
To extract multiple files and directories from a compressed tar archive, you can list them all as arguments to the tar command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz file_or_directory_1 file_or_directory_2 ...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the specified files and directories from the compressed archive.&lt;br /&gt;
&lt;br /&gt;
===Extracting to a specific directory===&lt;br /&gt;
&lt;br /&gt;
To extract the contents of a compressed tar archive to a specific directory, you can use the -C option followed by the directory path. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tar -zxvf archive_name.tar.gz -C /path/to/directory&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will extract the contents of the compressed archive to the specified directory.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_IPFS&amp;diff=423</id>
		<title>Ubuntu 22.04 IPFS</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=Ubuntu_22.04_IPFS&amp;diff=423"/>
		<updated>2023-05-11T19:13:00Z</updated>

		<summary type="html">&lt;p&gt;Noob: Created page with &amp;quot;Moved from &amp;#039;IPFS Basics&amp;#039; This page is going to be just about IPFS on/for Ubuntu 22.04 Redo from scratch, below is for notes and placeholder from old page.  ==Introduction to IPFS==  Note that this guide was unsuccessful on a home network but worked on a Vultr VPS. IPFS requires ports 4001 TCP and UDP to be open on the router.  Tested on an Ubuntu 22.04 server.  Download Linux Binary from https://dist.ipfs.tech/#go-ipfs  Assuming you already have LXD set up (it doesn&amp;#039;t ha...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moved from &#039;IPFS Basics&#039; This page is going to be just about IPFS on/for Ubuntu 22.04 Redo from scratch, below is for notes and placeholder from old page.&lt;br /&gt;
&lt;br /&gt;
==Introduction to IPFS==&lt;br /&gt;
&lt;br /&gt;
Note that this guide was unsuccessful on a home network but worked on a Vultr VPS.&lt;br /&gt;
IPFS requires ports 4001 TCP and UDP to be open on the router.&lt;br /&gt;
&lt;br /&gt;
Tested on an Ubuntu 22.04 server.&lt;br /&gt;
&lt;br /&gt;
Download Linux Binary from https://dist.ipfs.tech/#go-ipfs&lt;br /&gt;
&lt;br /&gt;
Assuming you already have LXD set up (it doesn&#039;t have to be in a container):&lt;br /&gt;
Check https://dist.ipfs.tech/kubo/ for the latest version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt update &amp;amp;&amp;amp; apt upgrade -y&lt;br /&gt;
wget https://dist.ipfs.tech/kubo/v0.18.1/kubo_v0.18.1_linux-amd64.tar.gz&lt;br /&gt;
tar xvf kubo_v0.18.1_linux-amd64.tar.gz&lt;br /&gt;
bash kubo/install.sh&lt;br /&gt;
ipfs init&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may encounter an error that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ERROR provider.queue queue/queue.go:125 Failed to enqueue cid: leveldb: closed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This error does not impact the installation.&lt;br /&gt;
&lt;br /&gt;
Now, create a simple text file. Replace &#039;&#039;&#039;$EDITOR&#039;&#039;&#039; with your preferred terminal text editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR helloworld.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add the following content to the file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Hello there, I wonder how many devices I can see this on.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To share the file, you need to add and pin it:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs add helloworld.txt&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The command will return a CID, which looks like this:&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;QmQTnvc5eV7NdPfQ8zLVCr6gBrXaDAUKUd1SGDAfsPFnoh.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Now, pin the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs pin add QmQTnvc5eV7NdPfQ8zLVCr6gBrXaDAUKUd1SGDAfsPFnoh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Connect to the network:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs daemon&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use &#039;&#039;&#039;CTRL+z&#039;&#039;&#039; to send the IPFS daemon to the background and run &#039;&#039;&#039;ipfs swarm peers&#039;&#039;&#039; to see connections.&lt;br /&gt;
To bring the IPFS daemon back to the foreground, use &#039;&#039;&#039;bg&#039;&#039;&#039; to see background processes and then &#039;&#039;&#039;fg 1&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Note: &#039;&#039;&#039;ipfs.io&#039;&#039;&#039; is a third-party service and cannot handle data-heavy content. For heavy content, such as videos, download using IPFS to view.&lt;br /&gt;
&lt;br /&gt;
To view the file in a web browser, simply add &#039;&#039;&#039;https://ipfs.io/ipfs/&#039;&#039;&#039; to the beginning of the CID:&lt;br /&gt;
&lt;br /&gt;
https://ipfs.io/ipfs/QmQTnvc5eV7NdPfQ8zLVCr6gBrXaDAUKUd1SGDAfsPFnoh&lt;br /&gt;
&lt;br /&gt;
==IPFS Desktop==&lt;br /&gt;
&amp;lt;code&amp;gt;https://github.com/ipfs/ipfs-desktop/releases&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Download and share==&lt;br /&gt;
&amp;lt;b&amp;gt;$HASH&amp;lt;/b&amp;gt; is placeholder for the hash of the ipfs file.&amp;lt;br&amp;gt;&lt;br /&gt;
To download a file:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs get $HASH&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
To share/host you need to pin:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs pin $HASH&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
To view pinned items&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs pin ls&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
or&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs pin ls --type=recursive&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===add directory===&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs add --recursive /path/to/directory&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
each file in directory (recursive) will be uploaded and each given a hash.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===unpin===&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs pin rm $HASH&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
===Clear cache===&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs repo gc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===View on web browser===&lt;br /&gt;
Note: ipfs.io is a third party service, and can not handle data heavy content. For heavy content such as videos, download using ipfs to view.&amp;lt;br&amp;gt;&lt;br /&gt;
Use web site/service ipfs.io&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;https://ipfs.io/ipfs/$HASH&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Host on Server==&lt;br /&gt;
&amp;lt;code&amp;gt;wget https://dist.ipfs.tech/kubo/v0.18.1/kubo_v0.18.1_linux-amd64.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tar xvf kubo_v0.18.1_linux-amd64.tar.gz&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;bash kubo/install.sh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs init --profile server&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===systemd===&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR /etc/systemd/system/ipfs.service&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Unit]&lt;br /&gt;
Description =Start ipfs daemon&lt;br /&gt;
&lt;br /&gt;
[Service]&lt;br /&gt;
Type=simple&lt;br /&gt;
ExecStart=/usr/local/bin/ipfs daemon&lt;br /&gt;
&lt;br /&gt;
[Install]&lt;br /&gt;
WantedBy=multi-user.target&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl enable ipfs.service&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;systemctl start ipfs&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Note: will tidy later ==&lt;br /&gt;
&lt;br /&gt;
NOTE: should of checked the licence first,The MIT open course ware is &amp;lt;b&amp;gt;CC BY-NC-SA 4.0&amp;lt;/b&amp;gt; and can not be used on this website! deleteing, leaving this here for note on how to pin mass of files.&amp;lt;br&amp;gt;&lt;br /&gt;
In this example i will be uploading an MIT cc-by course to ipfs.&lt;br /&gt;
&lt;br /&gt;
files in a directory called &amp;lt;b&amp;gt;mit-test-course&amp;lt;/b&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs add --recursive /path/to/directory&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; will add all the files but not pin them.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@ipfs-test:~# tree mit-test-course/&lt;br /&gt;
mit-test-course/&lt;br /&gt;
├── 1&lt;br /&gt;
│   ├── 920cc911b6eb5747f2ccd431bbc4306b_lec1.py&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_01_300k.mp4&lt;br /&gt;
│   └── e921a690079369751bcce3e34da6c6ee_MIT6_0001F16_Lec1.pdf&lt;br /&gt;
├── 10&lt;br /&gt;
│   ├── 066eba6ea6d56a88e56ae325940d4c4c_MIT6_0001F16_Lec10.pdf&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_10_300k.mp4&lt;br /&gt;
│   └── bfa32fd241d88ae02cd3157aed232bac_lec10_complexity_part1.py&lt;br /&gt;
├── 11&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_11_300k.mp4&lt;br /&gt;
│   ├── bb953fb81d4afa3bc837c16eba613955_MIT6_0001F16_Lec11.pdf&lt;br /&gt;
│   └── bdf800867e6762c6758ecd2230178f41_lec11_complexity_part2.py&lt;br /&gt;
├── 12&lt;br /&gt;
│   ├── 310536cd5f5aa1fc0c11726ce13c565e_lec12_sorting.py&lt;br /&gt;
│   ├── 6425d0dabb1cea1a076b8c46c0ae2da6_MIT6_0001F16_Lec12.pdf&lt;br /&gt;
│   └── MIT6_0001F16_Lecture_12_300k.mp4&lt;br /&gt;
├── 2&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_02_300k.mp4&lt;br /&gt;
│   ├── ba2947b25b1580e4a84df0ec5dbe5cdd_MIT6_0001F16_Lec2.pdf&lt;br /&gt;
│   └── d6ee838ee4c85ace93a4e170cfd83c03_lec2_branch_loops.py&lt;br /&gt;
├── 3&lt;br /&gt;
│   ├── 88de925a1fb925e46a08bc5f34d029bd_lec3_strings_algos.py&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_03_300k.mp4&lt;br /&gt;
│   └── b9b9a82a29e8746db1facfbd30c07940_MIT6_0001F16_Lec3.pdf&lt;br /&gt;
├── 4&lt;br /&gt;
│   ├── 6ba59859535f1566dd57a7279aeba5d1_MIT6_0001F16_Lec4.pdf&lt;br /&gt;
│   ├── 9e8439a27af18817e046ac37333d03f6_lec4_functions.py&lt;br /&gt;
│   └── MIT6_0001F16_Lecture_04_300k.mp4&lt;br /&gt;
├── 5&lt;br /&gt;
│   ├── 1776670e271578eeb99fc25975f20586_MIT6_0001F16_Lec5.pdf&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_05_300k.mp4&lt;br /&gt;
│   └── cdf5f8e7f109952655f4d253ed955555_lec5_tuples_lists.py&lt;br /&gt;
├── 6&lt;br /&gt;
│   ├── 706228e592761d9c7c1c073f8ba7a6cc_lec6_recursion_dictionaries.py&lt;br /&gt;
│   ├── 876348c652c5353daccc96e1b7d577bb_MIT6_0001F16_Lec6.pdf&lt;br /&gt;
│   └── MIT6_0001F16_Lecture_06_300k.mp4&lt;br /&gt;
├── 7&lt;br /&gt;
│   ├── 51bdde43dfd773ba20747ce5d89119ac_MIT6_0001F16_Lec7.pdf&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_07_300k.mp4&lt;br /&gt;
│   └── abdd1d61892ccce9be2ad84e52004e07_lec7_debug_except.py&lt;br /&gt;
├── 8&lt;br /&gt;
│   ├── 0705ac9dcc7e637a0e8e9d97eb258a26_lec8_classes.py&lt;br /&gt;
│   ├── 7a6f85d03f132dcd9d7592bc4643be1c_MIT6_0001F16_Lec8.pdf&lt;br /&gt;
│   └── MIT6_0001F16_Lecture_08_300k.mp4&lt;br /&gt;
├── 9&lt;br /&gt;
│   ├── 2dd6c75e7b4bd6bd135078e6f3701201_MIT6_0001F16_Lec9.pdf&lt;br /&gt;
│   ├── MIT6_0001F16_Lecture_09_300k.mp4&lt;br /&gt;
│   └── bf8e8195044d5f6aefc1a455968e2f3e_lec9_inheritance.py&lt;br /&gt;
└── Introduction to Computer Science and Programming in Python.txt&lt;br /&gt;
&lt;br /&gt;
12 directories, 37 files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ipfs add --recursive /path/to/mit-test-course &amp;gt; mit.txt&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; will upload and create a file called mit.txt with the following output:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@ipfs-test:~# cat mit.txt &lt;br /&gt;
added QmengUgSy9oY9qMXJC6ujKy7mMpunb5sG5Uo8RpFX4G5g9 mit-test-course/1/920cc911b6eb5747f2ccd431bbc4306b_lec1.py&lt;br /&gt;
added QmaTdTMxWdz6ySLbx258zQU5McpJTo4ZEVJ63GSKmVEyeM mit-test-course/1/MIT6_0001F16_Lecture_01_300k.mp4&lt;br /&gt;
added QmemB25bVuN2fuiAq3JaDM4J5MYit6HfCCsU3EFTWL7wpF mit-test-course/1/e921a690079369751bcce3e34da6c6ee_MIT6_0001F16_Lec1.pdf&lt;br /&gt;
added QmbyP59ttPKGe5ZNADsgqTsgBF3oYGzhZXFfBhszG2nuPm mit-test-course/10/066eba6ea6d56a88e56ae325940d4c4c_MIT6_0001F16_Lec10.pdf&lt;br /&gt;
added QmQNooq1g25LFp1Fxj2tfpKKMKi8NbutkhuXNf5Ppo7t5f mit-test-course/10/MIT6_0001F16_Lecture_10_300k.mp4&lt;br /&gt;
added QmUtgXQXjj2C3qb2UXFrPmKHkFdEjmehk4ZLQhcZ37rEmw mit-test-course/10/bfa32fd241d88ae02cd3157aed232bac_lec10_complexity_part1.py&lt;br /&gt;
added QmR7Ned6iZytjpVHVN6W53EZ5Qg4Zd6EkEcXxn8DjYMgrd mit-test-course/11/MIT6_0001F16_Lecture_11_300k.mp4&lt;br /&gt;
added QmNPjN3616QdmEWLPokwuTkLL1vrzcLVRSFLWUcukqtxZL mit-test-course/11/bb953fb81d4afa3bc837c16eba613955_MIT6_0001F16_Lec11.pdf&lt;br /&gt;
added QmdpwFTFkwnkqWW3CozBBAfeYHchDeVAV7ArkA1dUqbUZ4 mit-test-course/11/bdf800867e6762c6758ecd2230178f41_lec11_complexity_part2.py&lt;br /&gt;
added QmbV8ct8DEQyRGRDSX4PaQBXk8r8ryYLDNwTa2buC7kcP5 mit-test-course/12/310536cd5f5aa1fc0c11726ce13c565e_lec12_sorting.py&lt;br /&gt;
added QmToP68Knz71euVuntRWtz6UshRoiRssELJNFMeP1f2sR5 mit-test-course/12/6425d0dabb1cea1a076b8c46c0ae2da6_MIT6_0001F16_Lec12.pdf&lt;br /&gt;
added QmPWidAv5mBrgEcKDVqWe62JaAiwBWs8KZc1S8r3bbJsvY mit-test-course/12/MIT6_0001F16_Lecture_12_300k.mp4&lt;br /&gt;
added QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9 mit-test-course/2/MIT6_0001F16_Lecture_02_300k.mp4&lt;br /&gt;
added QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK mit-test-course/2/ba2947b25b1580e4a84df0ec5dbe5cdd_MIT6_0001F16_Lec2.pdf&lt;br /&gt;
added QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK mit-test-course/2/d6ee838ee4c85ace93a4e170cfd83c03_lec2_branch_loops.py&lt;br /&gt;
added QmYppDgGMptihHA7ixFw2GHvspN8Bw1HY21HtUpQNxi23i mit-test-course/3/88de925a1fb925e46a08bc5f34d029bd_lec3_strings_algos.py&lt;br /&gt;
added QmTTCsuhbnjXWuigZLSgKAt4DjFsm78MANo3KUMGcK98s1 mit-test-course/3/MIT6_0001F16_Lecture_03_300k.mp4&lt;br /&gt;
added QmP2AZfUx8RTqCGamJtPyodFU8dHG8QrBHYKkP79YepEe9 mit-test-course/3/b9b9a82a29e8746db1facfbd30c07940_MIT6_0001F16_Lec3.pdf&lt;br /&gt;
added QmP1p4h21ogMxWeeX2PiDibQbHqWer7ABCsMrfMxEx7QBW mit-test-course/4/6ba59859535f1566dd57a7279aeba5d1_MIT6_0001F16_Lec4.pdf&lt;br /&gt;
added QmNtPQncXMYNBnX4NoNfx2ifetrfvrATamdrsjx4u9iQ7c mit-test-course/4/9e8439a27af18817e046ac37333d03f6_lec4_functions.py&lt;br /&gt;
added QmQuc5zpaJdMfRYxTLyZc5DQuota1FjuJiqgWf8ctGmRsU mit-test-course/4/MIT6_0001F16_Lecture_04_300k.mp4&lt;br /&gt;
added QmSdxg2inPbK1FSynNdPUka6CUZtEGG6sdPZgxaAgb46GE mit-test-course/5/1776670e271578eeb99fc25975f20586_MIT6_0001F16_Lec5.pdf&lt;br /&gt;
added Qmco5sKKQfnWUNP9ZUxLkDhoV6jfjv8L4AdzES7En41AzP mit-test-course/5/MIT6_0001F16_Lecture_05_300k.mp4&lt;br /&gt;
added QmThDori5ETa3U27DFpndU7RmsLgG7zjpqGVxAncCupSuc mit-test-course/5/cdf5f8e7f109952655f4d253ed955555_lec5_tuples_lists.py&lt;br /&gt;
added QmaGhNYnR5yUMYZf4q7qLsNwEW6B7pbLbgJokJBTNSA2FT mit-test-course/6/706228e592761d9c7c1c073f8ba7a6cc_lec6_recursion_dictionaries.py&lt;br /&gt;
added QmQAqSGJAeoypUMyUnb7hRrziDyRAwymcTGdcaydT5i73s mit-test-course/6/876348c652c5353daccc96e1b7d577bb_MIT6_0001F16_Lec6.pdf&lt;br /&gt;
added QmVzK3PVETv69Y27UKDfaQQM5um8ByMdYQS3TzD2EkoR42 mit-test-course/6/MIT6_0001F16_Lecture_06_300k.mp4&lt;br /&gt;
added QmcqZoeVrsfBv4Ri6M8KtiLdy3VpKnyznDFhX8zvfd3Qrs mit-test-course/7/51bdde43dfd773ba20747ce5d89119ac_MIT6_0001F16_Lec7.pdf&lt;br /&gt;
added QmUyiqpAUA91w4Xm2Dz2wPr6kE6wTzA1apwJziTdBysRLw mit-test-course/7/MIT6_0001F16_Lecture_07_300k.mp4&lt;br /&gt;
added QmeVKCB6ponYr4f72MuNwegukX9t42NTywNHpDPgyNi9ae mit-test-course/7/abdd1d61892ccce9be2ad84e52004e07_lec7_debug_except.py&lt;br /&gt;
added QmQCaZZA75UQ5pAKy8zhcz6Ci8yY13UVHUvsuXmid86GUH mit-test-course/8/0705ac9dcc7e637a0e8e9d97eb258a26_lec8_classes.py&lt;br /&gt;
added QmdccChFuYBCiLmufEmk6oXCHybaUQiPXajD3c3xMupiaC mit-test-course/8/7a6f85d03f132dcd9d7592bc4643be1c_MIT6_0001F16_Lec8.pdf&lt;br /&gt;
added QmZFSSPndvRfPT2vyehuyEQitfb8CzdYkA7orFAKyvhA4u mit-test-course/8/MIT6_0001F16_Lecture_08_300k.mp4&lt;br /&gt;
added QmbaJFk4mFRmCbtQybK94etyfRA2LcM22Kfvjbvdf6X8Gw mit-test-course/9/2dd6c75e7b4bd6bd135078e6f3701201_MIT6_0001F16_Lec9.pdf&lt;br /&gt;
added QmdENonCipE7TK99i7dFz9paqDUSefR4PFdveEmVi5oXAb mit-test-course/9/MIT6_0001F16_Lecture_09_300k.mp4&lt;br /&gt;
added QmQ7UB4PaGBRHvHfDshrASwynvansFVXrp3RNULwhThUsC mit-test-course/9/bf8e8195044d5f6aefc1a455968e2f3e_lec9_inheritance.py&lt;br /&gt;
added Qmdw2XaaX99t7eNzRNXdHEHYzwiH5qhg1iBLDpekCXj5am mit-test-course/Introduction to Computer Science and Programming in Python.txt&lt;br /&gt;
added QmQM6QEJK9kJGzxe1ntDKrE7nLtB9CPqupjQZvsEze6rkK mit-test-course/1&lt;br /&gt;
added QmX7ZEHg2WipkSbwani5iSwxtBPgghajtGP1QqJQ6jQAAE mit-test-course/10&lt;br /&gt;
added QmaUyBU3M5zFpeHrMdZbapSLf73SUHZaookrCRCRm87Jwb mit-test-course/11&lt;br /&gt;
added QmP3Xx9cUp9Ly44bP1TXQHziVpLpNuZDnH7nRhdQTJPk5w mit-test-course/12&lt;br /&gt;
added QmYQQLN4pEdKi7S8GJJLFtw4LCEiZPkUzRjyNJqNcrU7kS mit-test-course/2&lt;br /&gt;
added QmZvUavbLwZ5PjiadoGSvB8nURGaeDiTyNivZq9tsPN1dD mit-test-course/3&lt;br /&gt;
added QmWf7uJtJmBhLB4sAsWUDWGwPyz24yboHYqxZGpEAwP4Gx mit-test-course/4&lt;br /&gt;
added QmPAApNSDbgZnr1tVe77zPx8bz3USsP4UZxA6nCCSMEbRx mit-test-course/5&lt;br /&gt;
added QmPMEUkViQsT7XwfPxwque3EfmPs1kaVJCU5Bc8AujYfej mit-test-course/6&lt;br /&gt;
added QmWnzp23vzhx8rX5z7W9WZVWGq2H8j18GmqddbHRa79jX1 mit-test-course/7&lt;br /&gt;
added QmRnosvcFPgEZSGMyRw9uuTyDzcQf6Q2ffEXADYEFvqtsN mit-test-course/8&lt;br /&gt;
added QmeUE3L3gwNvK3BvcutttWxSJPn7RusxNZHzTQeYUNGzjw mit-test-course/9&lt;br /&gt;
added QmY965P9FuqBum5Ppy7QWUf1HBRVdqDbMFVDStBdjNnjqk mit-test-course&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now we are going to use awk to just print out the hashes.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cat mit.txt | awk &#039;{print $2}&#039; &amp;gt;hash.txt&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;cat hash.txt&amp;lt;/code&amp;gt; will return:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@ipfs-test:~# cat hash.txt &lt;br /&gt;
QmengUgSy9oY9qMXJC6ujKy7mMpunb5sG5Uo8RpFX4G5g9&lt;br /&gt;
QmaTdTMxWdz6ySLbx258zQU5McpJTo4ZEVJ63GSKmVEyeM&lt;br /&gt;
QmemB25bVuN2fuiAq3JaDM4J5MYit6HfCCsU3EFTWL7wpF&lt;br /&gt;
QmbyP59ttPKGe5ZNADsgqTsgBF3oYGzhZXFfBhszG2nuPm&lt;br /&gt;
QmQNooq1g25LFp1Fxj2tfpKKMKi8NbutkhuXNf5Ppo7t5f&lt;br /&gt;
QmUtgXQXjj2C3qb2UXFrPmKHkFdEjmehk4ZLQhcZ37rEmw&lt;br /&gt;
QmR7Ned6iZytjpVHVN6W53EZ5Qg4Zd6EkEcXxn8DjYMgrd&lt;br /&gt;
QmNPjN3616QdmEWLPokwuTkLL1vrzcLVRSFLWUcukqtxZL&lt;br /&gt;
QmdpwFTFkwnkqWW3CozBBAfeYHchDeVAV7ArkA1dUqbUZ4&lt;br /&gt;
QmbV8ct8DEQyRGRDSX4PaQBXk8r8ryYLDNwTa2buC7kcP5&lt;br /&gt;
QmToP68Knz71euVuntRWtz6UshRoiRssELJNFMeP1f2sR5&lt;br /&gt;
QmPWidAv5mBrgEcKDVqWe62JaAiwBWs8KZc1S8r3bbJsvY&lt;br /&gt;
QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9&lt;br /&gt;
QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK&lt;br /&gt;
QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK&lt;br /&gt;
QmYppDgGMptihHA7ixFw2GHvspN8Bw1HY21HtUpQNxi23i&lt;br /&gt;
QmTTCsuhbnjXWuigZLSgKAt4DjFsm78MANo3KUMGcK98s1&lt;br /&gt;
QmP2AZfUx8RTqCGamJtPyodFU8dHG8QrBHYKkP79YepEe9&lt;br /&gt;
QmP1p4h21ogMxWeeX2PiDibQbHqWer7ABCsMrfMxEx7QBW&lt;br /&gt;
QmNtPQncXMYNBnX4NoNfx2ifetrfvrATamdrsjx4u9iQ7c&lt;br /&gt;
QmQuc5zpaJdMfRYxTLyZc5DQuota1FjuJiqgWf8ctGmRsU&lt;br /&gt;
QmSdxg2inPbK1FSynNdPUka6CUZtEGG6sdPZgxaAgb46GE&lt;br /&gt;
Qmco5sKKQfnWUNP9ZUxLkDhoV6jfjv8L4AdzES7En41AzP&lt;br /&gt;
QmThDori5ETa3U27DFpndU7RmsLgG7zjpqGVxAncCupSuc&lt;br /&gt;
QmaGhNYnR5yUMYZf4q7qLsNwEW6B7pbLbgJokJBTNSA2FT&lt;br /&gt;
QmQAqSGJAeoypUMyUnb7hRrziDyRAwymcTGdcaydT5i73s&lt;br /&gt;
QmVzK3PVETv69Y27UKDfaQQM5um8ByMdYQS3TzD2EkoR42&lt;br /&gt;
QmcqZoeVrsfBv4Ri6M8KtiLdy3VpKnyznDFhX8zvfd3Qrs&lt;br /&gt;
QmUyiqpAUA91w4Xm2Dz2wPr6kE6wTzA1apwJziTdBysRLw&lt;br /&gt;
QmeVKCB6ponYr4f72MuNwegukX9t42NTywNHpDPgyNi9ae&lt;br /&gt;
QmQCaZZA75UQ5pAKy8zhcz6Ci8yY13UVHUvsuXmid86GUH&lt;br /&gt;
QmdccChFuYBCiLmufEmk6oXCHybaUQiPXajD3c3xMupiaC&lt;br /&gt;
QmZFSSPndvRfPT2vyehuyEQitfb8CzdYkA7orFAKyvhA4u&lt;br /&gt;
QmbaJFk4mFRmCbtQybK94etyfRA2LcM22Kfvjbvdf6X8Gw&lt;br /&gt;
QmdENonCipE7TK99i7dFz9paqDUSefR4PFdveEmVi5oXAb&lt;br /&gt;
QmQ7UB4PaGBRHvHfDshrASwynvansFVXrp3RNULwhThUsC&lt;br /&gt;
Qmdw2XaaX99t7eNzRNXdHEHYzwiH5qhg1iBLDpekCXj5am&lt;br /&gt;
QmQM6QEJK9kJGzxe1ntDKrE7nLtB9CPqupjQZvsEze6rkK&lt;br /&gt;
QmX7ZEHg2WipkSbwani5iSwxtBPgghajtGP1QqJQ6jQAAE&lt;br /&gt;
QmaUyBU3M5zFpeHrMdZbapSLf73SUHZaookrCRCRm87Jwb&lt;br /&gt;
QmP3Xx9cUp9Ly44bP1TXQHziVpLpNuZDnH7nRhdQTJPk5w&lt;br /&gt;
QmYQQLN4pEdKi7S8GJJLFtw4LCEiZPkUzRjyNJqNcrU7kS&lt;br /&gt;
QmZvUavbLwZ5PjiadoGSvB8nURGaeDiTyNivZq9tsPN1dD&lt;br /&gt;
QmWf7uJtJmBhLB4sAsWUDWGwPyz24yboHYqxZGpEAwP4Gx&lt;br /&gt;
QmPAApNSDbgZnr1tVe77zPx8bz3USsP4UZxA6nCCSMEbRx&lt;br /&gt;
QmPMEUkViQsT7XwfPxwque3EfmPs1kaVJCU5Bc8AujYfej&lt;br /&gt;
QmWnzp23vzhx8rX5z7W9WZVWGq2H8j18GmqddbHRa79jX1&lt;br /&gt;
QmRnosvcFPgEZSGMyRw9uuTyDzcQf6Q2ffEXADYEFvqtsN&lt;br /&gt;
QmeUE3L3gwNvK3BvcutttWxSJPn7RusxNZHzTQeYUNGzjw&lt;br /&gt;
QmY965P9FuqBum5Ppy7QWUf1HBRVdqDbMFVDStBdjNnjqk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Can do in terminal but will make bash script.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$EDITOR pin-hash.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
while read p; do&lt;br /&gt;
        ipfs pin add $p&lt;br /&gt;
done &amp;lt;hash.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;bash pin-hash.sh&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@ipfs-test:~# bash pin-hash.sh &lt;br /&gt;
pinned QmengUgSy9oY9qMXJC6ujKy7mMpunb5sG5Uo8RpFX4G5g9 recursively&lt;br /&gt;
pinned QmaTdTMxWdz6ySLbx258zQU5McpJTo4ZEVJ63GSKmVEyeM recursively&lt;br /&gt;
pinned QmemB25bVuN2fuiAq3JaDM4J5MYit6HfCCsU3EFTWL7wpF recursively&lt;br /&gt;
pinned QmbyP59ttPKGe5ZNADsgqTsgBF3oYGzhZXFfBhszG2nuPm recursively&lt;br /&gt;
pinned QmQNooq1g25LFp1Fxj2tfpKKMKi8NbutkhuXNf5Ppo7t5f recursively&lt;br /&gt;
pinned QmUtgXQXjj2C3qb2UXFrPmKHkFdEjmehk4ZLQhcZ37rEmw recursively&lt;br /&gt;
pinned QmR7Ned6iZytjpVHVN6W53EZ5Qg4Zd6EkEcXxn8DjYMgrd recursively&lt;br /&gt;
pinned QmNPjN3616QdmEWLPokwuTkLL1vrzcLVRSFLWUcukqtxZL recursively&lt;br /&gt;
pinned QmdpwFTFkwnkqWW3CozBBAfeYHchDeVAV7ArkA1dUqbUZ4 recursively&lt;br /&gt;
pinned QmbV8ct8DEQyRGRDSX4PaQBXk8r8ryYLDNwTa2buC7kcP5 recursively&lt;br /&gt;
pinned QmToP68Knz71euVuntRWtz6UshRoiRssELJNFMeP1f2sR5 recursively&lt;br /&gt;
pinned QmPWidAv5mBrgEcKDVqWe62JaAiwBWs8KZc1S8r3bbJsvY recursively&lt;br /&gt;
pinned QmTFdkMJnzUcwgs1hdoF7qtADE2NqTJVaF9CfgULbzSuA9 recursively&lt;br /&gt;
pinned QmNiZvEh6UmpHLTxw4saN7WdojzBokp2JCbucYzrekoQBK recursively&lt;br /&gt;
pinned QmPjEzEu56mqeE19Vth9AkDbAxz7wAWg9zMVvF9FZ1UBvK recursively&lt;br /&gt;
pinned QmYppDgGMptihHA7ixFw2GHvspN8Bw1HY21HtUpQNxi23i recursively&lt;br /&gt;
pinned QmTTCsuhbnjXWuigZLSgKAt4DjFsm78MANo3KUMGcK98s1 recursively&lt;br /&gt;
pinned QmP2AZfUx8RTqCGamJtPyodFU8dHG8QrBHYKkP79YepEe9 recursively&lt;br /&gt;
pinned QmP1p4h21ogMxWeeX2PiDibQbHqWer7ABCsMrfMxEx7QBW recursively&lt;br /&gt;
pinned QmNtPQncXMYNBnX4NoNfx2ifetrfvrATamdrsjx4u9iQ7c recursively&lt;br /&gt;
pinned QmQuc5zpaJdMfRYxTLyZc5DQuota1FjuJiqgWf8ctGmRsU recursively&lt;br /&gt;
pinned QmSdxg2inPbK1FSynNdPUka6CUZtEGG6sdPZgxaAgb46GE recursively&lt;br /&gt;
pinned Qmco5sKKQfnWUNP9ZUxLkDhoV6jfjv8L4AdzES7En41AzP recursively&lt;br /&gt;
pinned QmThDori5ETa3U27DFpndU7RmsLgG7zjpqGVxAncCupSuc recursively&lt;br /&gt;
pinned QmaGhNYnR5yUMYZf4q7qLsNwEW6B7pbLbgJokJBTNSA2FT recursively&lt;br /&gt;
pinned QmQAqSGJAeoypUMyUnb7hRrziDyRAwymcTGdcaydT5i73s recursively&lt;br /&gt;
pinned QmVzK3PVETv69Y27UKDfaQQM5um8ByMdYQS3TzD2EkoR42 recursively&lt;br /&gt;
pinned QmcqZoeVrsfBv4Ri6M8KtiLdy3VpKnyznDFhX8zvfd3Qrs recursively&lt;br /&gt;
pinned QmUyiqpAUA91w4Xm2Dz2wPr6kE6wTzA1apwJziTdBysRLw recursively&lt;br /&gt;
pinned QmeVKCB6ponYr4f72MuNwegukX9t42NTywNHpDPgyNi9ae recursively&lt;br /&gt;
pinned QmQCaZZA75UQ5pAKy8zhcz6Ci8yY13UVHUvsuXmid86GUH recursively&lt;br /&gt;
pinned QmdccChFuYBCiLmufEmk6oXCHybaUQiPXajD3c3xMupiaC recursively&lt;br /&gt;
pinned QmZFSSPndvRfPT2vyehuyEQitfb8CzdYkA7orFAKyvhA4u recursively&lt;br /&gt;
pinned QmbaJFk4mFRmCbtQybK94etyfRA2LcM22Kfvjbvdf6X8Gw recursively&lt;br /&gt;
pinned QmdENonCipE7TK99i7dFz9paqDUSefR4PFdveEmVi5oXAb recursively&lt;br /&gt;
pinned QmQ7UB4PaGBRHvHfDshrASwynvansFVXrp3RNULwhThUsC recursively&lt;br /&gt;
pinned Qmdw2XaaX99t7eNzRNXdHEHYzwiH5qhg1iBLDpekCXj5am recursively&lt;br /&gt;
pinned QmQM6QEJK9kJGzxe1ntDKrE7nLtB9CPqupjQZvsEze6rkK recursively&lt;br /&gt;
pinned QmX7ZEHg2WipkSbwani5iSwxtBPgghajtGP1QqJQ6jQAAE recursively&lt;br /&gt;
pinned QmaUyBU3M5zFpeHrMdZbapSLf73SUHZaookrCRCRm87Jwb recursively&lt;br /&gt;
pinned QmP3Xx9cUp9Ly44bP1TXQHziVpLpNuZDnH7nRhdQTJPk5w recursively&lt;br /&gt;
pinned QmYQQLN4pEdKi7S8GJJLFtw4LCEiZPkUzRjyNJqNcrU7kS recursively&lt;br /&gt;
pinned QmZvUavbLwZ5PjiadoGSvB8nURGaeDiTyNivZq9tsPN1dD recursively&lt;br /&gt;
pinned QmWf7uJtJmBhLB4sAsWUDWGwPyz24yboHYqxZGpEAwP4Gx recursively&lt;br /&gt;
pinned QmPAApNSDbgZnr1tVe77zPx8bz3USsP4UZxA6nCCSMEbRx recursively&lt;br /&gt;
pinned QmPMEUkViQsT7XwfPxwque3EfmPs1kaVJCU5Bc8AujYfej recursively&lt;br /&gt;
pinned QmWnzp23vzhx8rX5z7W9WZVWGq2H8j18GmqddbHRa79jX1 recursively&lt;br /&gt;
pinned QmRnosvcFPgEZSGMyRw9uuTyDzcQf6Q2ffEXADYEFvqtsN recursively&lt;br /&gt;
pinned QmeUE3L3gwNvK3BvcutttWxSJPn7RusxNZHzTQeYUNGzjw recursively&lt;br /&gt;
pinned QmY965P9FuqBum5Ppy7QWUf1HBRVdqDbMFVDStBdjNnjqk recursively&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==bash script to pin recursive directory to IPFS==&lt;br /&gt;
&lt;br /&gt;
to use &amp;lt;code&amp;gt;script.sh /path/to/directory&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; line&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
# Check if directory argument is provided&lt;br /&gt;
if [ -z &amp;quot;$1&amp;quot; ]; then&lt;br /&gt;
  echo &amp;quot;Usage: script.sh /path/to/directory&amp;quot;&lt;br /&gt;
  exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Check if IPFS is installed&lt;br /&gt;
if ! command -v ipfs &amp;amp;&amp;gt; /dev/null; then&lt;br /&gt;
  echo &amp;quot;IPFS is not installed. Please install it first.&amp;quot;&lt;br /&gt;
  exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Set directory path and filenames&lt;br /&gt;
dir_path=&amp;quot;$1&amp;quot;&lt;br /&gt;
ipfs_list=&amp;quot;/tmp/ipfs_$(date +&#039;%Y%m%d%H%M%S&#039;).list&amp;quot;&lt;br /&gt;
ipfs_hash=&amp;quot;/tmp/ipfs_$(date +&#039;%Y%m%d%H%M%S&#039;).hash&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Add directory to IPFS and save output to temporary file&lt;br /&gt;
ipfs add --recursive &amp;quot;$dir_path&amp;quot; &amp;gt; &amp;quot;$ipfs_list&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Extract IPFS hashes from list and save to temporary file&lt;br /&gt;
cat &amp;quot;$ipfs_list&amp;quot; | awk &#039;{print $2}&#039; &amp;gt; &amp;quot;$ipfs_hash&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Pin each hash from temporary file&lt;br /&gt;
while read -r hash; do&lt;br /&gt;
  ipfs pin add &amp;quot;$hash&amp;quot;&lt;br /&gt;
done &amp;lt; &amp;quot;$ipfs_hash&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Clean up temporary files&lt;br /&gt;
rm &amp;quot;$ipfs_list&amp;quot; &amp;quot;$ipfs_hash&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how the script works:&lt;br /&gt;
&lt;br /&gt;
:    It first checks if a directory path argument is provided. If not, it prints the usage instructions and exits.&lt;br /&gt;
&lt;br /&gt;
:    It checks if IPFS is installed by checking if the ipfs command is available. If not, it prints an error message and exits.&lt;br /&gt;
&lt;br /&gt;
:    It sets the directory path and temporary filenames for the IPFS list and hash.&lt;br /&gt;
&lt;br /&gt;
:    It adds the specified directory to IPFS recursively using the ipfs add command and saves the output to the temporary IPFS list file.&lt;br /&gt;
&lt;br /&gt;
:    It extracts the IPFS hashes from the list file and saves them to the temporary IPFS hash file.&lt;br /&gt;
&lt;br /&gt;
:    It loops through each hash in the temporary hash file and pins it using the ipfs pin add command.&lt;br /&gt;
&lt;br /&gt;
:    Finally, it cleans up the temporary files.&lt;br /&gt;
&lt;br /&gt;
Note that this script will create new temporary files with a timestamp appended to the filename each time it is run. This is to avoid overwriting any existing temporary files with the same name.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_SIGHUP&amp;diff=421</id>
		<title>DICTIONARY SIGHUP</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_SIGHUP&amp;diff=421"/>
		<updated>2023-05-11T19:08:00Z</updated>

		<summary type="html">&lt;p&gt;Noob: Noob moved page SIGHUP to DICTIONARY SIGHUP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;SIGHUP&#039;&#039;&#039;, or &#039;&#039;&#039;Signal Hangup&#039;&#039;&#039;, is a signal used in Unix and Unix-like operating systems to indicate that a controlling terminal or process has been disconnected. The term &amp;quot;hangup&amp;quot; comes from the days of dial-up modems when a user would physically hang up the phone to disconnect from a remote system. In the context of modern operating systems, SIGHUP is used for various purposes, including process control, configuration updates, and the proper termination of processes when the controlling terminal is closed.&lt;br /&gt;
&lt;br /&gt;
When a process receives a SIGHUP signal, it usually indicates that the controlling terminal or parent process has been closed or terminated. By default, when a process receives a SIGHUP signal, it will terminate itself. However, processes can be programmed to catch and handle the SIGHUP signal in a specific way, such as re-reading their configuration files or performing a graceful shutdown. This allows developers to ensure that important data is saved, resources are released, or any other necessary cleanup is performed before the process exits.&lt;br /&gt;
&lt;br /&gt;
For example, many Unix daemons (background processes) use SIGHUP to trigger a reload of their configuration files. When the daemon receives a SIGHUP signal, it reads the updated configuration without needing to be restarted. This is useful for making changes to a running system without disrupting its operation.&lt;br /&gt;
&lt;br /&gt;
To send a SIGHUP signal to a process, you can use the &#039;&#039;&#039;kill&#039;&#039;&#039; command with the &#039;&#039;&#039;-HUP&#039;&#039;&#039; or &#039;&#039;&#039;-1&#039;&#039;&#039; option, followed by the process ID (PID) of the target process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;kill -HUP &amp;lt;PID&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In summary, SIGHUP is a signal in Unix and Unix-like operating systems used to notify a process that its controlling terminal or parent process has been disconnected. It can be used for process control, configuration updates, and proper termination of processes. While the default behavior is to terminate the process upon receiving a SIGHUP signal, developers can program processes to handle the signal in a custom manner.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_SIGHUP&amp;diff=420</id>
		<title>DICTIONARY SIGHUP</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_SIGHUP&amp;diff=420"/>
		<updated>2023-05-11T19:07:36Z</updated>

		<summary type="html">&lt;p&gt;Noob: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;SIGHUP&#039;&#039;&#039;, or &#039;&#039;&#039;Signal Hangup&#039;&#039;&#039;, is a signal used in Unix and Unix-like operating systems to indicate that a controlling terminal or process has been disconnected. The term &amp;quot;hangup&amp;quot; comes from the days of dial-up modems when a user would physically hang up the phone to disconnect from a remote system. In the context of modern operating systems, SIGHUP is used for various purposes, including process control, configuration updates, and the proper termination of processes when the controlling terminal is closed.&lt;br /&gt;
&lt;br /&gt;
When a process receives a SIGHUP signal, it usually indicates that the controlling terminal or parent process has been closed or terminated. By default, when a process receives a SIGHUP signal, it will terminate itself. However, processes can be programmed to catch and handle the SIGHUP signal in a specific way, such as re-reading their configuration files or performing a graceful shutdown. This allows developers to ensure that important data is saved, resources are released, or any other necessary cleanup is performed before the process exits.&lt;br /&gt;
&lt;br /&gt;
For example, many Unix daemons (background processes) use SIGHUP to trigger a reload of their configuration files. When the daemon receives a SIGHUP signal, it reads the updated configuration without needing to be restarted. This is useful for making changes to a running system without disrupting its operation.&lt;br /&gt;
&lt;br /&gt;
To send a SIGHUP signal to a process, you can use the &#039;&#039;&#039;kill&#039;&#039;&#039; command with the &#039;&#039;&#039;-HUP&#039;&#039;&#039; or &#039;&#039;&#039;-1&#039;&#039;&#039; option, followed by the process ID (PID) of the target process:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;kill -HUP &amp;lt;PID&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In summary, SIGHUP is a signal in Unix and Unix-like operating systems used to notify a process that its controlling terminal or parent process has been disconnected. It can be used for process control, configuration updates, and proper termination of processes. While the default behavior is to terminate the process upon receiving a SIGHUP signal, developers can program processes to handle the signal in a custom manner.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
	<entry>
		<id>https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_concatenate&amp;diff=419</id>
		<title>DICTIONARY concatenate</title>
		<link rel="alternate" type="text/html" href="https://www.completenoobs.com/noobs/index.php?title=DICTIONARY_concatenate&amp;diff=419"/>
		<updated>2023-05-11T19:06:55Z</updated>

		<summary type="html">&lt;p&gt;Noob: Noob moved page Dictionary concatenate to DICTIONARY concatenate without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To concatenate means to join two or more strings, arrays, or other data structures together to form a single, combined unit. This action is frequently employed in programming languages and software applications when working with text or data.&lt;br /&gt;
&lt;br /&gt;
For example, consider the two strings &amp;quot;Hello&amp;quot; and &amp;quot;World&amp;quot;. When concatenated, they form a new string: &amp;quot;HelloWorld&amp;quot;. In many programming languages, the &#039;+&#039; operator or specific functions are used to concatenate strings or arrays.&lt;/div&gt;</summary>
		<author><name>Noob</name></author>
	</entry>
</feed>