0

I have a program that repeatedly uses rsync to send data to the destination, the rsync script which the program uses doesn't need a password to send data as I've used a public-key authentication mechanism for rsync. but the program needs to be run with sudo as it uses some kernel utilities too, but what is happening is whenever I use sudo to run the program it always prompts for password input when calls rsync script.

Is there a way to mitigate this problem?

3
  • Probably. Is there a way to make your question clearer? What are "some kernel utilities"? What does your script look like?
    – waltinator
    Nov 6, 2020 at 14:06
  • @waltinator it uses qdiscs utility of the kernel. the qdiscs are present in netlink library.
    – y_159
    Nov 6, 2020 at 18:45
  • my script contains a rsync command to send data from source to destination. it can be used to send data to destination without using sudo or entering destination's password, but when i'm using it with sudo it always prompts for password.
    – y_159
    Nov 6, 2020 at 18:48

1 Answer 1

0

I think you might not be the administrator of this server, and the admin have setup this to improve security. In case you are the admin you can follow the steps below else you can ask directly the admin to make the changes.

So what you can do :

In case your it asks you to enter your user PASSWORD :

1- Get your username & group id (gid) :

id

2- Check in sudo configuration file :

grep <username> /etc/sudoers
grep <gid> /etc/sudoers

You must see an entry for the group if the line is beginning with % ; else an entry for your username without % symbol :

%<gid>  ALL=(ALL) ALL

Execute visudo to edit /etc/sudoers :

visudo

Now you should add (NOPASSWD:) to make sudo not asks for your user password :

%<gid>  ALL=(ALL) NOPASSWD: ALL

In case your it asks you to enter the root PASSWORD : Execute visudo to edit /etc/sudoers :

visudo

Delete the line above to disable rootpw flag on /etc/sudoers, so you will not be asked to enter the root password :

Defaults rootpw
2
  • Hi, I did this already but for a single user only didn't make any group. but again the question is even with this configuration/setting we have to use sudo which comes back to the original problem, that using sudo with Rsync requires a password, with your suggested solution sudo was necessay but it doesn't required password to proceed.
    – y_159
    Nov 7, 2020 at 4:30
  • i think you have to make tour question more clearer, or share little snippet of your rsync code. are you using rsync to transfer file through networl ?
    – Reda Salih
    Nov 7, 2020 at 13:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .