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 6004689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:17:54+00:00 2026-05-23T01:17:54+00:00

I want to know how does a process in Linux decides what privileges it

  • 0

I want to know how does a process in Linux decides what privileges it has?

Suppose there is a binary program Read_File that reads from file /home/myname/data.txt and displays the contents of it to the STD output; now, how does Read_File decides whether or not it has permission to read data.txt, what type of ids it checks to decide the privileges?

  • 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-05-23T01:17:54+00:00Added an answer on May 23, 2026 at 1:17 am

    First, a bit of background:

    The process is usually run by a specific user. So for example, if you log in yourself and run the program, it will run with the same privileges as yourself. You can check the permissions on the file with either stat or ls -l.

    Using stat

    malbert@dredg:/tmp$ stat foo
      File: `foo'
      Size: 0               Blocks: 0          IO Block: 4096   regular empty file
    Device: fb00h/64256d    Inode: 618         Links: 1
    Access: (0644/-rw-r--r--)  Uid: (11204/ malbert)   Gid: (10513/domain users)
    Access: 2011-06-10 13:03:27.181227226 +0200
    Modify: 2011-06-10 13:03:27.181227226 +0200
    Change: 2011-06-10 13:03:27.181227226 +0200
    

    The important infos here are:

    Access: (0644/-rw-r--r--)  Uid: (11204/ malbert)   Gid: (10513/domain users)
    

    This tells you the permissions for the owner (rw-), group (r--) and everyone else (r--). It also shows you the current owner id (Uid) and the current group id (Gid).

    The abbreviations stand for:

    • r = read access
    • w = write access
    • x = execute/traverse directory access

    Using ls -l

    ls -l gives you a quick summary:

    malbert@dredg:/tmp$ ls -l /tmp
    total 48
    drwx------ 2 malbert domain users 4096 2011-06-10 08:51 akonadi-malbert.zOSngu
    -rw-r--r-- 1 malbert domain users    0 2011-06-10 13:03 foo
    drwx------ 2 kdm     nogroup      4096 2011-06-10 08:51 kde-kdm
    drwx------ 3 malbert domain users 4096 2011-06-10 08:51 kde-malbert
    [snip]
    

    Here you can see the same info as with stat, but as a summary. Also, the uid’s and gid’s are resolved into names (in this case malbert and domain users). You can use ls -u to see these as numeric values.

    In case you want to run the application as a different user as yourself, you can either use su, sudo or your application itself can drop priviledges and change the user it is running as. This is usually the way system daemons do things.

    ACLs / extended attributes

    Be careful about extended attributes. When listing the files using ls -l these are visible with an appended + sign. For example:

    malbert@dredg:/tmp$ ls -l
    total 48
    drwx------  2 malbert domain users 4096 2011-06-10 08:51 akonadi-malbert.zOSngu
    -rw-rwxr--+ 1 malbert domain users    0 2011-06-10 13:03 foo
    drwx------  2 kdm     nogroup      4096 2011-06-10 08:51 kde-kdm
    drwx------  3 malbert domain users 4096 2011-06-10 08:51 kde-malbert
    [snip]
    

    Notice the following line:

    -rwxr--+ 1 malbert domain users    0 2011-06-10 13:03 foo
    

    The + sign in -rwxr--+ points to extended attributes. It is possible that these are ACLs. There is an excellent document on ACLs in the SuSE documentation. Go have a look at it if you need to. Explaining ACLs would certainly explode this article, so I won’t discuss those.

    Extended attributes could also be related to the file system. See the man page of chattr for more information on that.

    Now, as a sidenote: this is StackOverflow. Questions should be development related. For questions like this one, there’s http://www.serverfault.com. But As you were not aware, that this is not a development problem, but more related to the OS, I felt I should answer anyway 😉

    Good luck, and have fun!

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

Sidebar

Related Questions

I want to know how does the SQL Server know what @p# is in
as google does not deliver what i want to know, i try to ask
Does anyone know a good (free) C# eBook for intermediate programmers? I want something
I want to write a real-time analysis tool for wireless traffic. Does anyone know
I want to know what exactly is the sequence of calls that occurs when
Want to know what the stackoverflow community feels about the various free and non-free
I want to know what a virtual base class is and what it means.
I want to know what are the options to do some scripting jobs in
I want to know which tool can be used to measure the cyclomatic complexity
I want to know how to use variables for objects and function names in

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.