How to edit /etc/profile using emacs?
/etc/profile is set to read-only for all users, so just using sudo won't help.

What you can do:


run sudo emacs /etc/profile
type C-x C-q to toggle readonly mode within Emacs
edit whatever you want
type C-x C-s to save it


Alternatively you can run

EDITOR=emacs sudo -e /etc/profile


which automatically creates a temporary copy of the file you want to edit (which makes it a bit safer in case you want to cancel the update).