> sed -i 's|PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
Will not work if string is commented out:
> grep PasswordAuthentication /etc/ssh/sshd_config
# PasswordAuthentication yes
> sed -i 's|PasswordAuthentication yes|PasswordAuthentication no|g' /etc/ssh/sshd_config
> grep PasswordAuthentication /etc/ssh/sshd_config
# PasswordAuthentication no