Skip to content

Guest Account Enabled

Table of Contents

Windows

Option 1: Disable the Guest Account

If the Guest account is not in use, completely disable it by opening a Administrative command prompt on the host and issuing the following command:

net user guest /active:no

Option 2: Restrict the Guest Account Access

If the Guest account is in use, restrict access to available shares by right clicking the share folder on the host, selecting the “Security” tab, selecting the “Guest” user, and removing any privileges.
Restrict Access


Linux

Option 1: Disable Guest access to the samba service

You can verify that a guest has access to list samba shares using crackmapexec.

Guest List Shares

In order to prevent guest access to the samba service, the global section of smb.conf needs to be updated. Add the following lines to prevent the samba service from allowing a Guest to authenticate to the service and restart the samba service: sudo systemctl restart smbd.

Global Config Changes

Now the guest can no longer authenticate and list the shares.

No Guest Access

Option 2: Restrict the Guest Account Access

If option 1 isn't viable because the guest needs access to some shares and not others, then use this option. This allows the guest to still authenticate to the samba service and list the shares but denies the guest access to a specific shared folder. Starting with a shared folder called Shared that a guest has access to, the config in smb.conf will look something like this:

Guest Ok

That allows the guest to list the shared folders and access the specific Shared folder.

Guest List And Access

To remove the guest's access to Shared, the smb.conf config for Shared needs to be updated. Change guest ok = no and restart the samba service: sudo systemctl restart smbd.

Guest Not Ok

Now the guest can still list the shares but is unable to connect to the Shared folder.

Guest List No Access