Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:06:50+00:00 2026-06-11T01:06:50+00:00

I have a file called test with no rwx permissions (I have removed all

  • 0

I have a file called test with no rwx permissions (I have removed all the permission using chmod)

[root@dev]# ls -l test
———-. 1 root root 21 Sep 7 22:22 test

Q1) I am trying to run the below code to check if the file can be opened or not. The value returned to fd is positive. Shouldn’t fd be -1. ?

    fd = open(fname, O_RDONLY);
    if (fd == -1) {
        /* Print error message */
        return (-1);
    }
    close(fd);

Q2) I am even able to cat the file. Shouldn’t there be an error when I cat the file.
[root@dev]# cat test
This is a test file.
[root@dev]#

NOTE: I am using root account.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:06:52+00:00Added an answer on June 11, 2026 at 1:06 am

    Short answer: root can do anything.

    Longer answer: In general, to open a file in a given mode, POSIX requires that the permissions based on your uid and gid allow you the requested type of access, or that you have “appropriate privileges”, a phrase which is implementation-defined. In most real-world implementations, one such condition that satisfies “appropriate privileges” is being the root user (uid 0).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have a file called test.sqlite. How do i go about reading all
I have a program called test.c, and an input file called test.in. I'm trying
Inside my /test folder/music_player/ have have a file called mini_player.swf. If I play it
If I have an xml button in a file called test.xml like this: <Button
Okay, I have a main source called main.c , a header file called test.h
I have one file called test.ai and I need to print it several times,
I am working on ubuntu. I have a file called test.txt. I would like
I'm using Struts2, Spring, and Hibernate. I have written a simple Excel file called
i have a file called test.csv on my webserver and i like to download
I have got the following code in a file called test.java which is located

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.