Changes for page Configuring a VPS machine from scratch
Last modified by Alexandru Pentilescu on 2024/07/22 21:37
From version 4.2
edited by Alexandru Pentilescu
on 2022/11/13 22:08
on 2022/11/13 22:08
Change comment:
There is no comment for this version
To version 2.1
edited by Alexandru Pentilescu
on 2022/11/13 21:11
on 2022/11/13 21:11
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -8,11 +8,6 @@ 8 8 ))) 9 9 ))) 10 10 11 -(% class="col-xs-12 col-sm-4" %) 12 -((( 13 -{{box title="**Contents**"}}{{toc /}}{{/box}} 14 -))) 15 - 16 16 (% class="row" %) 17 17 ((( 18 18 (% class="col-xs-12 col-sm-8" %) ... ... @@ -22,95 +22,50 @@ 22 22 If you don't have an active user just yet, please do the following: 23 23 24 24 {{code language="bash"}} 25 -sudo adduser <newuser>20 +sudo adduser newuser 26 26 {{/code}} 27 27 28 -Please replace <newuser> with your username. 29 29 Then, to make them part of the sudoers file, just do: 30 30 31 31 {{code language="bash"}} 32 -sudo usermod -aG sudo <newuser>26 +sudo usermod -aG sudo newuser 33 33 {{/code}} 34 34 35 -== Using root vs.usingasudoers user ==29 +== Sub-paragraph == 36 36 37 -There's an argument to be made between just logging in as root on the system directly or using a separate users which is part of the sudoers file. 38 -Both are viable options for administrators to make configuration changes on the target system. 39 -Some people argue that adding other users to a system is just adding complexity and, especially if you plan to be the sole administrator of the VPS, it makes little sense not to use the already built-in root user. After all, root starts out with all the priviliges and, most importantly, you'll never have to remember to keep invoking "sudo" whenever you need to run administrative commands in the terminal. Because of this, this is seen as the superior approach. 31 +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 40 40 41 -However, others make the argument that constantly running as root is a security risk for the system as a whole. When running as root, any terminal command issued will also run with absolute privileges, which runs the risk of amplifying any human error to disastruous proportions. 42 -Granted, this risk also exists for sudoers users too, but only with the commands which are ran with "sudo". Having the extra step of manually prefixing each command with "sudo" is seen as a preventative measure of avoiding system damage. 43 -Moreover, if the administrator is diligent, they may retroactively change the sudoers users' permissions manually to only allow privilege escalation for commands which they deem safe to run, effectively blocking any risk for overly dangerous commands such as "dd" or "rm -Rf". 33 +== Sub-paragraph == 44 44 45 -Ultimately, the argument for or against using root access is mostly a philosophical one, rather than a technical one. There is no right or wrong answer to this question. Rather, each answer brings its own advantages and disadvantages to the table. What really matters is what you're more comfortable with using in the end. 46 -Moreover, using a sudoers user rather than root is not inherently a guarantee for system safety either and should not be taken as a leeway for running suspicious executable files from the internet either, as privilege escalation bugs have existed in the Linux kernel since its own inception. 35 +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 47 47 48 -= S ettingup automaticupdates=37 +=== Sub-sub paragraph === 49 49 50 - Systemupdates areanecessityformoderndayoperatingsystemsandonlinux,especially,there's a constant needorunsuch updates regurarlytoavoidtheriskofrunningvulnerablesoftware thatcanbe exploitedby roguemalware.39 +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 51 51 52 -Linux, in particular, is an attractive target for malware writers in recent years, due to the fact that corporate servers owned by renowned companies are seen as a more profitable compromise target for malicious actors who may wish to extort money from unpatched systems. 53 53 54 - Afterall, large corporations runningunpatched systems are more likely to pay significant amounts of money than loneprivate users if theirsystemswere to be compromised.42 += Paragraph 2 = 55 55 56 - Assuch,it'simperativetoprotectour systemsfromsuch damagebypreventingtheattacksinthefirstplace.Thefirststepin achievingthisgoalsbyconstantlypatchingthe system.Anda goodwaytodothis withoutrequiringmanualintervention issettingup automaticupdates.44 +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 57 57 58 - Debianbased systems have an officialpackage known as unattended-upgrades which can do just this. To install thispackage, please run thefollowing command:46 +== Sub-paragraph == 59 59 60 -{{code language="bash"}} 61 -sudo apt-get install unattended-upgrades 62 -{{/code}} 48 +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 63 63 64 - Thiswill install the package from the official repositories. After this, the package shouldbe configurable to the administrator by editing the /etc/apt/apt.conf.d/50unattended-upgrades file. This file should begenerated automatically after installing thepackage.50 +== Sub-paragraph == 65 65 66 -There's a lot of stuff which can be configured in this file. Some of the options which I personally prefer to activate by uncommenting are the following: 52 +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 53 +))) 67 67 68 -{{code language="none"}} 69 69 70 - //Thisoptioncontrolswhether the development releaseof Ubuntu will be71 - // upgraded automatically. Valid values are "true", "false", and "auto".72 - Unattended-Upgrade::DevRelease"auto";56 +(% class="col-xs-12 col-sm-4" %) 57 +((( 58 +{{box title="**Contents**"}}{{toc /}}{{/box}} 73 73 74 -// Send email to this address for problems or packages upgrades 75 -// If empty or unset then no email is sent, make sure that you 76 -// have a working mail setup on your system. A package that provides 77 -// 'mailx' must be installed. E.g. "user@example.com" 78 -Unattended-Upgrade::Mail "Alexandru.Pentilescu@disroot.org"; 79 -{{/code}} 60 +[[image:Templates.Article.Template.WebHome@image1.jpg||style="width: 100%"]] 61 +//Figure 1: [[Sea>>https://commons.wikimedia.org/wiki/File:Isle_of_Icacos_II.jpg]]// 80 80 81 -This lets the system know that I want for email notifications with respect to updates need to be delivered to that specific email address. This is important because, every time updates occur, this lets me know via email. Of course, you need to have an SMTP server running locally, as described in the previous step. 82 - 83 -Then: 84 - 85 -{{code language="none"}} 86 -// Remove unused automatically installed kernel-related packages 87 -// (kernel images, kernel headers and kernel version locked tools). 88 -Unattended-Upgrade::Remove-Unused-Kernel-Packages "true"; 89 - 90 -// Do automatic removal of newly unused dependencies after the upgrade 91 -Unattended-Upgrade::Remove-New-Unused-Dependencies "true"; 92 -{{/code}} 93 - 94 -These configuration options will instruct the package to remove obsolete files which become stale as updates come in. 95 - 96 -{{code language="none"}} 97 -// Automatically reboot *WITHOUT CONFIRMATION* if 98 -// the file /var/run/reboot-required is found after the upgrade 99 -Unattended-Upgrade::Automatic-Reboot "true"; 100 -{{/code}} 101 - 102 -This will instruct the package to automatically reboot the system. This is necessary after specific kernel updates are installed that need to be installed in memory and replace the old ones. 103 - 104 -Finally: 105 - 106 -{{code language="none"}} 107 -// If automatic reboot is enabled and needed, reboot at the specific 108 -// time instead of immediately 109 -// Default: "now" 110 -Unattended-Upgrade::Automatic-Reboot-Time "02:00"; 111 -{{/code}} 112 - 113 -This instructs the package to reboot the whole system, automatically, whenever an update requires it, the next time the system clock reaches this specific configured time. I set mine to reboot the system, whenever an update requires it, at 2AM. You may change the time to whichever fits your needs. 114 - 115 - 63 +[[image:Templates.Article.Template.WebHome@image2.jpg||style="width: 100%"]] 64 +//Figure 2: [[Waves>>https://commons.wikimedia.org/wiki/File:Culebra_-_Playa_de_Flamenco.jpg]]// 116 116 ))) 66 +)))