0

I am running pfSense 21.05.2 in AWS. I can ssh in as ec2-user, and I can see that the sudo package (0.3_6 with a dependency on sudo-1.9.7) came pre-installed. In the web interface, under System > Sudo, I can see the ec2-user has Run As privileges for root and No Password is checked and the Command List is ALL.

This is the behavior I observe in the shell:

> whoami
ec2-user

> sudo su -
su: Sorry

1 Answer 1

0

sudo su - admin will let you become root.

In AWS pfSense 21.05.2, you login with the username admin and automatically are root after choosing option 8:

ssh -i ~/.ssh/your_key.pem admin@<your_ip>

*** Welcome to Netgate pfSense Plus 21.05.2-RELEASE (amd64) on pfsense ***

 WAN (wan)       -> ena0       -> v4/DHCP4: <your_ip>/<bits>

 0) Logout (SSH only)                  9) pfTop
 1) Assign Interfaces                 10) Filter Logs
 2) Set interface(s) IP address       11) Restart webConfigurator
 3) Reset webConfigurator password    12) PHP shell + Netgate pfSense Plus tools
 4) Reset to factory defaults         13) Update from console
 5) Reboot system                     14) Disable Secure Shell (sshd)
 6) Halt system                       15) Restore recent configuration
 7) Ping host                         16) Restart PHP-FPM
 8) Shell

Enter an option: 8

> whoami
root

> cat /usr/local/etc/sudoers
root ALL=(root)  ALL
admin ALL=(root)  ALL
%admins ALL=(root)  ALL
ec2-user ALL=(root) NOPASSWD: ALL

You will see that /root/.ssh/authorized_keys contains the same key as as /home/ec2-user/.ssh/authorized_keys (the key you specified when you launched the instance).

If you try to login as root@<your_ip>, you will get a Permission denied (publickey). error.

The reason sudo su - does not work by itself is that without a username specified, root is implied, and you cannot login to root directly (but must go through the admin menu).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .