No announcement yet.

Programming in Linux

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programming in Linux

    hello

    im reading Programming in Linux, i havent used Linux either as just a user and as developer im just trying to get into it . and here is something that made me think about , it is said that while developing applications in linux , we need to take into account the user rights thing. i mean for example during run time if the application needs to reach some restricted files, obviously if we didnt took it into account, access denied would happen . so how we resolve this , is there some system calls that we can write root user account info log into ,during run time, or what, give some clarifications plz !!
    thanks for attention!! Hafiz

  • #2
    Re: Programming in Linux

    A process started by a user has by default the same access rights as that user. For most applications that is more than enough.

    What kind of application and what esoteric needs do you have in mind?

    Comment


    • #3
      Re: Programming in Linux

      thanks for respond first of all

      Originally posted by mv2devnull View Post
      A process started by a user has by default the same access rights as that user. For most applications that is more than enough.
      yes, this is what i know
      Originally posted by mv2devnull View Post
      What kind of application and what esoteric needs do you have in mind?
      for now i just want to understand the process ,during the that particular process that is started by user ,process has the same privileges, but what if we need the process for example accessthe sound card , that needs root user privileges i guess , so how the default privileges of a user are changed during execution and get back after it finishes

      Comment


      • #4
        Re: Programming in Linux

        Well, there is naturally the suid bit; a program executable file has uid and gid attributes, and executes having that uid as effective, rather than the uid of the account that did start it.

        Then, there are services (aka daemons), for example the 'ntpd', which accept as command line parameter the uid that they will use. So there must be API for on the fly changes.

        And then there is the divisions to "kernel space" and "user space". Kernel has API. A user program can call kernel API to execute kernel code, which has different permissions. Your soundcard example works so. The driver of the card is in the kernel space, and your tool will communicate with the driver. But sound is a horrid example too, because there are multiple implementations of sound-handling code for Linux.

        Comment


        • #5
          Re: Programming in Linux

          yes, actually i have read about alsa(advanced linux sound architechture) for example, but nothing else came to mind then ,so , thatnx , for explanation

          Comment

          Working...
          X