Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How do I allow my test script to get rsync to archive file ownership?

by Corion (Patriarch)
on Jan 22, 2018 at 17:33 UTC ( [id://1207688]=note: print w/replies, xml ) Need Help??


in reply to How do I allow my test script to get rsync to archive file ownership?

At least for the password, I think that Net::OpenSSH can let your ssh-agent provide the key. That way, you only need to load your keys once and provide the password to them once, and all SSH-based scripts can then reuse them.

I'm somewhat unclear on your actual setup and why/where you have a problem with the environment. Personally, I like to do all development locally and have the needed modules pulled in through a Makefile.PL or cpanfile, which I load via cpanm --installdeps .. I don't need any kind of root user or permissions to upload my files to a remote account though, and really prefer it that way, so I don't really understand where your problem actually is. My suggestion here is to find a setup that does not need root on either side of the connection at all.

Replies are listed 'Best First'.
Re^2: How do I allow my test script to get rsync to archive file ownership?
by nysus (Parson) on Jan 22, 2018 at 17:56 UTC

    I'm already using an ssh key for the remote machine. I'm referring to the password prompt for the sudo command in my bash script.

    Regarding the libraries, in my bash profile, I have PERL5LIB=/path/to/my/perl/modules. The modules in my PERL5LIB path weren't installed with cpan. They are just simple module files located in a regular old directory.

    For rsync's archive feature to work properly, using the root user is the prescribed way to do it, at least from what I've read. See this discussion, for example.

    Thanks!

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      Sudo can be configured to not ask for a password. See the NOPASSWD option.

        OK, it finally hit me, I can give NOPASSWD access to prove. My question now is, does that open up a security hole? For example, a malicious app running under my name could basically run any perl test with root privileges, right? Or, if they got access to my local account, they could also run a perl script with root privileges.

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
        $nysus = $PM . ' ' . $MCF;
        Click here if you love Perl Monks

        Yeah, looked into that. But apparently giving a user access to rsync is the equivalent of making them root because rsync has so many powerful features.

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
        $nysus = $PM . ' ' . $MCF;
        Click here if you love Perl Monks

      I don't get this. Why don't you upload as the user who should be owning the files in the end? That way you won't need root and won't need rsync to change the ownership at all.

        If I have a directories with a mix of file and group ownerships, ideally, I'd like to preserve them with rsync's archive option. If I upload those files to the server from a backup without the archive option, my file and group ownerships will be lost.

        $PM = "Perl Monk's";
        $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
        $nysus = $PM . ' ' . $MCF;
        Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1207688]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found