Safely granting permission to a Perl script to change users and groups of filed downloaded with rsync

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I've got a Perl script which is a wrapper to a Net::OpenSSH object which I use to rsync a remote server's files to my local machine. I'm using the archive, -a, option to preserve file ownership and permission. When I download the files, however, the user and owner is set to my local user and group, not the user and group of the files on the server.



I changed the group of my script to admin which can run all commands with no password. But this didn't work.



Is there a way to do this securely without having to enter a password?







share|improve this question
















  • 2




    You're basically asking how to grant the script super user privileges without asking for a password? Running the script using sudo would do that. If that is secure or not depends on the script and the user using it.
    – Kusalananda
    Jan 22 at 13:34










  • You can do part of what you're asking with sudo. You can limit a user to being able to only use the command useradd. However your problem is probably bigger. Linux doesn't by default use ACLs and it just uses a user id and group id that is not random ids are just created in order. This means this id is likely to map from the old systems first user to the new systems first user and so on.
    – jdwolf
    Jan 22 at 13:44











  • The problem is if I run as sudo, it won't be able to find my locally installed perl library.
    – StevieD
    Jan 22 at 13:44










  • @StevieD Run sudo with the -E option.
    – jdwolf
    Jan 22 at 13:45










  • Thanks but still got perl errors with -E. It can't find the necessary modules.
    – StevieD
    Jan 22 at 13:50














up vote
0
down vote

favorite












I've got a Perl script which is a wrapper to a Net::OpenSSH object which I use to rsync a remote server's files to my local machine. I'm using the archive, -a, option to preserve file ownership and permission. When I download the files, however, the user and owner is set to my local user and group, not the user and group of the files on the server.



I changed the group of my script to admin which can run all commands with no password. But this didn't work.



Is there a way to do this securely without having to enter a password?







share|improve this question
















  • 2




    You're basically asking how to grant the script super user privileges without asking for a password? Running the script using sudo would do that. If that is secure or not depends on the script and the user using it.
    – Kusalananda
    Jan 22 at 13:34










  • You can do part of what you're asking with sudo. You can limit a user to being able to only use the command useradd. However your problem is probably bigger. Linux doesn't by default use ACLs and it just uses a user id and group id that is not random ids are just created in order. This means this id is likely to map from the old systems first user to the new systems first user and so on.
    – jdwolf
    Jan 22 at 13:44











  • The problem is if I run as sudo, it won't be able to find my locally installed perl library.
    – StevieD
    Jan 22 at 13:44










  • @StevieD Run sudo with the -E option.
    – jdwolf
    Jan 22 at 13:45










  • Thanks but still got perl errors with -E. It can't find the necessary modules.
    – StevieD
    Jan 22 at 13:50












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've got a Perl script which is a wrapper to a Net::OpenSSH object which I use to rsync a remote server's files to my local machine. I'm using the archive, -a, option to preserve file ownership and permission. When I download the files, however, the user and owner is set to my local user and group, not the user and group of the files on the server.



I changed the group of my script to admin which can run all commands with no password. But this didn't work.



Is there a way to do this securely without having to enter a password?







share|improve this question












I've got a Perl script which is a wrapper to a Net::OpenSSH object which I use to rsync a remote server's files to my local machine. I'm using the archive, -a, option to preserve file ownership and permission. When I download the files, however, the user and owner is set to my local user and group, not the user and group of the files on the server.



I changed the group of my script to admin which can run all commands with no password. But this didn't work.



Is there a way to do this securely without having to enter a password?









share|improve this question











share|improve this question




share|improve this question










asked Jan 22 at 13:30









StevieD

1507




1507







  • 2




    You're basically asking how to grant the script super user privileges without asking for a password? Running the script using sudo would do that. If that is secure or not depends on the script and the user using it.
    – Kusalananda
    Jan 22 at 13:34










  • You can do part of what you're asking with sudo. You can limit a user to being able to only use the command useradd. However your problem is probably bigger. Linux doesn't by default use ACLs and it just uses a user id and group id that is not random ids are just created in order. This means this id is likely to map from the old systems first user to the new systems first user and so on.
    – jdwolf
    Jan 22 at 13:44











  • The problem is if I run as sudo, it won't be able to find my locally installed perl library.
    – StevieD
    Jan 22 at 13:44










  • @StevieD Run sudo with the -E option.
    – jdwolf
    Jan 22 at 13:45










  • Thanks but still got perl errors with -E. It can't find the necessary modules.
    – StevieD
    Jan 22 at 13:50












  • 2




    You're basically asking how to grant the script super user privileges without asking for a password? Running the script using sudo would do that. If that is secure or not depends on the script and the user using it.
    – Kusalananda
    Jan 22 at 13:34










  • You can do part of what you're asking with sudo. You can limit a user to being able to only use the command useradd. However your problem is probably bigger. Linux doesn't by default use ACLs and it just uses a user id and group id that is not random ids are just created in order. This means this id is likely to map from the old systems first user to the new systems first user and so on.
    – jdwolf
    Jan 22 at 13:44











  • The problem is if I run as sudo, it won't be able to find my locally installed perl library.
    – StevieD
    Jan 22 at 13:44










  • @StevieD Run sudo with the -E option.
    – jdwolf
    Jan 22 at 13:45










  • Thanks but still got perl errors with -E. It can't find the necessary modules.
    – StevieD
    Jan 22 at 13:50







2




2




You're basically asking how to grant the script super user privileges without asking for a password? Running the script using sudo would do that. If that is secure or not depends on the script and the user using it.
– Kusalananda
Jan 22 at 13:34




You're basically asking how to grant the script super user privileges without asking for a password? Running the script using sudo would do that. If that is secure or not depends on the script and the user using it.
– Kusalananda
Jan 22 at 13:34












You can do part of what you're asking with sudo. You can limit a user to being able to only use the command useradd. However your problem is probably bigger. Linux doesn't by default use ACLs and it just uses a user id and group id that is not random ids are just created in order. This means this id is likely to map from the old systems first user to the new systems first user and so on.
– jdwolf
Jan 22 at 13:44





You can do part of what you're asking with sudo. You can limit a user to being able to only use the command useradd. However your problem is probably bigger. Linux doesn't by default use ACLs and it just uses a user id and group id that is not random ids are just created in order. This means this id is likely to map from the old systems first user to the new systems first user and so on.
– jdwolf
Jan 22 at 13:44













The problem is if I run as sudo, it won't be able to find my locally installed perl library.
– StevieD
Jan 22 at 13:44




The problem is if I run as sudo, it won't be able to find my locally installed perl library.
– StevieD
Jan 22 at 13:44












@StevieD Run sudo with the -E option.
– jdwolf
Jan 22 at 13:45




@StevieD Run sudo with the -E option.
– jdwolf
Jan 22 at 13:45












Thanks but still got perl errors with -E. It can't find the necessary modules.
– StevieD
Jan 22 at 13:50




Thanks but still got perl errors with -E. It can't find the necessary modules.
– StevieD
Jan 22 at 13:50















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418858%2fsafely-granting-permission-to-a-perl-script-to-change-users-and-groups-of-filed%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f418858%2fsafely-granting-permission-to-a-perl-script-to-change-users-and-groups-of-filed%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?