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

  • SEARCH
  • Home
  • 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 9299657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:36:43+00:00 2026-06-18T22:36:43+00:00

I have a file that has 777 permissions in Linux inside a directory that

  • 0

I have a file that has 777 permissions in Linux inside a directory that is 2770. As root, I am starting Python interactively and trying to set the effective UID to a user without root privs (my regular user account, UID 1010) to access the file, but I am getting Errno 13

OS: Linux (RHEL6U3)
Python: 2.7.3
Parent Directory permissions: 2770 (root owned, user UID is in group)
File Permissions: 777 (-rwxrwxrwx)

The root parent dir:

[root@server / ]#  ls -AFlhd test
64K drwxrwxrwx  4 root FSTEST    2.1K Feb 14 20:42 test/

The parent dir:

[root@server /test ]#  ls -AFlhd t1
64K drwxrws---  4 root FSTEST    2.1K Feb 14 20:42 t1/

The file:

[root@server /test/t1]#  ls -AFlh 06.dd
-rwxrwxrwx 1 root   root             1.0G Feb 14 19:34 06.dd*

How to produce the problem:

[root@server /test/t1]#  python
Python 2.7.3 (default, Jan 22 2013, 16:23:20) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import os
>>> print(os.getresuid(),os.getresgid())
((0, 0, 0), (0, 0, 0))

>>> os.stat("06.dd")
posix.stat_result(st_mode=33279, st_ino=1064458, st_dev=64513L, st_nlink=1, st_uid=0, st_gid=0, st_size=1073741824, st_atime=1360875706, st_mtime=1360870449, st_ctime=1360875600)

>>> fp = open("06.dd")
>>> fp.close()
>>> os.seteuid(1010)
>>> print(os.getresuid(),os.getresgid())
((0, 1010, 0), (0, 0, 0))

>>> fp = open("06.dd")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 13] Permission denied: '06.dd'

So here’s the unusual part … if I change the permissions of the parent directory to 777, the fp=open("06.dd") works with os.seteuid(1010)!

And the even stranger part: If I su to my user and run Python interactively that way, it also works just fine without having to set the file to 777!

[root@server /test/t1]#  su - user ; cd /test/t1/
[user@server /test/t1 ]$ python
Python 2.7.3 (default, Jan 22 2013, 16:23:20) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print(os.getresuid(),os.getresgid())
((1010, 1010, 1010), (1000, 1000, 1000))

>>> os.stat("06.dd")
posix.stat_result(st_mode=33279, st_ino=1064458, st_dev=64513L, st_nlink=1, st_uid=0, st_gid=0, st_size=1073741824, st_atime=1360875706, st_mtime=1360870449, st_ctime=1360875600)

>>> fp = open("06.dd")
>>> fp.close()

What’s going on? I’m thoroughly confused at this point.

  • 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-18T22:36:44+00:00Added an answer on June 18, 2026 at 10:36 pm

    You’re not the owner of t1, so the owner permissions do not apply to you.

    In the first case, your effective group is not the FSTEST group, so the group permissions do not apply to you either. In the second case, your effective group is the FSTEST group, because su is clever enough to set your effective group as well as your effective user (they are separate system calls). Try using

    os.setegid(1000)
    os.seteuid(1010)
    fp = open("06.dd")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying python after a very long time now. I have a file that has
I have a file that has the following format: 12345 TAB_HERE Name : The
I have a test file that has many lines, each line looks something like:
I have an XML file that has a number of nodes, each of which
I have a html file that has invoice details I would like to know
I have a huge file that has some lines that need to have a
I have an image file that has all the character sprites that I will
I have an IDL file that has a #pragma prefix directive, but whenever I
I have an xml file that has an address node that looks like <address>
I have a text file that has item numbers in it (one per line).

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.