Aim :
Set up SSH for secure and convenient remote access to your Linux server.
SSH Setup: A Step-by-Step Guide
Secure Shell (SSH) is a cryptographic network protocol used for secure data communication, remote command-line login, remote command execution, and more. Follow these steps to set up SSH on your Linux server.
Guidance on How to Use:
Prerequisite:
Ensure that your Linux server is up and running.
- Install OpenSSH Server on your Linux server:
sudo apt install openssh-server - Enable the SSH service:
sudo systemctl enable ssh - Start the SSH service:
sudo systemctl start ssh - Verify the status of the SSH service:
sudo systemctl status ssh - Change SSH port (optional):
Find the linesudo nano /etc/ssh/sshd_configPort 22and change the port number to your desired value. Save and exit, then restart the SSH service:sudo systemctl restart ssh - Create SSH key pair (if not already created):
Follow the prompts to generate your SSH key pair. The public key will be stored inssh-keygen -t rsa -b 4096~/.ssh/id_rsa.pub. - Copy SSH public key to the remote server:
Enter your password when prompted.ssh-copy-id [YourUsername]@[YourServer] - Disable password authentication (optional, after confirming key-based authentication works):
Setsudo nano /etc/ssh/sshd_configPasswordAuthentication no, then save and restart the SSH service. - Securely copy files between local and remote machines using SCP:
scp [file] [YourUsername]@[YourServer]:[destination]
Verification:
Connect to your server using SSH:
ssh [YourUsername]@[YourServer]

Comments
Post a Comment