1

I'm trying to increase the open files limit for Ubuntu 16.04 version by using vi /etc/security/limits.conf Then I add two lines like:

#* soft nofile 4096
#* hard nofile 4096

But when I use :x to save and exit I get E45: 'readonly' option is set (add ! to override) and it doesn't exit.

When I use nano etc/security/limits.conf to modify it I get:

Error writing /etc/security/limits.conf: Permission denied
Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
nebras junaid
  • 25
  • 1
  • 4

1 Answers1

2

/etc is a system directory that a users account will not (or should not) have access to.

You need to use sudo vi /etc/security/limits.conf was required, ie. the use of sudo elevates privileges for the command following the sudo.

guiverc
  • 28,623
  • 5
  • 46
  • 74
  • 1
    Also, as mentioned [here](https://askubuntu.com/a/471777/659265), you could use `sudoedit /etc/security/limits.conf` if your machine is an enterprise-level one, since it logs the action to `/var/log/auth.log` – Diogo Vilela Aug 08 '19 at 09:35
  • 2
    @DiogoVilela I would go further and suggest `sudoedit` even on a non-production machine used by only one person. It can be used [with just about any editor](https://askubuntu.com/a/1161271/22949) and it [uses the user's editor configuration automatically (and without causing permissions problems)](https://askubuntu.com/a/1162664/22949). – Eliah Kagan Aug 08 '19 at 09:54