Correct file permissions for in-browser updates using WP-CLI

WordPress can’t write files directly most probably because user which runs PHP interpreter don’t have permission to write. Correct answer depends on what is your environment – if you are on shared hosting probably you can’t do anything about it and the only option is to set FTP credentials on wp-config.php so you won’t need to enter it all the time. Look on codex

define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org' );

If you have root control over your system you can change file owner to user which runs PHP interpreter but this can be dangerous if you run more than one site on this server. If this is the case you probably should configure environment where every site has one user in the system which own the files of this particular site and run them with this user privileges. You can do this for example with application pools if you are using php-fpm or with suPHP.

You can check if this is the case by temporarily change files owner to user which runs PHP interpreter. If you use Apache server with mod_php it will probably be www-data user.