# [[Enabling root access to Linux VM]] ![[Enabling root access to Linux VM.svg]] Sometimes, for security reasons, root access is disabled by default in [[Linux]] virtual machines. This is commonly seen when using enterprise [[Cloud Provider]]s like [[Google Cloud Platform|GCP]] or [[AWS]], for example. To enable root access, you need to create an [[SSH]] key and change the permissions on the machine to authorize the key for use with the root user. You can follow the instructions [on the GCP docs](https://cloud.google.com/compute/docs/connect/root-ssh), but I'll repost some of it here for ease. ## Steps ### [[Create an SSH key on Linux|Create an SSH key]] Generate an [[SSH]] key. You can do this on any computer, including the one you want to access via `root`. ### Enable root login Allow connections to the VM using `root` by running this command: ```bash sudo sed -i 's/PermitRootLogin no/PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config ``` ### Add key as authorized key Run these commands one at a time: ```bash sudo mkdir /root/.ssh sudo chmod 700 /root/.ssh sudo touch /root/.ssh/authorized_keys sudo chmod 600 /root/.ssh/authorized_keys ``` Copy the public SSH key that you created earlier, and then paste it into `/root/.ssh/authorized_keys`. [[Reboot Linux VM|Reboot the VM]] and then [[Connect to Linux VMs as root|reconnect as root]]. %% # Excalidraw Data ## Text Elements ## Drawing ```json { "type": "excalidraw", "version": 2, "source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.1.4", "elements": [ { "id": "4y8R7iOA", "type": "text", "x": 118.49495565891266, "y": -333.44393157958984, "width": 3.8599853515625, "height": 24, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "transparent", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "roundness": null, "seed": 967149026, "version": 2, "versionNonce": 939059582, "isDeleted": true, "boundElements": null, "updated": 1713723615080, "link": null, "locked": false, "text": "", "rawText": "", "fontSize": 20, "fontFamily": 4, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "", "lineHeight": 1.2 } ], "appState": { "theme": "dark", "viewBackgroundColor": "#ffffff", "currentItemStrokeColor": "#1e1e1e", "currentItemBackgroundColor": "transparent", "currentItemFillStyle": "solid", "currentItemStrokeWidth": 2, "currentItemStrokeStyle": "solid", "currentItemRoughness": 1, "currentItemOpacity": 100, "currentItemFontFamily": 4, "currentItemFontSize": 20, "currentItemTextAlign": "left", "currentItemStartArrowhead": null, "currentItemEndArrowhead": "arrow", "scrollX": 583.2388916015625, "scrollY": 573.6323852539062, "zoom": { "value": 1 }, "currentItemRoundness": "round", "gridSize": null, "gridColor": { "Bold": "#C9C9C9FF", "Regular": "#EDEDEDFF" }, "currentStrokeOptions": null, "previousGridSize": null, "frameRendering": { "enabled": true, "clip": true, "name": true, "outline": true } }, "files": {} } ``` %%