
How to Disable NetBiOS on MacOS OS X - mindfrost82
https://www.tecklyfe.com/disable-netbios-macos-os-x/
======
teovall
That seems like a rather strange way to construct that command.

Why not just:

    
    
        sudo printf "[default]\nport445=no_netbios\n" >> /etc/nsmb.conf

~~~
rkeene2
That command would run the redirection in the local shell. You can try it out
and notice that it doesn't work, because the local shell does not have write
access to that file.

Shell redirection works by opening the destination file and then dup2()'ing it
to stdout before exec??()'ing the target program (sudo, in this case) -- since
that open fails, the target program is never even run -- and the open()'ing
certainly isn't done after sudo runs, since your shell isn't even part of the
execution environment at that point (its image having been replaced by
sudo's).

Another way to do it, is to invoke a shell that does the redirection after
sudo runs, like so:

sudo bash -c '( echo blah; echo blah; echo blah ) >> /etc/nsmb.conf'

