Cannot edit my.cnf file /etc/mysql/ directory because it is a symbolic link. What can I do?
That is normal behaviour for sudoedit
(see man sudoedit
)
To help prevent the editing of unauthorized files, the following restrictions are enforced unless explicitly allowed by the security policy:
· Symbolic links may not be edited (version 1.8.15 and higher).
You can edit the file pointed to by the symlink by calling a text editor directly, for example
sudo nano /etc/mysql/my.cnf
will follow the symlink to the file it points to and allow you to edit that file.
But it would be better to find the regular file by doing
readlink -e /etc/mysql/my.cnf
This will find the regular file pointed to by the symlink, so you can sudoedit
it, leaving the symlink alone. Applications that read /etc/mysql/my.cnf
will read the file it points to.
Related videos on Youtube
MPrinz
Updated on September 18, 2022Comments
-
MPrinz over 1 year
I'm trying to configure mysql but when I type:
sudoedit /etc/mysql/my.cnf
it says I cannot edit a symbolic link.
Can I remove the symbolic link or change the security settings to allow a symbolic link to be edited? Does it have anything to do with apparmor restrictions?
-
TheWanderer over 7 yearsI don't think symlinks actually contain any info besides the pointer to the original file.
sudoedit
probably tries to directly edit the file and doesn't try to follow symlinks, so it doesn't allow you to edit.
-