#1
  1. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,333
    Rep Power
    594

    File::Copy using real user


    I have a script that needs to run as root (sudo). However, it needs to copy a file to a network mounted directory to which the running user has R/W access but not root. How do I use 'copy' as the underlying user rather than root? TIA.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,961
    Rep Power
    9397
    ...Are you sure root doesn't have access? Because last I checked root had de facto access to everything.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,333
    Rep Power
    594
    Not necessarily when it is a network mounted file system. The local root would not necessarily have R/W access but a network authenticated user would. I think I can do it with 'su' if I can figure out how to get the invoking uid. Both '$<' and '$>' return 0.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,333
    Rep Power
    594
    Got it. I forgot all about 'getlogin'.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo