Fellow devoted,

I have problem which i have not found good solution.

There is three (Linux) users A, B and C who scan images to ~/images/scan
They should upload those pics to the remote server where they don't have accounts.
Therefor is user X, who has access to remote server, but who has no access to user's home directories.

So far i had the "remote server" in my LAN and i did not worry about plain text password too much. I made perl script, which runs with setgid and get by group rights credentials to local FTP-server but run with user's permission, so it had access to home directory trees.

Now i have "remote server" far away and wanted to work out something more secure and without passwords. scp with authorized keys seemed very good way for this.

So first i tried with Net::SCP, but if runned it with setuid in user X rights, it could access server, but not users Homes. And if runned it with setgid, it has access to local homes, but can't access remote server. Main problem: i did not get Net::SCP to use user X's identity files.

So i moved to Net::SCP::Expect, which should use identity files. Made such simple test script:

#!/usr/bin/suidperl # running setgid to get access to identity file use strict; use warnings; my %c; $ENV{PATH} = ''; $c{user} = 'www'; $c{remote} = '192.168.1.3'; $c{identity} = "/etc/pass/id_rsa"; # readable root.special_group use Net::SCP::Expect; my $scpe = Net::SCP::Expect->new(host=>$c{remote}, user=>$c{user}, identity_file=>$c{identity} ); $scpe->scp("/home/eks/profiles.ini", "/home/www/");


Error i got is EXACTLY such one
 at /usr/share/perl5/Expect.pm line 759 not found

I have no power to understand, what this means. Seems like bug to me.

I just have no good ideas more. Maybe i just invent wheel here and some could suggest me something more simple?

I don't want loose presmissions to users, but they should get those pics uploaded in some secure way. Perl and CLI are prefferred

TIA!
Nġnda, WK

In reply to Secure upload without account in remote server by wanradt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.