I am searching a way to replace the mysql user shell configuration in /etc/passwd from command line as there are multiple servers where I want to disable the shell for mysql user.
sed. Use the tools provided for interfacing with that file instead.
In this case,
chsh, or possibly the more general
On most systems:
$ sudo chpass -s /sbin/nologin mysql
$ sudo chsh -s /sbin/nologin mysql
You don't want to edit
sed (or with
emacs), and definitely not with