|
@@ -0,0 +1,85 @@
|
|
|
+# Ubuntu System Setup Guide
|
|
|
+
|
|
|
+## 1. Update and Upgrade Ubuntu System
|
|
|
+To ensure your system is up to date, run the following commands:
|
|
|
+```bash
|
|
|
+sudo apt update && sudo apt upgrade -y
|
|
|
+```
|
|
|
+This will update the package list and upgrade all installed packages.
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 2. Create a New Sudo User
|
|
|
+Creating a new sudo user helps maintain security instead of using the root account.
|
|
|
+
|
|
|
+### **Step 1: Add a New User**
|
|
|
+Replace `username` with your desired username:
|
|
|
+```bash
|
|
|
+sudo adduser username
|
|
|
+```
|
|
|
+You will be prompted to enter a password and user details.
|
|
|
+
|
|
|
+### **Step 2: Grant Sudo Privileges**
|
|
|
+```bash
|
|
|
+sudo usermod -aG sudo username
|
|
|
+```
|
|
|
+This adds the user to the `sudo` group, allowing administrative access.
|
|
|
+
|
|
|
+### **Step 3: Verify the User Has Sudo Access**
|
|
|
+Switch to the new user:
|
|
|
+```bash
|
|
|
+su - username
|
|
|
+```
|
|
|
+Run a test command:
|
|
|
+```bash
|
|
|
+sudo whoami
|
|
|
+```
|
|
|
+If successful, it should return `root`.
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 3. Disable Root SSH Access
|
|
|
+To enhance security, disable SSH access for the root user.
|
|
|
+
|
|
|
+### **Step 1: Edit the SSH Configuration File**
|
|
|
+```bash
|
|
|
+sudo nano /etc/ssh/sshd_config
|
|
|
+```
|
|
|
+
|
|
|
+### **Step 2: Find and Modify the Following Line**
|
|
|
+Change:
|
|
|
+```bash
|
|
|
+PermitRootLogin yes
|
|
|
+```
|
|
|
+To:
|
|
|
+```bash
|
|
|
+PermitRootLogin no
|
|
|
+```
|
|
|
+
|
|
|
+### **Step 3: Save and Exit**
|
|
|
+Press `CTRL+X`, then `Y`, and hit `ENTER` to save the file.
|
|
|
+
|
|
|
+### **Step 4: Restart the SSH Service**
|
|
|
+```bash
|
|
|
+sudo systemctl restart ssh
|
|
|
+```
|
|
|
+
|
|
|
+### **Step 5: Verify Root SSH is Disabled**
|
|
|
+Try logging in as root via SSH:
|
|
|
+```bash
|
|
|
+ssh root@your-server-ip
|
|
|
+```
|
|
|
+It should now be blocked.
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## 4. Additional Security Measures
|
|
|
+- Use **SSH key authentication** instead of passwords.
|
|
|
+- Change the **default SSH port** to a non-standard port.
|
|
|
+- Use **firewalls** like `ufw` to allow only necessary connections.
|
|
|
+
|
|
|
+---
|
|
|
+
|
|
|
+## **Done! 🎉**
|
|
|
+Your Ubuntu system is now **updated, secure, and configured with a sudo user**.
|
|
|
+
|