0

we have setup the aws linux instances with ssh keys.

Ubuntu user can be login with ssh key , sudo su - getting into root user without prompt password and set the password for root even though not prompting password. how to switch the root user with password using sudo su - command.

ubuntu@ip-172-31-6-222:~$ sudo su -
root@ip-172-31-6-222:~# 
Sven
  • 98,649
  • 14
  • 180
  • 226
Jai
  • 1
  • 3
  • Why? You don't need a root password on Ubuntu. I don't know who came up with the weird sequence `sudo su`, but I never use that, either - what's wrong with `sudo -s` or `sudo -i` ? ([The difference](https://askubuntu.com/questions/70534/what-are-the-differences-between-su-sudo-s-sudo-i-sudo-su) is not important to me). – reinierpost Jun 06 '17 at 10:04

1 Answers1

0

Simply set a password on the 'ubuntu' user account.

When logged in as the 'ubuntu' user, simply execute 'passwd'. The next time you execute 'sudo' you will be prompted for the password which you set.

Ricky
  • 81
  • 5