SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: rc.local

  1. #1
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rc.local

    What is the syntax to add a line to my rc.local file to be executed by a specific user?

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you want it to execute whenever the system boots? Or only when that person logs in?

    If it's running as that person at every system boot, I believe setuid will do the trick.

    If it's something you want to run whenever that user logs in, I think you'll want ~/.bash_profile.
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its for when the system boots. I don't get what you mean.

  4. #4
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm just trying to determine what you hope to accomplish... particularly why you want to run a program as a user.

    If this is a system startup thing you're trying to do, then have a look into setuid.
    ----Adopt-a-Sig----
    Your message here!

  5. #5
    SitePoint Member
    Join Date
    Oct 2002
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    su - $USERNAME -c '$COMMAND'

    where
    $USERNMAE is the user id
    $COMMAND - command or script to execute

    hth,

    gene

  6. #6
    Your daddy. WALoeIII's Avatar
    Join Date
    Apr 2001
    Location
    USA
    Posts
    526
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by egou
    su - $USERNAME -c '$COMMAND'

    where
    $USERNMAE is the user id
    $COMMAND - command or script to execute

    hth,

    gene
    Thats EXACTLY what I was looking for, thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •