Skip to content

Fatal: can't open lock file /run/xtables.lock: Permission denied #2

@NagarajKoti

Description

@NagarajKoti

Hi Experts.

I am running the iptables 1.8.2.4, when i run iptables as a non root user i am getting the below error
"Fatal: can't open lock file /run/xtables.lock: Permission denied" but this is not the case in the iptable 1.4.8 it works fine for both root and none root user. when i check the 1.8.2.4 code below code is introduced but it is not there in the 1.4.8, Please let me know why this changes in the newer version of the iptables.
static int xtables_lock(int wait, struct timeval *wait_interval)
{
struct timeval time_left, wait_time;
int fd, i = 0;
time_left.tv_sec = wait;
time_left.tv_usec = 0;

    fd = **open(XT_LOCK_NAME, O_CREAT, 0600)**;
    if (fd < 0) {
            fprintf(stderr, "Fatal: can't open lock file %s: %s\n",
                    XT_LOCK_NAME, strerror(errno));
            return XT_LOCK_FAILED;
    }

Thanks
Koti

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions