Permission denied as root

3

The root user of Linux doesn't have permission to read/write a regular file, unless all users have permission to read/write this file, like below:

drwxrwsrwx ....... file_name

However the owner of the file can still read/write this file.

AND:

0) not the problem of execution, just read/write
1) not the problem of device because regular user can read/write it.
2) the result of command id:

uid=0(root) gid=0(root) groups=0(root)

so I don't think it's the problem of group.

So what other problems could be?

owenwater

Posted 2011-03-23T06:48:42.907

Reputation: 131

In case anyone else is being stupid and winds up here, I ran into a similar issue because I was trying to delete a bunch of files in a Samba share from a different machine. I wasn't allowed to delete them, or to change the permissions, as root because the root I was using wasn't the root on the machine where the files were actually stored. – Soren Bjornstad – 2016-08-20T20:30:55.920

1

You may get a better response asking your question in http://unix.stackexchange.com/

– Johnsyweb – 2011-03-23T06:51:56.663

1Is this filesystem on an NFS export? – Kirby Todd – 2011-03-23T06:57:45.453

yes, I guess it maybe the problem of NFS. Thx a lot – None – 2011-03-23T07:38:55.480

If the output is really is drwxrwsrwx ....... file_nameand the seventh letter (s instead of - or x) isn't a typo, then the s means a SUID Bit is set -> *S(et) U(ser) ID on execution. This means that other users can execute `file_name*with the *same permissions as the user who owns*file_name. But asrootis above all users, it should be able to read the file. Guessing that you are on a GNU/Linux system: What message do you get when trying to read this file asrootuser? Also: Please describe how you do log in asroot` – erch – 2013-12-07T20:08:24.930

Answers

1

Check mounting options like 'rw' 'ro' (read, write issues), 'user' 'exec' (execution issues).

harvyS

Posted 2011-03-23T06:48:42.907

Reputation: 11

These options affect all users not only root. – pabouk – 2013-11-06T14:20:31.417

-2

chmod the files. I add issues with setting up scripts for my firewall on SlackWare 13.37, having the 'permission denied' error when trying to execute.

What I did was, for my problem, is as follows:

chmod 777 /bin/firewall-start

I don't know what exact number (777 in my case) to add after chmod command, but it's a start and I hope this helps.

emtee40

Posted 2011-03-23T06:48:42.907

Reputation: 1

3chmod 777 should never be the smart solution. – Lorenzo Von Matterhorn – 2013-03-24T23:31:33.267

1The numbers are permission triplets (RWX) for user, group and other. Setting it to 777 means that the permission are set to readable, writeable and executable for everyone. Writable for everyone is very much not desired. Note that chmod also suppurts things like 'chmod u+x filename' to set executable for user. Much easier if you do not want to use numbers. – Hennes – 2013-03-24T23:45:02.453