Why root Can't open file for writing?

Check that the /usr/lib64/sas12 directory already exists:

root@host:~# ls /usr/lib64/sas12

If it is not the case, you must create the directory before attempting to create the file:

root@host:~# mkdir -p /usr/lib64/sas12
root@host:~# vim /usr/lib64/sas12/smtpd.conf

You vim command should now work as expected.


Either the filesystem is mounted read-only or this is not a root permission problem but a vim feature. Use a different editor or change the file permissions (e.g. make root the file owner), edit the file, and change them back.