Projet d'étude de la promotion M1 Big Data & IA 2022-2023. L'objectif est de pouvoir visualiser les sentiments des internautes à l'égard de la réforme des retraites.
Step 1️⃣: Log in to the virtual machine via SSH
SSH into the virtual machine using your administrator account. Open a terminal and type:
ssh username@your_virtual_machine_ip
Replace "username" with your administrator account username and "your_virtual_machine_ip" with the IP address or hostname of your virtual machine.
Step 2️⃣: Create a new user
Once logged in, let's create a new user. To add a user, use the following command:
sudo adduser newusername
Replace "newusername" with the desired username for your new user. You'll be prompted to set a password and fill in additional details.
Step 3️⃣: Grant administrative privileges (optional)
If you want to give administrative privileges to the new user, you can add them to the sudo group. Execute the command:
sudo usermod -aG sudo newusername
Step 4️⃣: Generate an SSH key pair
To enable SSH key authentication, we need to generate an SSH key pair for the new user. Run the following command to generate the key pair:
ssh-keygen -t rsa
Press Enter to accept the default file location and optionally set a passphrase (password) for added security. The key pair consists of a private key (id_rsa) and a public key (id_rsa.pub).
Step 5️⃣: Create the .ssh directory for the new user
Next, we need to create the .ssh directory in the new user's home directory. Run the command:
sudo mkdir /home/newusername/.ssh
Step 6️⃣: Copy the public key to the new user's authorized_keys file
Now, we can add the public key to the new user's authorized_keys file. Run the following command to append the public key to the file:
sudo sh -c "cat ~/.ssh/id_rsa.pub >> /home/newusername/.ssh/authorized_keys"
Step 7️⃣: Set proper file permissions
To ensure the security of the SSH key, we need to set the correct file permissions. Execute the following commands to set the required permissions:
Step 8️⃣: Test the SSH key authentication
Before wrapping up, let's test the SSH key authentication for the new user. Open a new terminal and try to SSH into the virtual machine using the new user's credentials:
ssh newusername@your_virtual_machine_ip
You should now be able to log in without being prompted for a password.
POWERED BY CHATGPT
Step 1️⃣: Log in to the virtual machine via SSH SSH into the virtual machine using your administrator account. Open a terminal and type:
Replace "username" with your administrator account username and "your_virtual_machine_ip" with the IP address or hostname of your virtual machine.
Step 2️⃣: Create a new user Once logged in, let's create a new user. To add a user, use the following command:
Replace "newusername" with the desired username for your new user. You'll be prompted to set a password and fill in additional details.
Step 3️⃣: Grant administrative privileges (optional) If you want to give administrative privileges to the new user, you can add them to the sudo group. Execute the command:
Step 4️⃣: Generate an SSH key pair To enable SSH key authentication, we need to generate an SSH key pair for the new user. Run the following command to generate the key pair:
Press Enter to accept the default file location and optionally set a passphrase (password) for added security. The key pair consists of a private key (id_rsa) and a public key (id_rsa.pub).
Step 5️⃣: Create the .ssh directory for the new user Next, we need to create the
.ssh
directory in the new user's home directory. Run the command:Step 6️⃣: Copy the public key to the new user's authorized_keys file Now, we can add the public key to the new user's authorized_keys file. Run the following command to append the public key to the file:
Step 7️⃣: Set proper file permissions To ensure the security of the SSH key, we need to set the correct file permissions. Execute the following commands to set the required permissions:
Step 8️⃣: Test the SSH key authentication Before wrapping up, let's test the SSH key authentication for the new user. Open a new terminal and try to SSH into the virtual machine using the new user's credentials:
You should now be able to log in without being prompted for a password.