How to ssh in lightsail instance as root?

0

Hello, How can I login to my lightsail instance as root? I can't find anywhere this option. I know how to login as ubuntu user which is the default one. Also the 'su -l root' command doesn't accept my aws account root password. My instance is ubuntu plesk.

sirick
질문됨 한 달 전185회 조회
1개 답변
2
수락된 답변

To log in to your Lightsail instance as the root user, you'll need to follow these steps:

  1. Generate a new SSH key pair: You'll need an SSH key pair to connect to your Lightsail instance as the root user. If you haven't already, you can generate a new key pair by following the instructions in the Lightsail console.

  2. Assign the SSH key to your instance: In the Lightsail console, go to your instance and click on the "Connect" button. Select the "Connect using SSH" option, and then click on the "Connect" button. This will open a new browser tab with an SSH connection to your instance.

  3. Switch to the root user: Once you're connected to your instance, you can switch to the root user by running the following command:

sudo su -

This will switch you to the root user, and you should now be able to perform any administrative tasks on your Lightsail instance.

Note that the su -l root command you mentioned doesn't work because the root user is not enabled by default on Ubuntu-based Lightsail instances. Instead, you need to use the sudo command to elevate your privileges to the root user.

Also, keep in mind that it's generally not recommended to log in as the root user for everyday tasks. Instead, it's better to use the Ubuntu user and escalate privileges using sudo when necessary.

AWS
JonQ
답변함 한 달 전
profile picture
전문가
Steve_M
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠