Вопрос

/etc/test.conf is a symbolic link to /var/etc/test.conf.

/var/etc/test.conf file has flags sunlnk and schg, meaning file can not be removed/moved and no modifications allowed (read-only).

Without changing file flags:

  • I can NOT delete /var/etc/test.conf AND can NOT modify /var/etc/test.conf.
  • I CAN delete /etc/test.conf but can NOT modify /etc/test.conf.

Is there any way in which we can deny /etc/test.conf (symbolic link) deletion?

Это было полезно?

Решение

It is likely you're not achieving the results you're after because using the flag on the symlink actually sets it on the target file.

You can try chflags -h to to apply the flags to the symlink itself.

chflags -h sunlink,schg /etc/test.conf
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top