I bought a load balancer that runs the application on of FreeBSD. I found the configuration file that has all the settings and login information for both the admin and read-only users. I logged in as the root user, but when I try to alter any files using vi
(the only editor installed) I get a read-only filesystem error. I tried chmod 777 file
, and when I do ls -l
I can see that root has read, write, and execute privileges, but it still won't let me write to the file. What do I need to do to make this file writable?
Asked
Active
Viewed 3.1k times
8

bahamat
- 39,666
- 4
- 75
- 104
2 Answers
12
It's not that the file isn't writable; the filesystem itself is mounted read-only. Use mount
to check the mount options and mount -u -o rw <mount_point>
to remount the filesystem writable.

Michael Mrozek
- 93,103
- 40
- 240
- 233

mschuett
- 366
- 1
- 6
-
-
What does
-u
switch do? I can't find an equivalent one in Ubuntu man page – sherlock May 10 '18 at 03:40 -
The -u flag indicates that the status of an already mounted file system should be changed.
cf. the man page. As far as i know it is a BSD-specific flag to change mount options in place, without having to unmount and re-mount. -- The Linux version uses-o remount
for that function. – mschuett May 10 '18 at 16:11
7
When FreeBSD boot in single-user mode, it mounts only /
filesystem and mounts it in read-only mode. To access all filesystems, you should remount /
in read-write mode and mount other filesystems (if any).
Screenshot from 8.4-RELEASE box:

AntonioK
- 1,193
mount
. Where is the file you're editing located? – Gilles 'SO- stop being evil' Feb 21 '13 at 00:59