sudo users

0

Hello,

We have a problem with the sudo command after a change on our lightsail instance.

The user which has been created during the lightsail initialization is called "admin". He could use "sudo" without a password (in fact there is no password defined for him).

In order to secure the system, we changed this line in the /etc/sudoers.d/90-cloud-init-users

admin ALL=(ALL) NOPASSWD:ALL

to

root ALL=(ALL) NOPASSWD:ALL

Now the system is really secure ;-) because we cannot use "sudo" anymore for the admin user.

Is there any way to mount a system volume from one lightsail instance in a new lightsail rescue instance? Or are there any other tricks to change this simple line...?

Thanks in advance,
TCF

tcf
질문됨 5년 전667회 조회
3개 답변
0

As far as I know, the only way you're supposed to update the sudoers file is to use visudo.

profile picture
David G
답변함 5년 전
0

Thanks, David.

Unfortunately we need sudo rights to use visudo.

tcf
답변함 5년 전
0

I solved it!

  1. Stop the running instance
  2. Make a snapshot
  3. Create a new instance with all disks from the snapshot using this launch script:
    echo 'admin ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/90-cloud-init-users
  4. Detach static IP from old instance
  5. Attach static IP to new instance
  6. Check firewall rules of new instance
  7. Connect to new instance
  8. Do some cleanup in the sudoers file
  9. Remove old instance and old disks

Puuuh ;-)

tcf
답변함 5년 전

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

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

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

관련 콘텐츠