Disable SSH Auto Start
December 4, 2024 ยท AI Conversations
### **1. Connect to Your EC2 Instance**
First, connect to your EC2 instance via SSH:
ssh -i "D:awsk.pem" ubuntu@ec2-16-170-254-93.eu-north-1.compute.amazonaws.com
### **2. Stop the SSH Service**
Run the following command to stop the SSH service immediately:
sudo systemctl stop ssh
### **3. Disable SSH from Starting on Boot**
To prevent the SSH service from starting automatically on boot, disable it using:
sudo systemctl disable ssh
### **4. Confirm the Status**
Verify the status to ensure the service is inactive:
sudo systemctl status ssh
You should see an "inactive (dead)" status.
### **5. Update Security Group (Optional)**
If you won't be using SSH anymore, remove or restrict port `22` in the Security Group to prevent any unwanted access.
1. Go to the **AWS Management Console**.
2. Navigate to **EC2 > Security Groups**.
3. Find the security group attached to your instance.
4. Edit inbound rules and remove the rule for port `22`, or limit it to specific IPs if you still require occasional access.
Let me know if you need further assistance!
### **1. Stop the `yarn-service`**
Use the following command to stop the service immediately:
sudo systemctl stop yarn-service
### **2. Disable the Service from Auto-Starting**
To prevent the service from starting automatically on boot, disable it:
sudo systemctl disable yarn-service
### **3. Verify the Service is Stopped**
Check the status of the service to ensure it is no longer running:
sudo systemctl status yarn-service
You should see a status indicating that the service is inactive or stopped.
### **4. (Optional) Remove the Service**
If you no longer need the service, you can remove it entirely:
– Locate the service file, usually in `/etc/systemd/system/` or `/lib/systemd/system/`:
sudo rm /etc/systemd/system/yarn-service.service
– Reload the systemd daemon to reflect the changes:
sudo systemctl daemon-reload
– Ensure the service no longer exists:
sudo systemctl list-unit-files | grep yarn-service
Let me know if you need further assistance!
### **1. List All Active Services**
To display only the active services:
systemctl list-units --type=service --state=active
### **2. List All Services (Active, Inactive, Failed)**
To list all services, including active, inactive, and failed ones:
systemctl list-units --type=service
### **3. List All Installed Services (Enabled, Disabled)**
To show all installed service files and their status (enabled or disabled):
systemctl list-unit-files --type=service
### **4. List Services with Their Status**
To see detailed statuses of services:
sudo systemctl status
### **5. Filter Services by Name**
If you're looking for a specific service (e.g., `yarn-service`):
systemctl list-units --type=service | grep yarn-service
Let me know if you need further clarification!