Re: sudo and cloud images

From: Eduardo Lemos de Sa <eduardo.lemosdesa_at_gmail.com>
Date: Sat, 03 Jan 2026 20:50:09 UTC
Dear Genéri

On Sat, Jan 3, 2026 at 3:33 PM Gonéri Le Bouder <goneri@lebouder.net> wrote:

> Thank you Eduardo,
>
> So, you log-in the VM and use su to become root. You need the root
> password for that. This is the part that confuses me because the user_data
> file becomes mandatory to set the root password, which is a bit counter
> intuitive.
>
> On Sat, Jan 3, 2026, at 07:24, Eduardo Lemos de Sa wrote:
>
> Dear Generi
>
> Eduardo Lemos de Sa
> Professor Titular
> Dep. Quimica da Universidade Federal do Paraná
> fone: +55(41)3361-3300
> fax:   +55(41)3361-3186
>
> Em sex., 2 de jan. de 2026 22:02, Gonéri Le Bouder <goneri@lebouder.net>
> escreveu:
>
>
> Hi,
>
> I maintain a pet-project where I provide FreeBSD images with Cloud-Init.
> I've been doing this for a couple years and I'm happy to see this is
> something FreeBSD support natively now. I like the nuageinit approach, is
> simple and straightforward.
>
> I'm testing the FreeBSD 15 cloud image and sudo is not installed by
> default, which is a decision I understand. What is the "correct" way to get
> root privileges? Do you use a user_data file to set a root password, and
> just use "su"? If so, what the point of the password, it sounds like some
> extra complexity.
>
>
>
> I install sudo using pkg install sudo (check the sudo version) ou using
> porta (security/sudo).
>
> After installed It, it need tô edit /usr/local/etc/ sudoers aiming to set
> which users can run sudo (search by root user settings and copy copy the
> LINE).
>
>
I think I was not very clear:

1) First, as root (it means, using "su"), you need install sudo (as package
or port)
2) Again, as root (it means, using "su") you must edit
/usr/local/etc/sudoers (if using vim/vi, you must save the files forcely, I
mean, wq! in the end)  adding which users can be sudo
3) As a user included in sudoers file, you can type any command, like, sudo
mkdir /usr/local/etc/test: system will ask the password for the user (not
more as root). In the first time, you (as user) must agree with terms)

I think now, I was more didatic.

Best wishes

Eduardo

>
>
> Best regatas
>
> Eduardo
>
>
> Regards,
> --
>        Gonéri Le Bouder
>
>
>

-- 
Eduardo Lemos de Sa
Professor Titular
Dep. Quimica da Universidade Federal do Paraná
fone: +55(41)3361-3300
fax:   +55(41)3361-3186