Step 1: Install the “Remote - SSH” Extension
Install the “Remote - SSH” extension from the Visual Studio Code marketplace.
Step 2: Open the Remote Explorer
After installing the extension, click the “Remote Explorer” icon located below the “Extensions” icon on the sidebar.
Step 3: Gather Your Server Information
On your Ubuntu server, run the following commands to obtain your HostName and User name:
For this example, let’s assume they are “172.25.231.252” and “root,” respectively.
whoami
ip a
Step 4: Open the SSH Config File
Click the settings icon to open the SSH Config file. This file is often located at “~/.ssh/config”.
Step 5: Add Your Server to the SSH Config File
Follow the format given below, replacing the placeholders with your server information obtained in Step 3.
Host myUbuntu
HostName 172.25.231.252
User root
Step 6: Connect to Your Server
Click the right-most icon to connect to your server in a new window.
Step 7: Select Your Server’s Platform
Select “Linux” as the platform.
Step 8: Enter Your Password
Enter your server’s password when prompted.
Step 9: Connection Successful
Once connected, you should see a welcome window indicating that the connection was successful.
To install the SSH server on Ubuntu, you can use the following command:
sudo apt update
sudo apt install openssh-server
In the sshd_config
file content, the PermitRootLogin
option is set to prohibit-password
, which means that it does not allow root user login using password authentication. You need to change this option to yes
and then restart the SSH service.
sshd_config
file:sudo nano /etc/ssh/sshd_config
PermitRootLogin
line and modify it to:PermitRootLogin yes
sudo service ssh restart
To set a user password in Ubuntu, you can use the passwd
command. Here are the steps to set a password:
Open a terminal.
Type the following command and then press Enter:
passwd
The system will prompt you to enter a new password, type the password you want to set, and then press Enter.
The system will ask you to retype the new password for confirmation, retype the password you just entered, and then press Enter.
If the two entered passwords match, the system will display passwd: password updated successfully
, indicating that the password has been successfully set.
If you want to set a password for another user, you can use the following command:
sudo passwd username
And then follow the above steps to enter and confirm the password.